From 1e7c66805f9f0af409520ae9d562ea80ac422b84 Mon Sep 17 00:00:00 2001 From: Jonathan Karp Date: Mon, 30 Aug 2021 15:58:30 -0400 Subject: [PATCH] fix bugs and tests --- python/triqs_dft_tools/sumk_dft.py | 4 ++-- test/python/sigma_from_file.py | 2 +- test/python/srvo3_transp.py | 3 +-- test/python/sumkdft_basic.py | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/python/triqs_dft_tools/sumk_dft.py b/python/triqs_dft_tools/sumk_dft.py index 3e6a9309..595c339a 100644 --- a/python/triqs_dft_tools/sumk_dft.py +++ b/python/triqs_dft_tools/sumk_dft.py @@ -516,7 +516,7 @@ class SumkDFT(object): mu = self.chemical_potential ntoi = self.spin_names_to_ind[self.SO] spn = self.spin_block_names[self.SO] - if self.Sigma_imp is None: + if not hasattr(self, "Sigma_imp"): with_Sigma = False if broadening is None: if mesh is None: @@ -652,7 +652,7 @@ class SumkDFT(object): self.calculate_min_max_band_energies() mesh = numpy.array([i for i in self.mesh.values()]) if mesh[0] > (self.min_band_energy - self.chemical_potential) or mesh[-1] < (self.max_band_energy - self.chemical_potential): - warn('The given Sigma is on a mesh which does not cover the band energy range. The Sigma MeshReFreq runs from %f to %f, while the band energy (minus the chemical potential) runs from %f to %f'%(Sigma_mesh[0], Sigma_mesh[-1], self.min_band_energy, self.max_band_energy)) + warn('The given Sigma is on a mesh which does not cover the band energy range. The Sigma MeshReFreq runs from %f to %f, while the band energy (minus the chemical potential) runs from %f to %f'%(mesh[0], mesh[-1], self.min_band_energy, self.max_band_energy)) def transform_to_sumk_blocks(self, Sigma_imp, Sigma_out=None): r""" transform Sigma from solver to sumk space diff --git a/test/python/sigma_from_file.py b/test/python/sigma_from_file.py index 7096e14d..30471924 100644 --- a/test/python/sigma_from_file.py +++ b/test/python/sigma_from_file.py @@ -40,7 +40,7 @@ for name, s in Sigma_hdf: np.savetxt('Sigma_' + name + '.dat', mesh_a_data) # Read self energy from txt files -SK = SumkDFTTools(hdf_file = 'SrVO3.ref.h5', use_dft_blocks = True) +SK = SumkDFTTools(hdf_file='SrVO3.ref.h5', mesh=Sigma_hdf.mesh, use_dft_blocks=True) # the order in the orig SrVO3 file is not assured, hence order it here a_list = sorted([a for a,al in SK.gf_struct_solver[0].items()]) diff --git a/test/python/srvo3_transp.py b/test/python/srvo3_transp.py index 278457e3..dcbf613b 100644 --- a/test/python/srvo3_transp.py +++ b/test/python/srvo3_transp.py @@ -32,10 +32,9 @@ Converter = Wien2kConverter(filename='SrVO3', repacking=True) Converter.convert_dft_input() Converter.convert_transport_input() -SK = SumkDFTTools(hdf_file='SrVO3.ref.h5', use_dft_blocks=True) - with HDFArchive('SrVO3_Sigma.h5', 'a') as ar: Sigma = ar['dmft_transp_input']['Sigma_w'] + SK = SumkDFTTools(hdf_file='SrVO3.ref.h5', mesh=Sigma.mesh, use_dft_blocks=True) SK.set_Sigma([Sigma]) SK.chemical_potential = ar['dmft_transp_input']['chemical_potential'] SK.dc_imp = ar['dmft_transp_input']['dc_imp'] diff --git a/test/python/sumkdft_basic.py b/test/python/sumkdft_basic.py index ebead200..5f6d8f39 100644 --- a/test/python/sumkdft_basic.py +++ b/test/python/sumkdft_basic.py @@ -28,8 +28,8 @@ from triqs.utility.h5diff import h5diff SK = SumkDFTTools(hdf_file = 'SrVO3.ref.h5') -dm = SK.density_matrix(method = 'using_gf', beta = 40) -dm_pc = SK.partial_charges(beta=40,with_Sigma=False,with_dc=False) +dm = SK.density_matrix(method = 'using_gf') +dm_pc = SK.partial_charges(with_Sigma=False, with_dc=False) with HDFArchive('sumkdft_basic.out.h5','w') as ar: ar['dm'] = dm