#!/usr/bin/python


import sys
import numpy as np
import pylab as plt

def plot_chi(name,label,tot):
  fig = plt.figure(1)
  """Plot a particular scheme for chi"""  
  ## setup the plots
  prt = plt.subplot(2,tot/2,label)
  prt.set_title(name)
  # get the labels
  
  ## real part
  m = np.genfromtxt(name + ".OUT").transpose()
  ene = m[0] 
  if '-sum' in sys.argv: # summ all the contributions
    chi = m[0]*0.0 
    for ii in range(1,len(m)):
      chi += m[ii]
    prt.plot(ene, chi,marker = 'o',label = label )
  else: # sum the trace only 
    chi = m[0]*0.0 
    norb = int(np.sqrt(len(m)-1))
    ii = 0
    for i in range(norb):
      for j in range(norb):
        ii += 1
        if i==j:
          chi += m[ii]
    prt.plot(ene, chi,marker = 'None',linewidth = 2.0, label = label )
    # write down in a file
    fo = open(name+"_TRACE.OUT","w") 
    fo.write("#  Energy, Trace of CHI\n") 
    for (ie,ichi) in zip(ene,chi):
      fo.write(str(ie)+"        "+str(ichi)+"\n") 
    fo.close() 
  fig.set_facecolor("white")
  prt.legend()
#  plt.savefig(name + ".png")
  
  

try:
  plot_chi('CHI_R',1,2)
except:
  pass
try:
  plot_chi('CHI_I',2,2)
except:
  pass
try:
  plot_chi('CHI_RPA_R',1,2)
except:
  pass
try:
  plot_chi('CHI_RPA_I',2,2)
except:
  pass
#plot_chi('SIGMA_R',5)
#plot_chi('ABSORPTION',3)
# plot_chi('CHI_RPA',2)
  
if not "-noshow" in sys.argv:  # show the plot
  plt.show()

01023c29cdc06e06fc4111a45a0ad94f5ef1d5bf
<mask token>

<mask token>


def plot_chi(name, label, tot):
    fig = plt.figure(1)
    """Plot a particular scheme for chi"""
    prt = plt.subplot(2, tot / 2, label)
    prt.set_title(name)
    m = np.genfromtxt(name + '.OUT').transpose()
    ene = m[0]
    if '-sum' in sys.argv:
        chi = m[0] * 0.0
        for ii in range(1, len(m)):
            chi += m[ii]
        prt.plot(ene, chi, marker='o', label=label)
    else:
        chi = m[0] * 0.0
        norb = int(np.sqrt(len(m) - 1))
        ii = 0
        for i in range(norb):
            for j in range(norb):
                ii += 1
                if i == j:
                    chi += m[ii]
        prt.plot(ene, chi, marker='None', linewidth=2.0, label=label)
        fo = open(name + '_TRACE.OUT', 'w')
        fo.write('#  Energy, Trace of CHI\n')
        for ie, ichi in zip(ene, chi):
            fo.write(str(ie) + '        ' + str(ichi) + '\n')
        fo.close()
    fig.set_facecolor('white')
    prt.legend()


<mask token>

<mask token>


def plot_chi(name, label, tot):
    fig = plt.figure(1)
    """Plot a particular scheme for chi"""
    prt = plt.subplot(2, tot / 2, label)
    prt.set_title(name)
    m = np.genfromtxt(name + '.OUT').transpose()
    ene = m[0]
    if '-sum' in sys.argv:
        chi = m[0] * 0.0
        for ii in range(1, len(m)):
            chi += m[ii]
        prt.plot(ene, chi, marker='o', label=label)
    else:
        chi = m[0] * 0.0
        norb = int(np.sqrt(len(m) - 1))
        ii = 0
        for i in range(norb):
            for j in range(norb):
                ii += 1
                if i == j:
                    chi += m[ii]
        prt.plot(ene, chi, marker='None', linewidth=2.0, label=label)
        fo = open(name + '_TRACE.OUT', 'w')
        fo.write('#  Energy, Trace of CHI\n')
        for ie, ichi in zip(ene, chi):
            fo.write(str(ie) + '        ' + str(ichi) + '\n')
        fo.close()
    fig.set_facecolor('white')
    prt.legend()


try:
    plot_chi('CHI_R', 1, 2)
except:
    pass
try:
    plot_chi('CHI_I', 2, 2)
except:
    pass
try:
    plot_chi('CHI_RPA_R', 1, 2)
except:
    pass
try:
    plot_chi('CHI_RPA_I', 2, 2)
except:
    pass
if not '-noshow' in sys.argv:
    plt.show()

import sys
import numpy as np
import pylab as plt


def plot_chi(name, label, tot):
    fig = plt.figure(1)
    """Plot a particular scheme for chi"""
    prt = plt.subplot(2, tot / 2, label)
    prt.set_title(name)
    m = np.genfromtxt(name + '.OUT').transpose()
    ene = m[0]
    if '-sum' in sys.argv:
        chi = m[0] * 0.0
        for ii in range(1, len(m)):
            chi += m[ii]
        prt.plot(ene, chi, marker='o', label=label)
    else:
        chi = m[0] * 0.0
        norb = int(np.sqrt(len(m) - 1))
        ii = 0
        for i in range(norb):
            for j in range(norb):
                ii += 1
                if i == j:
                    chi += m[ii]
        prt.plot(ene, chi, marker='None', linewidth=2.0, label=label)
        fo = open(name + '_TRACE.OUT', 'w')
        fo.write('#  Energy, Trace of CHI\n')
        for ie, ichi in zip(ene, chi):
            fo.write(str(ie) + '        ' + str(ichi) + '\n')
        fo.close()
    fig.set_facecolor('white')
    prt.legend()


try:
    plot_chi('CHI_R', 1, 2)
except:
    pass
try:
    plot_chi('CHI_I', 2, 2)
except:
    pass
try:
    plot_chi('CHI_RPA_R', 1, 2)
except:
    pass
try:
    plot_chi('CHI_RPA_I', 2, 2)
except:
    pass
if not '-noshow' in sys.argv:
    plt.show()

#!/usr/bin/python


import sys
import numpy as np
import pylab as plt

def plot_chi(name,label,tot):
  fig = plt.figure(1)
  """Plot a particular scheme for chi"""  
  ## setup the plots
  prt = plt.subplot(2,tot/2,label)
  prt.set_title(name)
  # get the labels
  
  ## real part
  m = np.genfromtxt(name + ".OUT").transpose()
  ene = m[0] 
  if '-sum' in sys.argv: # summ all the contributions
    chi = m[0]*0.0 
    for ii in range(1,len(m)):
      chi += m[ii]
    prt.plot(ene, chi,marker = 'o',label = label )
  else: # sum the trace only 
    chi = m[0]*0.0 
    norb = int(np.sqrt(len(m)-1))
    ii = 0
    for i in range(norb):
      for j in range(norb):
        ii += 1
        if i==j:
          chi += m[ii]
    prt.plot(ene, chi,marker = 'None',linewidth = 2.0, label = label )
    # write down in a file
    fo = open(name+"_TRACE.OUT","w") 
    fo.write("#  Energy, Trace of CHI\n") 
    for (ie,ichi) in zip(ene,chi):
      fo.write(str(ie)+"        "+str(ichi)+"\n") 
    fo.close() 
  fig.set_facecolor("white")
  prt.legend()
#  plt.savefig(name + ".png")
  
  

try:
  plot_chi('CHI_R',1,2)
except:
  pass
try:
  plot_chi('CHI_I',2,2)
except:
  pass
try:
  plot_chi('CHI_RPA_R',1,2)
except:
  pass
try:
  plot_chi('CHI_RPA_I',2,2)
except:
  pass
#plot_chi('SIGMA_R',5)
#plot_chi('ABSORPTION',3)
# plot_chi('CHI_RPA',2)
  
if not "-noshow" in sys.argv:  # show the plot
  plt.show()
