Skip to content

Commit

Permalink
Final notes
Browse files Browse the repository at this point in the history
Deviation between e0 and e[0], where it happens, always shrinks
as the imaginary shift and conv_tol_grad both go to zero in my
tests. But should I add an explicit check anyway? Or should I try
to modify solve_e0 to account for the imaginary shift?
  • Loading branch information
MatthewRHermes committed Nov 8, 2024
1 parent b537b60 commit 25a8576
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions my_pyscf/lassi/excitations.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def set_excited_fragment_(self, ifrag, nelec, smult, weights=None):
self.fcisolvers = [self.fcisolvers[i] for i in idx]

def kernel (self, h1, h2, ecore=0, ci0=None,
conv_tol_grad=1e-4, conv_tol_self=1e-6, max_cycle_macro=50,
conv_tol_grad=1e-6, conv_tol_self=1e-6, max_cycle_macro=50,
serialfrag=False, _add_vrv_energy=False, **kwargs):
h0, h1, h2 = self.get_excited_h (ecore, h1, h2)
norb_f = np.asarray ([self.norb_ref[ifrag] for ifrag in self.excited_frags])
Expand All @@ -270,9 +270,16 @@ def kernel (self, h1, h2, ecore=0, ci0=None,
)
if converged:
for ix, solver in enumerate (vrvsolvers):
assert (solver.nroots == solver.transformer.ncsf
or abs (solver.e0 - solver.e0_prime) < solver.conv_tol_e0), '{}-{}={}'.format (
solver.e0, solver.e0_prime, solver.e0-solver.e0_prime)
try:
assert (solver.nroots == solver.transformer.ncsf
or abs (solver.e0 - solver.e0_prime) < solver.conv_tol_e0), '{}-{}={}'.format (
solver.e0, solver.e0_prime, solver.e0-solver.e0_prime)
except AssertionError as err:
print (ix, norb_f[ix], nelec_f[ix], solver.charge, solver.spin, solver.transformer.ncsf, solver.nroots)
print (solver.e_q)
for jx, s in enumerate (vrvsolvers):
print (jx, s.e0, s.e0_prime, s.e0-s.e0_prime, s.transformer.ncsf, s.nroots)
raise (err)
if _add_vrv_energy: # for a sanity check in unittests only
energy_elec += self._energy_vrv (h1, h2, ci1_active)
ci1 = [c for c in self.ci_ref]
Expand Down

0 comments on commit 25a8576

Please sign in to comment.