Skip to content

Commit

Permalink
fix: add reasonable abs. threshold to the XTB tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Steinmetzer committed Oct 7, 2022
1 parent 4e35401 commit dc99913
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions tests/test_afir/test_afir.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ def test_three_frag_afir():
assert geom.energy == pytest.approx(-22.58019, abs=1e-4)

c3d = geom.coords3d
assert np.linalg.norm(c3d[3] - c3d[9]) == pytest.approx(2.610, abs=1e-3)
assert np.linalg.norm(c3d[2] - c3d[0]) == pytest.approx(3.763, abs=1e-3)
# These values are quiet sensitive to the xtb version (6.4.1 vs 6.5.1)
assert np.linalg.norm(c3d[3] - c3d[9]) == pytest.approx(2.610, abs=1e-2)
assert np.linalg.norm(c3d[2] - c3d[0]) == pytest.approx(3.763, abs=1e-2)


@using("pyscf")
Expand Down
8 changes: 4 additions & 4 deletions tests/test_modekill/test_modekill.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ def test_modekill_xtb(this_dir):
geom.set_calculator(calc)
w, v = np.linalg.eigh(geom.mw_hessian)
nus = eigval_to_wavenumber(w)
np.testing.assert_allclose(nus[[0, 1]], (-199.668834, -94.054391), atol=1e-5)
np.testing.assert_allclose(nus[[0, 1]], (-199.668834, -94.054391), atol=1e-2)

modekill = ModeKill(geom, kill_inds=[0, ])
modekill.run()

w, v = np.linalg.eigh(geom.mw_hessian)
nus = eigval_to_wavenumber(w)

assert nus[0] == pytest.approx(-96.202534)
assert nus[0] == pytest.approx(-96.202534, abs=1e-2)


@using("pyscf")
Expand All @@ -37,12 +37,12 @@ def test_modekill_pyscf(this_dir):

w, v = np.linalg.eigh(geom.eckart_projection(geom.mw_hessian))
nus = eigval_to_wavenumber(w)
assert nus[0] == pytest.approx(-266.2978391005)
assert nus[0] == pytest.approx(-266.2978391005, abs=1e-2)

modekill = ModeKill(geom, kill_inds=[0, ])
modekill.run()
assert modekill.converged

w, v = np.linalg.eigh(geom.eckart_projection(geom.mw_hessian))
nus = eigval_to_wavenumber(w)
assert nus[0] == pytest.approx(324.4358155, abs=1e-4)
assert nus[0] == pytest.approx(324.4358155, abs=1e-2)
2 changes: 1 addition & 1 deletion tests/test_xtb/test_xtb.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_xtb_energy(geom):
def test_xtb_forces(geom):
forces = geom.forces
norm = np.linalg.norm(forces)
assert norm == pytest.approx(0.0000923641)
assert norm == pytest.approx(0.0000923641, abs=1e-6)


@using("xtb")
Expand Down

0 comments on commit dc99913

Please sign in to comment.