Skip to content

Commit

Permalink
move auxbasis_response out of __init__ (pyscf#2192)
Browse files Browse the repository at this point in the history
* move auxbasis_response out of __init__

* relax unit test in test_c_agf2

* import hessian

* Update __init__.py
  • Loading branch information
wxj6000 authored May 4, 2024
1 parent 9a48cd1 commit 940e4ac
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 16 deletions.
7 changes: 4 additions & 3 deletions pyscf/df/grad/rhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,12 @@ class Gradients(rhf_grad.Gradients):
_keys = {'with_df', 'auxbasis_response'}

def __init__(self, mf):
# Whether to include the response of DF auxiliary basis when computing
# nuclear gradients of J/K matrices
self.auxbasis_response = True
rhf_grad.Gradients.__init__(self, mf)

# Whether to include the response of DF auxiliary basis when computing
# nuclear gradients of J/K matrices
auxbasis_response = True

def check_sanity(self):
assert isinstance(self.base, df.df_jk._DFHF)

Expand Down
7 changes: 4 additions & 3 deletions pyscf/df/grad/rks.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ class Gradients(rks_grad.Gradients):
_keys = {'with_df', 'auxbasis_response'}

def __init__(self, mf):
# Whether to include the response of DF auxiliary basis when computing
# nuclear gradients of J/K matrices
self.auxbasis_response = True
rks_grad.Gradients.__init__(self, mf)

# Whether to include the response of DF auxiliary basis when computing
# nuclear gradients of J/K matrices
auxbasis_response = True

get_jk = df_rhf_grad.Gradients.get_jk
get_j = df_rhf_grad.Gradients.get_j
get_k = df_rhf_grad.Gradients.get_k
Expand Down
7 changes: 4 additions & 3 deletions pyscf/df/grad/uhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ class Gradients(uhf_grad.Gradients):
_keys = {'with_df', 'auxbasis_response'}

def __init__(self, mf):
# Whether to include the response of DF auxiliary basis when computing
# nuclear gradients of J/K matrices
self.auxbasis_response = True
uhf_grad.Gradients.__init__(self, mf)

# Whether to include the response of DF auxiliary basis when computing
# nuclear gradients of J/K matrices
auxbasis_response = True

get_jk = df_rhf_grad.Gradients.get_jk
get_j = df_rhf_grad.Gradients.get_j
get_k = df_rhf_grad.Gradients.get_k
Expand Down
6 changes: 3 additions & 3 deletions pyscf/df/grad/uks.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ class Gradients(uks_grad.Gradients):
_keys = {'with_df', 'auxbasis_response'}

def __init__(self, mf):
# Whether to include the response of DF auxiliary basis when computing
# nuclear gradients of J/K matrices
self.auxbasis_response = True
uks_grad.Gradients.__init__(self, mf)

# Whether to include the response of DF auxiliary basis when computing
# nuclear gradients of J/K matrices
auxbasis_response = True
get_jk = df_rhf_grad.Gradients.get_jk
get_j = df_rhf_grad.Gradients.get_j
get_k = df_rhf_grad.Gradients.get_k
Expand Down
2 changes: 1 addition & 1 deletion pyscf/df/hessian/rhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,9 @@ def _load_dim0(dat, p0, p1):
class Hessian(rhf_hess.Hessian):
'''Non-relativistic restricted Hartree-Fock hessian'''
def __init__(self, mf):
self.auxbasis_response = 1
rhf_hess.Hessian.__init__(self, mf)

auxbasis_response = 1
partial_hess_elec = partial_hess_elec
make_h1 = make_h1

Expand Down
2 changes: 1 addition & 1 deletion pyscf/df/hessian/rks.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
class Hessian(rks_hess.Hessian):
'''Non-relativistic RKS hessian'''
def __init__(self, mf):
self.auxbasis_response = 1
rks_hess.Hessian.__init__(self, mf)

auxbasis_response = 1
partial_hess_elec = partial_hess_elec
make_h1 = make_h1

Expand Down
2 changes: 1 addition & 1 deletion pyscf/df/hessian/uhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,9 @@ def _gen_jk(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None,
class Hessian(uhf_hess.Hessian):
'''Non-relativistic UHF hessian'''
def __init__(self, mf):
self.auxbasis_response = 1
uhf_hess.Hessian.__init__(self, mf)

auxbasis_response = 1
partial_hess_elec = partial_hess_elec
make_h1 = make_h1

Expand Down
2 changes: 1 addition & 1 deletion pyscf/df/hessian/uks.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
class Hessian(uks_hess.Hessian):
'''Non-relativistic RKS hessian'''
def __init__(self, mf):
self.auxbasis_response = 1
uks_hess.Hessian.__init__(self, mf)

auxbasis_response = 1
partial_hess_elec = partial_hess_elec
make_h1 = make_h1

Expand Down

0 comments on commit 940e4ac

Please sign in to comment.