Skip to content

Commit a222ff9

Browse files
committed
[sumk] avoid deprecated using_gf fallback for block analysis
1 parent 9194390 commit a222ff9

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

python/triqs_dft_tools/sumk_dft.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,8 +871,14 @@ def analyse_block_structure(self, threshold=0.00001, include_shells=None, dm=Non
871871
"""
872872

873873
if dm is None:
874-
warn("WARNING: No density matrix given. Calculating density matrix with default parameters. This will be deprecated in future releases.")
875-
dm = self.density_matrix(method='using_gf', transform_to_solver_blocks=False)
874+
dm = [
875+
G.density()
876+
for G in self.extract_G_loc(
877+
transform_to_solver_blocks=False,
878+
with_Sigma=hasattr(self, "Sigma_imp"),
879+
with_dc=True,
880+
)
881+
]
876882

877883
assert len(dm) == self.n_corr_shells, "The number of density matrices must be equal to the number of correlated shells."
878884
dens_mat = [dm[self.inequiv_to_corr[ish]]

test/python/dc_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import numpy as np
2525
from triqs_dft_tools.sumk_dft import *
2626
from triqs_dft_tools.util import compute_DC_from_density
27-
from triqs.gf import *
27+
from triqs.gfs import *
2828
from h5 import HDFArchive
2929
from triqs.operators.util import *
3030
import triqs.utility.mpi as mpi
@@ -104,7 +104,7 @@ def test_dc(SK_compat, SK_new, method, method_dict, dens, Uval, Jval, filename):
104104

105105

106106
icrsh = 0
107-
dens = SK_compat.density_matrix(transform_to_solver_blocks=True)
107+
dens = [G.density() for G in SK_compat.extract_G_loc(transform_to_solver_blocks=True)]
108108

109109
with np.printoptions(precision=5):
110110
for key in dens[0].keys():
@@ -141,7 +141,7 @@ def test_dc(SK_compat, SK_new, method, method_dict, dens, Uval, Jval, filename):
141141
SK_new = SumkDFT(hdf_file=dft_filename+'.h5',use_dft_blocks=use_blocks)
142142

143143
icrsh = 0
144-
dens = SK_compat.density_matrix(transform_to_solver_blocks=True)
144+
dens = [G.density() for G in SK_compat.extract_G_loc(transform_to_solver_blocks=True)]
145145

146146
with np.printoptions(precision=5):
147147
for key in dens[0].keys():

test/python/sumkdft_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import numpy as np
2929
SK = SumkDFTTools(hdf_file = 'SrVO3.ref.h5')
3030

31-
dm = SK.density_matrix(method = 'using_gf', transform_to_solver_blocks=False, with_Sigma=False)
31+
dm = [G.density() for G in SK.extract_G_loc(transform_to_solver_blocks=False, with_Sigma=False)]
3232
dm_pc = SK.partial_charges(with_Sigma=False, with_dc=False)
3333
dm_pi = SK.density_matrix_using_point_integration()
3434

0 commit comments

Comments
 (0)