Skip to content

Commit

Permalink
Merge pull request #88 from BoothGroup/fix_h2_dissoc_test
Browse files Browse the repository at this point in the history
Fix dissociated H2 test.
  • Loading branch information
ghb24 authored Apr 15, 2023
2 parents 18aa87a + 7fe0cdf commit 0c962df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions vayesta/tests/ewf/test_h2.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ class Test_UFCI_dissoc(TestCase):

@classmethod
def setUpClass(cls):
cls.mf = testsystems.h2_sto3g_dissoc_df.uhf_stable()
cls.fci = testsystems.h2_sto3g_dissoc_df.ufci()
# TODO ensure this tests works if density fitting is used.
cls.mf = testsystems.h2_sto3g_dissoc.uhf_stable()
cls.fci = testsystems.h2_sto3g_dissoc.ufci()

@classmethod
def tearDownClass(cls):
Expand Down
9 changes: 7 additions & 2 deletions vayesta/tests/testsystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ def uhf(self):
def uhf_stable(self):
# Get uhf solution, and copy to avoid changing attributes.
uhf = copy.copy(self.uhf())
# Repeat this procedure a few times; it should converge pretty rapidly, but we don't want to get stuck in an
# Follow procedure from pyscf/examples/scf/32-break_spin_symm.py to ensure symmetry breaking in initial guess.
# Use standard calculation as initial guess.
dm0 = uhf.make_rdm1()
uhf.kernel(dm0=(dm0[0], np.zeros_like(dm0[1])))

# Repeat this procedure a few times; it should converge rapidly, but we don't want to get stuck in an
# infinite loop if it doesn't.
for i in range(5):
# Check stability of current solution.
Expand Down Expand Up @@ -334,7 +339,7 @@ def uhf(self):

h2_dz = TestMolecule("H 0 0 0; H 0 0 0.74", basis="cc-pvdz")
h2anion_dz = TestMolecule("H 0 0 0; H 0 0 0.74", basis="cc-pvdz", charge=-1, spin=1)
h2_sto3g_dissoc_df = TestMolecule("H 0 0 0; H 0 0 10.0", basis="sto3g", auxbasis=True)
h2_sto3g_dissoc = TestMolecule("H 0 0 0; H 0 0 10.0", basis="sto3g")

h6_sto6g = TestMolecule(
atom=["H %f %f %f" % xyz for xyz in pyscf.tools.ring.make(6, 1.0)],
Expand Down

0 comments on commit 0c962df

Please sign in to comment.