Skip to content

Commit

Permalink
Merge pull request #4 from alberto-carta/unstable
Browse files Browse the repository at this point in the history
Fixed inconsistency in computing DC energy
  • Loading branch information
the-hampel authored Oct 13, 2023
2 parents 36a90e4 + cb59466 commit 2e5ae49
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions python/triqs_hartree_fock/impurity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 2e5ae49

Please sign in to comment.