Skip to content

Commit

Permalink
Move assertion elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewRHermes committed Nov 8, 2024
1 parent efc55d2 commit 19ab282
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions my_pyscf/lassi/excitations.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ def kernel (self, h1e, h2e, norb, nelec, ecore=0, ci0=None, orbsym=None, **kwarg
e, ci1 = self.undressed_kernel (
h1e, h2e, norb, nelec, ecore=ecore, ci0=ci1, orbsym=orbsym, **kwargs
)
e0_prime = e[0]
e0_prime = np.atleast_1d (e[0])
# Subtract the vrv energy so that agreement between different fragments can
# be checked in the impure-state case
if isinstance (e, (list,tuple,np.ndarray)):
Expand All @@ -639,10 +639,11 @@ def kernel (self, h1e, h2e, norb, nelec, ecore=0, ci0=None, orbsym=None, **kwarg
log.debug ("Denominators in VRVSolver: {}".format (self.denom_q))
if abs(e0-e0_last)<conv_tol_e0:
converged = True
assert (abs(e0-e0_prime)<conv_tol_e0), '{}-{}={} vs {}-{}={}'.format (e0,e0_prime,e0-e0_prime,e0,e0_last,e0-e0_last)
break
self.test_locmin (e0, ci1, norb, nelec, ecore, h1e, h2e)
self.converged = (converged and np.all (self.converged))
if self.converged:
assert (abs(e0-e0_prime)<conv_tol_e0), '{}-{}={} vs {}-{}={}'.format (e0,e0_prime,e0-e0_prime,e0,e0_last,e0-e0_last)
return e, ci1
def undressed_kernel (self, *args, **kwargs):
return self._undressed_class.kernel (self, *args, **kwargs)
Expand Down

0 comments on commit 19ab282

Please sign in to comment.