Skip to content

Commit

Permalink
adapt FEP tests to not trigger GROMACS exclusion/rlist limitation
Browse files Browse the repository at this point in the history
- close #175
- use better error handling in runMD_or_exit to check if we triggered the
  non-bonded interactions beyond cutoff issue and if so, pass with xfail
  • Loading branch information
orbeckst committed Jun 29, 2023
1 parent 8993472 commit 7246bd5
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions mdpow/tests/test_fep_script.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from . import tempdir as td

import os
import pytest
import pybol

from . import tempdir as td

import gromacs

import mdpow
Expand Down Expand Up @@ -43,14 +44,26 @@ def _run_fep(self, solvent, dirname):
gromacs.cbook.edit_mdp(mdp,
new_mdp=os.path.join(os.getcwd(), fep_mdp_name),
cutoff_scheme="group")
self.S = fep_simulation(cfg, solvent, dirname=dirname)
self.savefilename = fep_simulation(cfg, solvent, dirname=dirname, exit_on_error=False)

def test_default_run(self):
def test_default_run(self, capsys):
with gromacs.utilities.in_dir(self.tmpdir.name, create=False):
try:
self._run_fep('water', 'benzene/')
except Exception as err:
raise AssertionError('FEP simulations failed with exception:\n{0}'.format(str(err)))
# check if log file contains
# 'There are 2 perturbed non-bonded pair interactions beyond the pair-list cutoff'
# This error can happen and still counts as passing. (It is stochastic and is due
# to a poorly designed test system together with GROMACS having become better at detecting
# internal problems.)
captured = capsys.readouterr()
for line in captured:
if "perturbed non-bonded pair interactions beyond the pair-list cutoff'" in line:
pytest.xfail("Stochastic test failure (perturbed non-bonded beyond cutoff). "
"Still works as expected, see #175.")
break
else:
raise AssertionError('FEP simulations failed with exception:\n{0}'.format(str(err)))

assert os.path.exists(os.path.join(self.tmpdir.name,
'benzene', 'FEP', 'water', 'VDW', '0000', 'md.edr'))

0 comments on commit 7246bd5

Please sign in to comment.