Skip to content

Commit

Permalink
Fixed platform issue that caused test failure on GH MacOS runner
Browse files Browse the repository at this point in the history
Added in an energy check so that we test for regressions in calculating
the total energy for contexts with and without energy terms for
constraint internals
  • Loading branch information
chryswoods committed Dec 2, 2023
1 parent 7a2cb41 commit 52d3b87
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tests/convert/test_openmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ def test_openmm_ignore_constrained(ala_mols):
def test_openmm_no_zero_sigmas(zero_lj_mols):
mols = zero_lj_mols

omm = sr.convert.to(mols, "openmm", map={"constraint": "h-bonds"})
omm = sr.convert.to(mols, "openmm",
map={"constraint": "h-bonds",
"platform": "Reference"})

from openmm import XmlSerializer

Expand All @@ -312,15 +314,27 @@ def test_openmm_skipped_constrained_bonds(zero_lj_mols):
omm1 = sr.convert.to(
mols,
"openmm",
map={"constraint": "h-bonds", "include_constrained_energies": True},
map={"constraint": "h-bonds",
"include_constrained_energies": True,
"platform": "Reference"},
)

omm2 = sr.convert.to(
mols,
"openmm",
map={"constraint": "h-bonds", "include_constrained_energies": False},
map={"constraint": "h-bonds",
"include_constrained_energies": False,
"platform": "Reference"},
)

nrg1 = omm1.get_potential_energy().to(sr.units.kcal_per_mol)
nrg2 = omm2.get_potential_energy().to(sr.units.kcal_per_mol)

# Check the energies haven't changed
# (regression check - here are the current values)
assert nrg1 == pytest.approx(-447.44, 1e-3)
assert nrg2 == pytest.approx(-3279.87, 1e-3)

from openmm import XmlSerializer

xml1 = XmlSerializer.serialize(omm1.getSystem())
Expand Down

0 comments on commit 52d3b87

Please sign in to comment.