def Read_Sig(self, TB, nspin): self.Sig = [] self.Nd_imp = zeros(len(self.cor_at), dtype=float) self.N_imp = zeros((len(self.cor_at), TB.max_cor_orb), dtype=float) self.MOM_imp = zeros((len(self.cor_at), TB.max_cor_orb), dtype=float) self.Epot_imp = [] self.Ekin_imp = [] self.mu_imp = [] self.TrSigG = [] for i, ats in enumerate(self.cor_at): d_orb = TB.TB_orbs[ats[0]] fileSig = "imp." + str(i) + "/Sig.out" if os.path.exists(fileSig): ( self.ommesh, Sig_file, TrS, Epot, nf_q, mom, Ekin, imp_mu, ) = Fileio.Read_complex_Data(fileSig) if len(Sig_file) != nspin * len(self.cor_orb[i]): print "The number of correated orbital is not same as Sig file column" exit() if len(mom) != nspin * len(self.cor_orb[i]): print "The number of correated orbital is not same as mom list in Sig file" exit() # if self.nom>len(ommesh_long): print "nom should be decreased!"; exit() self.Nd_imp[i] = nf_q for j, orbs in enumerate(self.cor_orb[i]): for orb in orbs: self.N_imp[i, d_orb.index(orb)] = mom[j] / len(orbs) # self.N_imp[TB.idx[at][orb]]=mom[j]/len(orbs) if nspin == 2: self.N_imp[i, d_orb.index(orb)] += mom[ j + len(self.cor_orb[i]) ] / len(orbs) self.MOM_imp[i, d_orb.index(orb)] = ( mom[j] - mom[j + len(self.cor_orb[i])] ) / len(orbs) for j in range(nspin * len(self.cor_orb[i])): for iom in range(len(self.ommesh)): if Sig_file[j, iom].imag > 0: Sig_file[j, iom] = Sig_file[j, iom].real + 0.0j self.Sig.append(Sig_file[j]) self.TrSigG.append(TrS) self.Epot_imp.append(Epot) self.Ekin_imp.append(Ekin) self.mu_imp.append(imp_mu) self.Sig = array(self.Sig)
emin = -5.0 emax = 5.0 #rom=1000 rom = int(sys.argv[1]) execfile('INPUT.py') TB = Struct.TBstructure('POSCAR', p['atomnames'], p['orbs']) cor_at = p['cor_at'] cor_orb = p['cor_orb'] TB.Compute_cor_idx(cor_at, cor_orb) ommesh = linspace(emin, emax, rom) Sig_tot = zeros((TB.ncor_orb, rom), dtype=complex) for i, ats in enumerate(cor_at): (om, Sig, TrSigmaG, Epot, nf_q, mom) = Fileio.Read_complex_Data('Sig' + str(i + 1) + '.out') newSig = zeros((len(Sig), rom), dtype=complex) for ii in range(len(Sig)): SigSpline = interpolate.splrep(om, Sig[ii].real, k=1, s=0) newSig[ii, :] += interpolate.splev(ommesh, SigSpline) SigSpline = interpolate.splrep(om, Sig[ii].imag, k=1, s=0) newSig[ii, :] += 1j * interpolate.splev(ommesh, SigSpline) for at in ats: for ii, orbs in enumerate(cor_orb[i]): for orb in orbs: idx = TB.idx[at][orb] Sig_tot[idx, :] = copy.deepcopy( newSig[ii, :]) # non spin polarized #Sig_tot[idx,:]=copy.deepcopy(newSig[ii+len(cor_orb[i]),:]) Fileio.Print_complex_multilines(Sig_tot, ommesh, 'SigMoo_real.out')
def Read_Sig(self,TB,nspin): self.Sigoo=[];SigMoo=[] self.Nd_imp=zeros(len(self.cor_at),dtype=float) self.N_imp=zeros((len(self.cor_at),TB.max_cor_orb),dtype=float) self.MOM_imp=zeros((len(self.cor_at),TB.max_cor_orb),dtype=float) self.Eimp=[] for i,ats in enumerate(self.cor_at): d_orb=TB.TB_orbs[ats[0]] fileSig='Sig'+str(i+1)+'.out' if (os.path.exists(fileSig)): # If output file exists, start from previous iteration (ommesh_long,Sig_file,TrS,Epot,nf_q,mom) = Fileio.Read_complex_Data(fileSig) if len(Sig_file)!=nspin*len(self.cor_orb[i]): print "The number of correated orbital is not same as Sig file column"; exit() if len(mom)!=nspin*len(self.cor_orb[i]): print "The number of correated orbital is not same as mom list in Sig file"; exit() if self.nom>len(ommesh_long): print "nom should be decreased!"; exit() self.Nd_imp[i]=nf_q for j,orbs in enumerate(self.cor_orb[i]): for orb in orbs: self.N_imp[i,d_orb.index(orb)]=mom[j]/len(orbs) #self.N_imp[TB.idx[at][orb]]=mom[j]/len(orbs) if nspin==2: self.N_imp[i,d_orb.index(orb)]+=mom[j+len(self.cor_orb[i])]/len(orbs) self.MOM_imp[i,d_orb.index(orb)]=(mom[j]-mom[j+len(self.cor_orb[i])])/len(orbs) #self.Eimp.append(TrS-0.5*sum([mom[j]*Sig_file[j][-1].real for j in range(len(mom))])); #nf_qmc.append(list(mom)) self.Eimp.append(TrS); #nf_qmc.append(list(mom)) self.Sigoo.append(array(Sig_file[:,-1].real)) for iom in range(len(ommesh_long)): Sig_file[:,iom]-=self.Sigoo[i] for ii in range(nspin*len(self.cor_orb[i])): if Sig_file[ii,iom].imag >0: Sig_file[ii,iom]=Sig_file[ii,iom].real+0.0j SigMoo.append(Interpolate(ommesh_long,Sig_file,self.ommesh,1)) else: self.Eimp.append(0.0) self.Sigoo.append([]) SigMoo.append([]) for j in range(nspin*len(self.cor_orb[i])): if j<len(self.cor_orb[i]): self.Sigoo[i].append(-0.1) else: self.Sigoo[i].append(0.1) #Break symmetry SigMoo[i].append(zeros(len(self.ommesh))) self.Sig=zeros((len(TB.cor_idx),len(self.ommesh)),dtype=complex) for i,ats in enumerate(self.cor_at): for at in ats: for j,orbs in enumerate(self.cor_orb[i]): for orb in orbs: idx=TB.idx[at][orb] self.Sig[idx,:] = copy.deepcopy(SigMoo[i][j]) if (os.path.exists('SigMoo.out')): omtemp,self.Sig_old=Fileio.Read_complex_multilines('SigMoo.out') else: self.Sig_old=copy.deepcopy(self.Sig) if nspin==2: self.Sig_dn=zeros((len(TB.cor_idx),len(self.ommesh)),dtype=complex) for i,ats in enumerate(self.cor_at): for at in ats: for j,orbs in enumerate(self.cor_orb[i]): for orb in orbs: idx=TB.idx[at][orb] self.Sig_dn[idx,:] = copy.deepcopy(SigMoo[i][j+len(self.cor_orb[i])]) if (os.path.exists('SigMoo_dn.out')): omtemp,self.Sig_dn_old=Fileio.Read_complex_multilines('SigMoo_dn.out') else: self.Sig_dn_old=copy.deepcopy(self.Sig_dn)
from scipy import * import sys sys.path.insert(0,"/home/uthpala/Documents/Research/CondensedMatterResearch/projects/DFT+DMFT/DFTDMFT/bin/") import Struct, copy, Fileio from scipy import interpolate if __name__=='__main__': emin=-10.0;emax=5.0;rom=300 execfile('INPUT.py') TB=Struct.TBstructure('POSCAR',p['atomnames'],p['orbs']) cor_at=p['cor_at']; cor_orb=p['cor_orb'] TB.Compute_cor_idx(cor_at,cor_orb) ommesh=linspace(emin,emax,rom) Sig_tot=zeros((TB.ncor_orb,rom),dtype=complex) for i,ats in enumerate(cor_at): (om,Sig,TrSigmaG,Epot,nf_q,mom)=Fileio.Read_complex_Data('Sig'+str(i+1)+'.out') newSig=zeros((len(Sig),rom),dtype=complex) for ii in range(len(Sig)): SigSpline = interpolate.splrep(om, Sig[ii].real, k=1, s=0) newSig[ii,:] += interpolate.splev(ommesh, SigSpline) SigSpline = interpolate.splrep(om, Sig[ii].imag, k=1, s=0) newSig[ii,:] += 1j*interpolate.splev(ommesh, SigSpline) for at in ats: for ii,orbs in enumerate(cor_orb[i]): for orb in orbs: idx=TB.idx[at][orb] Sig_tot[idx,:]=copy.deepcopy(newSig[ii,:]) Fileio.Print_complex_multilines(Sig_tot,ommesh,'SigMoo_real.out')