From cb59466c6255f15fa240f419bfc739840dedbe5e Mon Sep 17 00:00:00 2001 From: alb-carta <49793269+alberto-carta@users.noreply.github.com> Date: Fri, 13 Oct 2023 11:12:26 +0200 Subject: [PATCH] Solved inconsistency between E_dc computed in the solver and reported in the solid_dmft observables --- python/triqs_hartree_fock/impurity.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/python/triqs_hartree_fock/impurity.py b/python/triqs_hartree_fock/impurity.py index 1011bef..e43417d 100644 --- a/python/triqs_hartree_fock/impurity.py +++ b/python/triqs_hartree_fock/impurity.py @@ -68,6 +68,7 @@ def __init__(self, gf_struct, beta, dc=False , dc_U=0.0, dc_J=0.0, dc_type='cFLL self.n_iw = n_iw self.symmetries = symmetries self.force_real = force_real + self.E_dc =0.0 #defaults for DC relevant values self.dc = dc # whether to compute dc value @@ -199,9 +200,9 @@ def compute_sigma_hartree(Sigma_HF_flat, return_everything=True): mpi.report(f"HARTREE SOLVER: Calling DC calculation:\n") if self.dc_type not in ['sFLL', 'sAMF']: - DC_val, _ = compute_DC_from_density(n_tot, U = self.dc_U, J = self.dc_J, n_orbitals=self.n_orb, method=self.dc_type) + DC_val, self.E_dc = compute_DC_from_density(n_tot, U = self.dc_U, J = self.dc_J, n_orbitals=self.n_orb, method=self.dc_type) else: - DC_val, _ = compute_DC_from_density(n_tot, U = self.dc_U, J = self.dc_J, + DC_val, self.E_dc = compute_DC_from_density(n_tot, U = self.dc_U, J = self.dc_J, n_orbitals=self.n_orb, method=self.dc_type, N_spin=n_spin) Sigma_DC[bl] = DC_val * np.eye(G_dens[bl].shape[0]) @@ -325,12 +326,10 @@ def interaction_energy(self): return E def DC_energy(self): - """ Calculate the DC energy - + """ Exposes the DC energy """ - E = 0 - for bl, gbl in self.G_iw: - E += 0.5 * np.trace(self.Sigma_DC[bl].dot(gbl.density().real)) + + E = self.E_dc return E def reinitialize_sigma(self, Sigma_guess):