3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-07 14:43:49 +01:00

Fixes two bugs in dos_*_basis

1.) Missing minus
2.) wrong summation index i -> iom
This commit is contained in:
Manuel Zingl 2015-03-30 17:49:46 +02:00
parent 335fd6cbc6
commit 54caa08069

View File

@ -80,7 +80,7 @@ class SumkDFTTools(SumkDFT):
# Non-projected DOS # Non-projected DOS
for iom in range(n_om): for iom in range(n_om):
for bname,gf in G_latt_w: for bname,gf in G_latt_w:
DOS[bname][iom] += gf.data[iom,:,:].imag.trace()/numpy.pi DOS[bname][iom] -= gf.data[iom,:,:].imag.trace()/numpy.pi
# Projected DOS: # Projected DOS:
for icrsh in range(self.n_corr_shells): for icrsh in range(self.n_corr_shells):
@ -104,20 +104,20 @@ class SumkDFTTools(SumkDFT):
# G_loc can now also be used to look at orbitally-resolved quantities # G_loc can now also be used to look at orbitally-resolved quantities
for ish in range(self.n_inequiv_shells): for ish in range(self.n_inequiv_shells):
for bname,gf in G_loc[self.inequiv_to_corr[ish]]: # loop over spins for bname,gf in G_loc[self.inequiv_to_corr[ish]]: # loop over spins
for iom in range(n_om): DOSproj[ish][bname][iom] += gf.data[iom,:,:].imag.trace()/numpy.pi for iom in range(n_om): DOSproj[ish][bname][iom] -= gf.data[iom,:,:].imag.trace()/numpy.pi
DOSproj_orb[ish][bname][:,:,:] += gf.data[:,:,:].imag/numpy.pi DOSproj_orb[ish][bname][:,:,:] -= gf.data[:,:,:].imag/numpy.pi
# Write to files # Write to files
if save_to_file and mpi.is_master_node(): if save_to_file and mpi.is_master_node():
for sp in self.spin_block_names[self.SO]: for sp in self.spin_block_names[self.SO]:
f = open('DOS_wann_%s.dat'%sp, 'w') f = open('DOS_wann_%s.dat'%sp, 'w')
for iom in range(n_om): f.write("%s %s\n"%(om_mesh[iom],DOS[sp][i])) for iom in range(n_om): f.write("%s %s\n"%(om_mesh[iom],DOS[sp][iom]))
f.close() f.close()
# Partial # Partial
for ish in range(self.n_inequiv_shells): for ish in range(self.n_inequiv_shells):
f = open('DOS_wann_%s_proj%s.dat'%(sp,ish),'w') f = open('DOS_wann_%s_proj%s.dat'%(sp,ish),'w')
for iom in range(n_om): f.write("%s %s\n"%(om_mesh[iom],DOSproj[ish][sp][i])) for iom in range(n_om): f.write("%s %s\n"%(om_mesh[iom],DOSproj[ish][sp][iom]))
f.close() f.close()
# Orbitally-resolved # Orbitally-resolved
@ -178,7 +178,7 @@ class SumkDFTTools(SumkDFT):
# Non-projected DOS # Non-projected DOS
for iom in range(n_om): for iom in range(n_om):
for bname,gf in G_latt_w: for bname,gf in G_latt_w:
DOS[bname][iom] += gf.data[iom,:,:].imag.trace()/numpy.pi DOS[bname][iom] -= gf.data[iom,:,:].imag.trace()/numpy.pi
# Projected DOS: # Projected DOS:
for ish in range(self.n_shells): for ish in range(self.n_shells):
@ -203,20 +203,20 @@ class SumkDFTTools(SumkDFT):
# G_loc can now also be used to look at orbitally-resolved quantities # G_loc can now also be used to look at orbitally-resolved quantities
for ish in range(self.n_shells): for ish in range(self.n_shells):
for bname,gf in G_loc[ish]: for bname,gf in G_loc[ish]:
for iom in range(n_om): DOSproj[ish][bname][iom] += gf.data[iom,:,:].imag.trace()/numpy.pi for iom in range(n_om): DOSproj[ish][bname][iom] -= gf.data[iom,:,:].imag.trace()/numpy.pi
DOSproj_orb[ish][bname][:,:,:] += gf.data[:,:,:].imag/numpy.pi DOSproj_orb[ish][bname][:,:,:] -= gf.data[:,:,:].imag/numpy.pi
# Write to files # Write to files
if save_to_file and mpi.is_master_node(): if save_to_file and mpi.is_master_node():
for sp in self.spin_block_names[self.SO]: for sp in self.spin_block_names[self.SO]:
f = open('DOS_parproj_%s.dat'%sp, 'w') f = open('DOS_parproj_%s.dat'%sp, 'w')
for iom in range(n_om): f.write("%s %s\n"%(om_mesh[iom],DOS[sp][i])) for iom in range(n_om): f.write("%s %s\n"%(om_mesh[iom],DOS[sp][iom]))
f.close() f.close()
# Partial # Partial
for ish in range(self.n_shells): for ish in range(self.n_shells):
f = open('DOS_parproj_%s_proj%s.dat'%(sp,ish),'w') f = open('DOS_parproj_%s_proj%s.dat'%(sp,ish),'w')
for iom in range(n_om): f.write("%s %s\n"%(om_mesh[iom],DOSproj[ish][sp][i])) for iom in range(n_om): f.write("%s %s\n"%(om_mesh[iom],DOSproj[ish][sp][iom]))
f.close() f.close()
# Orbitally-resolved # Orbitally-resolved