Skip to content

Commit

Permalink
Update interface for gradient for PySCF 2.4 (#52)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>
  • Loading branch information
sunqm and awvwgk authored Jan 3, 2024
1 parent 57b2300 commit 83d61fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/dftd3/pyscf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
OptimizedPowerDampingParam,
)

GradientsBase = getattr(rhf_grad, "GradientsBase", rhf_grad.Gradients)

_damping_param = {
"d3bj": RationalDampingParam,
"d3zero": ZeroDampingParam,
Expand Down Expand Up @@ -345,7 +347,7 @@ def nuc_grad_method(self):
return DFTD3(mf, with_dftd3)


def grad(scf_grad: rhf_grad.Gradients, **kwargs):
def grad(scf_grad: GradientsBase, **kwargs):
"""
Apply DFT-D3 corrections to SCF or MCSCF nuclear gradients methods
by returning an instance of a new class built from the original class.
Expand Down Expand Up @@ -391,7 +393,7 @@ def grad(scf_grad: rhf_grad.Gradients, **kwargs):
----------------------------------------------
"""

if not isinstance(scf_grad, rhf_grad.Gradients):
if not isinstance(scf_grad, GradientsBase):
raise TypeError("scf_grad must be an instance of Gradients")

# Ensure that the zeroth order results include DFTD3 corrections
Expand Down

0 comments on commit 83d61fb

Please sign in to comment.