Skip to content

Commit

Permalink
Merge changes from branch master
Browse files Browse the repository at this point in the history
  • Loading branch information
obackhouse committed Aug 13, 2024
1 parent ddf5cc2 commit 448685a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 59 deletions.
1 change: 1 addition & 0 deletions ebcc/cc/uebcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def ee_eom(self, **kwargs: Any) -> EE_UEOM:
@staticmethod
def _convert_mf(mf: SCF) -> UHF:
"""Convert the mean-field object to the appropriate type."""
return mf.to_uhf()
hf = mf.to_uhf()
if hasattr(mf, "xc"):
hf.e_tot = hf.energy_tot()
Expand Down
59 changes: 0 additions & 59 deletions tests/test_RCCSD.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,65 +493,6 @@ def test_t1_amplitudes(self):
np.testing.assert_almost_equal(a, b, 6)


@pytest.mark.reference
class RCCSD_PySCF_DFT_Tests(unittest.TestCase):
"""Test RCCSD against the PySCF values with a DFT reference.
"""

@classmethod
def setUpClass(cls):
mol = gto.Mole()
mol.atom = "O 0.0 0.0 0.11779; H 0.0 0.755453 -0.471161; H 0.0 -0.755453 -0.471161"
#mol.atom = "Li 0 0 0; H 0 0 1.4"
mol.basis = "cc-pvdz"
mol.verbose = 0
mol.build()

mf = dft.RKS(mol, xc="pbe,pbe")
mf = mf.density_fit()
mf.conv_tol = 1e-12
mf.kernel()

ccsd_ref = cc.CCSD(mf.to_rhf())
ccsd_ref.conv_tol = 1e-10
ccsd_ref.conv_tol_normt = 1e-14
ccsd_ref.max_cycle = 200
ccsd_ref.kernel()
ccsd_ref.solve_lambda()

ccsd = REBCC(
mf,
ansatz="CCSD",
log=NullLogger(),
)
ccsd.options.e_tol = 1e-10
eris = ccsd.get_eris()
ccsd.kernel(eris=eris)
ccsd.solve_lambda(eris=eris)

cls.mf, cls.ccsd_ref, cls.ccsd, cls.eris = mf, ccsd_ref, ccsd, eris

@classmethod
def teardownclass(cls):
del cls.mf, cls.ccsd_ref, cls.ccsd, cls.eris

def test_converged(self):
self.assertTrue(self.ccsd.converged)
self.assertTrue(self.ccsd.converged_lambda)
self.assertTrue(self.ccsd_ref.converged)
self.assertTrue(self.ccsd_ref.converged_lambda)

def test_energy(self):
a = self.ccsd_ref.e_tot
b = self.ccsd.e_tot
self.assertAlmostEqual(a, b, 7)

def test_t1_amplitudes(self):
a = self.ccsd_ref.t1
b = self.ccsd.t1
np.testing.assert_almost_equal(a, b, 6)


if __name__ == "__main__":
print("Tests for RCCSD")
unittest.main()

0 comments on commit 448685a

Please sign in to comment.