From 4effd2bb5344c3b64d0bf849333e2609471fb478 Mon Sep 17 00:00:00 2001 From: Qiming Sun Date: Mon, 17 Jun 2024 23:35:07 -0700 Subject: [PATCH] Abandon ROHF gradients and ROHF hessian (#2259) --- pyscf/df/df_jk.py | 2 ++ pyscf/grad/rhf.py | 1 + pyscf/grad/rks.py | 1 + pyscf/hessian/rhf.py | 1 + pyscf/hessian/rks.py | 1 + 5 files changed, 6 insertions(+) diff --git a/pyscf/df/df_jk.py b/pyscf/df/df_jk.py index ffdc94e260..2ac82c243c 100644 --- a/pyscf/df/df_jk.py +++ b/pyscf/df/df_jk.py @@ -200,6 +200,8 @@ def Hessian(self): return uks.Hessian(self) else: return uhf.Hessian(self) + elif isinstance(self, scf.rohf.ROHF): + raise NotImplementedError elif isinstance(self, scf.rhf.RHF): if isinstance(self, scf.hf.KohnShamDFT): return rks.Hessian(self) diff --git a/pyscf/grad/rhf.py b/pyscf/grad/rhf.py index 749cbfe2be..b2f3706794 100644 --- a/pyscf/grad/rhf.py +++ b/pyscf/grad/rhf.py @@ -474,3 +474,4 @@ def make_rdm1e(self, mo_energy=None, mo_coeff=None, mo_occ=None): from pyscf import scf # Inject to RHF class scf.hf.RHF.Gradients = lib.class_as_method(Gradients) +scf.rohf.ROHF.Gradients = lib.invalid_method('Gradients') diff --git a/pyscf/grad/rks.py b/pyscf/grad/rks.py index 086d2bc862..01c28a8360 100644 --- a/pyscf/grad/rks.py +++ b/pyscf/grad/rks.py @@ -622,3 +622,4 @@ def extra_force(self, atom_id, envs): from pyscf import dft dft.rks.RKS.Gradients = dft.rks_symm.RKS.Gradients = lib.class_as_method(Gradients) +dft.roks.ROKS.Gradients = lib.invalid_method('Gradients') diff --git a/pyscf/hessian/rhf.py b/pyscf/hessian/rhf.py index fcc15a81e3..60bdce1e66 100644 --- a/pyscf/hessian/rhf.py +++ b/pyscf/hessian/rhf.py @@ -618,6 +618,7 @@ class Hessian(HessianBase): # Inject to RHF class from pyscf import scf scf.hf.RHF.Hessian = lib.class_as_method(Hessian) +scf.rohf.ROHF.Hessian = lib.invalid_method('Hessian') if __name__ == '__main__': diff --git a/pyscf/hessian/rks.py b/pyscf/hessian/rks.py index 41d12d87aa..a76afaccb9 100644 --- a/pyscf/hessian/rks.py +++ b/pyscf/hessian/rks.py @@ -593,3 +593,4 @@ def __init__(self, mf): from pyscf import dft dft.rks.RKS.Hessian = dft.rks_symm.RKS.Hessian = lib.class_as_method(Hessian) +dft.roks.ROKS.Hessian = dft.rks_symm.ROKS.Hessian = lib.invalid_method('Hessian')