Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update interface for gradient for PySCF 2.4 #52

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading