Skip to content

Commit

Permalink
Fix iterative damping for UCCSD and spin!=0
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrompiec authored Nov 15, 2024
1 parent db5166c commit 0d47c7f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pyscf/cc/ccsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,15 @@ def kernel(mycc, eris=None, t1=None, t2=None, max_cycle=50, tol=1e-8,
tmpvec = None
if mycc.iterative_damping < 1.0:
alpha = numpy.asarray(mycc.iterative_damping)
t1new = (1-alpha) * numpy.asarray(t1) + alpha * numpy.asarray(t1new)
t2new *= alpha
t2new += (1-alpha) * numpy.asarray(t2)
if isinstance(t1, tuple): # e.g. UCCSD
t1new = tuple((1-alpha) * numpy.asarray(t1_part) + alpha * numpy.asarray(t1new_part)
for t1_part, t1new_part in zip(t1, t1new))
t2new = tuple((1-alpha) * numpy.asarray(t2_part) + alpha * numpy.asarray(t2new_part)
for t2_part, t2new_part in zip(t2, t2new))
else:
t1new = (1-alpha) * numpy.asarray(t1) + alpha * numpy.asarray(t1new)
t2new *= alpha
t2new += (1-alpha) * numpy.asarray(t2)
t1, t2 = t1new, t2new
t1new = t2new = None
t1, t2 = mycc.run_diis(t1, t2, istep, normt, eccsd-eold, adiis)
Expand Down

0 comments on commit 0d47c7f

Please sign in to comment.