Skip to content

Commit

Permalink
fix vscf test
Browse files Browse the repository at this point in the history
  • Loading branch information
liwt31 committed Jun 25, 2024
1 parent 11b4177 commit 0f4ba0b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion renormalizer/tn/tests/test_tn.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_ttno(basis):
dense = ttno.todense(basis_list)

dense2 = Mpo(Model(basis_list, ham_terms)).todense()
np.testing.assert_allclose(dense, dense2)
np.testing.assert_allclose(dense, dense2, atol=1e-15)


@pytest.mark.parametrize("basis", [basis_binary, basis_multi_basis])
Expand Down
14 changes: 7 additions & 7 deletions renormalizer/vibration/tests/test_vscf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_harmonic_potential():
scf = Vscf(model)
scf.kernel()
for imode in range(nmodes):
assert np.allclose(scf.e[imode]-np.sum(w0)/2, w0[imode]*np.arange(20))
np.testing.assert_allclose(scf.e[imode]-np.sum(w0)/2, w0[imode]*np.arange(20), atol=1e-10)

def test_1mr():
w0 = np.load(os.path.join(cur_dir,"w0.npy"))
Expand Down Expand Up @@ -73,9 +73,9 @@ def test_1mr():
for imode in range(nmodes):
for icol in range(10):
try:
assert np.allclose(scf.c[imode][:,icol],
vscf_c_1mr[f"arr_{imode}"][:,icol])
except:
assert np.allclose(scf.c[imode][:,icol],
-vscf_c_1mr[f"arr_{imode}"][:,icol])
assert np.allclose(scf.e[imode], vscf_e_1mr[f"arr_{imode}"])
np.testing.assert_allclose(scf.c[imode][:,icol],
vscf_c_1mr[f"arr_{imode}"][:,icol], atol=1e-4)
except AssertionError:
np.testing.assert_allclose(scf.c[imode][:,icol],
-vscf_c_1mr[f"arr_{imode}"][:,icol], atol=1e-4)
np.testing.assert_allclose(scf.e[imode], vscf_e_1mr[f"arr_{imode}"], atol=1e-10)
2 changes: 1 addition & 1 deletion renormalizer/vibration/vscf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, model, mps=None):
logger.info("load h_mpo form model.mpos")
self.h_mpo = model.mpos["h_mpo"]
else:
self.h_mpo = Mpo(model)
self.h_mpo = Mpo(model, algo="Hopcroft-Karp")
if mps is None:
self.mps = Mps.hartree_product_state(self.model, dict())
else:
Expand Down

0 comments on commit 0f4ba0b

Please sign in to comment.