Skip to content

Commit

Permalink
Fixed minor bug in Jacobi solver with DIIS
Browse files Browse the repository at this point in the history
  • Loading branch information
imagoulas committed May 10, 2024
1 parent c569e90 commit db0b55b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/qforte/maths/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def jacobi_solver(self):

self._tamps = list(np.add(self._tamps, r_k))

t_diis.append(copy.deepcopy(self._tamps))
e_diis.append(np.subtract(copy.deepcopy(self._tamps), t_old))

if(k >= 1 and self._diis_max_dim >= 2):
self._tamps = diis(self._diis_max_dim, t_diis, e_diis)

Ek = self.energy_feval(self._tamps)
dE = Ek - Ek0
Ek0 = Ek
Expand All @@ -79,12 +85,6 @@ def jacobi_solver(self):
self._Egs = Ek
break

t_diis.append(copy.deepcopy(self._tamps))
e_diis.append(np.subtract(copy.deepcopy(self._tamps), t_old))

if(k >= 1 and self._diis_max_dim >= 2):
self._tamps = diis(self._diis_max_dim, t_diis, e_diis)

self._Egs = Ek
if k == self._opt_maxiter:
print("\nMaximum number of Jacobi iterations reached!")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_open_shells.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_H5_uccsd_pqe(self):
alg = UCCNPQE(mol, compact_excitations = True)
alg.run(pool_type='SD')

assert alg._Egs == approx(-2.4998604383361855, abs=1.0e-12)
assert alg._Egs == approx(-2.4998604454039635, abs=1.0e-12)

def test_H5_fci(self):

Expand Down

0 comments on commit db0b55b

Please sign in to comment.