diff --git a/openfe_gromacs/tests/protocols/test_gromacs_md.py b/openfe_gromacs/tests/protocols/test_gromacs_md.py index 3cd7b07..8db15ff 100644 --- a/openfe_gromacs/tests/protocols/test_gromacs_md.py +++ b/openfe_gromacs/tests/protocols/test_gromacs_md.py @@ -132,7 +132,7 @@ def test_unit_tagging_setup_unit(solvent_protocol_dag, tmpdir): assert len(repeats) == 1 -def test_dry_run_ffcache_none(benzene_system, monkeypatch, tmp_path_factory): +def test_dry_run_ffcache_none(benzene_system, tmp_path_factory): settings = GromacsMDProtocol.default_settings() settings.output_settings_em.forcefield_cache = None settings.simulation_settings_em.nsteps = 10 @@ -164,9 +164,7 @@ def test_dry_run_ffcache_none(benzene_system, monkeypatch, tmp_path_factory): ) -def test_dry_many_molecules_solvent( - benzene_many_solv_system, monkeypatch, tmp_path_factory -): +def test_dry_many_molecules_solvent(benzene_many_solv_system, tmp_path_factory): """ A basic test flushing "will it work if you pass multiple molecules" """ @@ -199,6 +197,46 @@ def test_dry_many_molecules_solvent( ) +def test_gather(benzene_system, tmp_path_factory): + # check .gather behaves as expected: That gather correctly creates the + # results object + # This is running a full (short) simulation of benzene in water which is ok + # since this is a cheap simulation. + settings = GromacsMDProtocol.default_settings() + settings.output_settings_em.forcefield_cache = None + settings.simulation_settings_em.nsteps = 10 + settings.simulation_settings_nvt.nsteps = 10 + settings.simulation_settings_npt.nsteps = 1 + settings.simulation_settings_em.rcoulomb = 1.0 * off_unit.nanometer + settings.simulation_settings_nvt.rcoulomb = 1.0 * off_unit.nanometer + settings.simulation_settings_npt.rcoulomb = 1.0 * off_unit.nanometer + protocol = GromacsMDProtocol( + settings=settings, + ) + + # create DAG from protocol and take first (and only) work unit from within + dag = protocol.create( + stateA=benzene_system, + stateB=benzene_system, + mapping=None, + ) + + shared_temp = tmp_path_factory.mktemp("shared") + scratch_temp = tmp_path_factory.mktemp("scratch") + dagres = gufe.protocols.execute_DAG( + dag, + shared_basedir=shared_temp, + scratch_basedir=scratch_temp, + keep_shared=False, + n_retries=3, + ) + prot = GromacsMDProtocol(settings=settings) + + res = prot.gather([dagres]) + + assert isinstance(res, GromacsMDProtocolResult) + + class TestProtocolResult: @pytest.fixture() def protocolresult(self, md_json): diff --git a/openfe_gromacs/tests/protocols/test_gromacs_md_slow.py b/openfe_gromacs/tests/protocols/test_gromacs_md_slow.py new file mode 100644 index 0000000..b3d0ac9 --- /dev/null +++ b/openfe_gromacs/tests/protocols/test_gromacs_md_slow.py @@ -0,0 +1,34 @@ +# This code is part of OpenFE and is licensed under the MIT license. +# For details, see https://github.com/OpenFreeEnergy/openfe-gromacs + +import gufe +import pytest + +from openfe_gromacs.protocols.gromacs_md.md_methods import GromacsMDProtocol + + +@pytest.mark.integration +def test_protein_ligand_md(toluene_complex_system, tmp_path_factory): + settings = GromacsMDProtocol.default_settings() + settings.simulation_settings_em.nsteps = 5000 + settings.simulation_settings_nvt.nsteps = 10000 + settings.simulation_settings_npt.nsteps = 100000 + protocol = GromacsMDProtocol( + settings=settings, + ) + + dag = protocol.create( + stateA=toluene_complex_system, + stateB=toluene_complex_system, + mapping=None, + ) + + shared_temp = tmp_path_factory.mktemp("shared") + scratch_temp = tmp_path_factory.mktemp("scratch") + gufe.protocols.execute_DAG( + dag, + shared_basedir=shared_temp, + scratch_basedir=scratch_temp, + keep_shared=False, + n_retries=3, + )