Skip to content

Commit

Permalink
add 'max_cycle' to hessianbase
Browse files Browse the repository at this point in the history
  • Loading branch information
wxj6000 authored and sunqm committed Nov 13, 2023
1 parent fbd9220 commit fd8ee3e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pyscf/hessian/rhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def _get_jk(mol, intor, comp, aosym, script_dms,
return vs

def solve_mo1(mf, mo_energy, mo_coeff, mo_occ, h1ao_or_chkfile,
fx=None, atmlst=None, max_memory=4000, verbose=None):
fx=None, atmlst=None, max_memory=4000, verbose=None, max_cycle=50):
'''Solve the first order equation
Kwargs:
Expand Down Expand Up @@ -343,7 +343,7 @@ def _ao2mo(mat):

h1vo = numpy.vstack(h1vo)
s1vo = numpy.vstack(s1vo)
mo1, e1 = cphf.solve(fx, mo_energy, mo_occ, h1vo, s1vo)
mo1, e1 = cphf.solve(fx, mo_energy, mo_occ, h1vo, s1vo, max_cycle=max_cycle)
mo1 = numpy.einsum('pq,xqi->xpi', mo_coeff, mo1).reshape(-1,3,nao,nocc)
e1 = e1.reshape(-1,3,nocc,nocc)

Expand Down Expand Up @@ -471,7 +471,7 @@ class HessianBase(lib.StreamObject):
'''Non-relativistic restricted Hartree-Fock hessian'''

_keys = {
'mol', 'base', 'chkfile', 'atmlst', 'de',
'mol', 'base', 'chkfile', 'atmlst', 'de', 'max_cycle'
}

def __init__(self, scf_method):
Expand All @@ -481,7 +481,7 @@ def __init__(self, scf_method):
self.base = scf_method
self.chkfile = scf_method.chkfile
self.max_memory = self.mol.max_memory

self.max_cycle = 50
self.atmlst = range(self.mol.natm)
self.de = numpy.zeros((0,0,3,3)) # (A,B,dR_A,dR_B)

Expand Down Expand Up @@ -566,7 +566,7 @@ def get_hcore(iatm, jatm):
def solve_mo1(self, mo_energy, mo_coeff, mo_occ, h1ao_or_chkfile,
fx=None, atmlst=None, max_memory=4000, verbose=None):
return solve_mo1(self.base, mo_energy, mo_coeff, mo_occ, h1ao_or_chkfile,
fx, atmlst, max_memory, verbose)
fx, atmlst, max_memory, verbose, max_cycle=self.max_cycle)

def hess_nuc(self, mol=None, atmlst=None):
if mol is None: mol = self.mol
Expand Down

0 comments on commit fd8ee3e

Please sign in to comment.