mirror of
https://github.com/triqs/dft_tools
synced 2024-12-22 20:34:38 +01:00
vectorize loop over frequency in dos functions and add tests
This commit is contained in:
parent
da260535d2
commit
baec3b2f31
@ -153,9 +153,7 @@ 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] = -gf.data.imag.trace(axis1=1, axis2=2) / numpy.pi
|
||||||
DOSproj[ish][bname][iom] -= gf.data[iom,
|
|
||||||
:, :].imag.trace() / numpy.pi
|
|
||||||
DOSproj_orb[ish][bname][
|
DOSproj_orb[ish][bname][
|
||||||
:, :, :] += (1.0j*(gf-gf.conjugate().transpose())/2.0/numpy.pi).data[:,:,:]
|
:, :, :] += (1.0j*(gf-gf.conjugate().transpose())/2.0/numpy.pi).data[:,:,:]
|
||||||
|
|
||||||
@ -279,8 +277,7 @@ 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 bname, gf in G_loc_all: # loop over spins
|
for bname, gf in G_loc_all: # loop over spins
|
||||||
for iom in range(n_om):
|
DOSproj[bname] = -gf.data.imag.trace(axis1=1, axis2=2) / numpy.pi
|
||||||
DOSproj[bname][iom] -= gf.data[iom,:,:].imag.trace() / numpy.pi
|
|
||||||
DOSproj_orb[bname][:,:,:] += (1.0j*(gf-gf.conjugate().transpose())/2.0/numpy.pi).data[:,:,:]
|
DOSproj_orb[bname][:,:,:] += (1.0j*(gf-gf.conjugate().transpose())/2.0/numpy.pi).data[:,:,:]
|
||||||
# Write to files
|
# Write to files
|
||||||
if save_to_file and mpi.is_master_node():
|
if save_to_file and mpi.is_master_node():
|
||||||
@ -392,10 +389,8 @@ class SumkDFTTools(SumkDFT):
|
|||||||
G_latt_w *= self.bz_weights[ik]
|
G_latt_w *= self.bz_weights[ik]
|
||||||
|
|
||||||
# Non-projected DOS
|
# Non-projected DOS
|
||||||
for iom in range(n_om):
|
for bname, gf in G_latt_w:
|
||||||
for bname, gf in G_latt_w:
|
DOS[bname] -= gf.data.imag.trace(axis1=1, axis2=2) / 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):
|
||||||
@ -427,9 +422,7 @@ 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] = -gf.data.imag.trace(axis1=1, axis2=2) / numpy.pi
|
||||||
DOSproj[ish][bname][iom] -= gf.data[iom,
|
|
||||||
:, :].imag.trace() / numpy.pi
|
|
||||||
DOSproj_orb[ish][bname][
|
DOSproj_orb[ish][bname][
|
||||||
:, :, :] += (1.0j*(gf-gf.conjugate().transpose())/2.0/numpy.pi).data[:,:,:]
|
:, :, :] += (1.0j*(gf-gf.conjugate().transpose())/2.0/numpy.pi).data[:,:,:]
|
||||||
|
|
||||||
|
BIN
test/python/SrVO3_spectral.h5
Normal file
BIN
test/python/SrVO3_spectral.h5
Normal file
Binary file not shown.
36
test/python/srvo3_spectral.py
Normal file
36
test/python/srvo3_spectral.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
from triqs_dft_tools.sumk_dft_tools import *
|
||||||
|
from triqs.utility.h5diff import h5diff
|
||||||
|
from h5 import HDFArchive
|
||||||
|
|
||||||
|
beta = 40
|
||||||
|
|
||||||
|
SK = SumkDFTTools(hdf_file='SrVO3_spectral.h5', use_dft_blocks=True)
|
||||||
|
|
||||||
|
if mpi.is_master_node():
|
||||||
|
with HDFArchive('SrVO3_Sigma.h5', 'a') as ar:
|
||||||
|
Sigma = ar['dmft_transp_input']['Sigma_w']
|
||||||
|
SK.chemical_potential = ar['dmft_transp_input']['chemical_potential']
|
||||||
|
SK.dc_imp = ar['dmft_transp_input']['dc_imp']
|
||||||
|
|
||||||
|
Sigma = mpi.bcast(Sigma)
|
||||||
|
SK.chemical_potential = mpi.bcast(SK.chemical_potential)
|
||||||
|
SK.dc_imp = mpi.bcast(SK.dc_imp)
|
||||||
|
SK.set_Sigma([Sigma])
|
||||||
|
|
||||||
|
dos_wannier = SK.dos_wannier_basis(broadening=0.01, with_Sigma=True, with_dc=True, save_to_file=False)
|
||||||
|
dos_parproj = SK.dos_parproj_basis(broadening=0.01, with_Sigma=True, with_dc=True, save_to_file=False)
|
||||||
|
spaghetti = SK.spaghettis(broadening=0.01, plot_shift=0.0, plot_range=(-1,1), ishell=None, save_to_file=False)
|
||||||
|
|
||||||
|
if mpi.is_master_node():
|
||||||
|
|
||||||
|
# with HDFArchive('srvo3_spectral.ref.h5', 'a') as ar:
|
||||||
|
# ar['dos_wannier'] = dos_wannier
|
||||||
|
# ar['dos_parproj'] = dos_parproj
|
||||||
|
# ar['spaghetti'] = spaghetti
|
||||||
|
|
||||||
|
with HDFArchive('srvo3_spectral.out.h5', 'a') as ar:
|
||||||
|
ar['dos_wannier'] = dos_wannier
|
||||||
|
ar['dos_parproj'] = dos_parproj
|
||||||
|
ar['spaghetti'] = spaghetti
|
||||||
|
|
||||||
|
h5diff('srvo3_spectral.out.h5', 'srvo3_spectral.ref.h5')
|
BIN
test/python/srvo3_spectral.ref.h5
Normal file
BIN
test/python/srvo3_spectral.ref.h5
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user