From 3d3ed62ff206f72d4e5efc46564c950032fb2f85 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Wed, 18 Oct 2023 13:58:03 +0100 Subject: [PATCH 1/3] Pass match_water through to specialised water model functions. [closes #185] --- python/BioSimSpace/Sandpit/Exscientia/Solvent/_solvent.py | 1 + python/BioSimSpace/Solvent/_solvent.py | 1 + 2 files changed, 2 insertions(+) diff --git a/python/BioSimSpace/Sandpit/Exscientia/Solvent/_solvent.py b/python/BioSimSpace/Sandpit/Exscientia/Solvent/_solvent.py index 7e3d4e944..0bcb4a682 100644 --- a/python/BioSimSpace/Sandpit/Exscientia/Solvent/_solvent.py +++ b/python/BioSimSpace/Sandpit/Exscientia/Solvent/_solvent.py @@ -142,6 +142,7 @@ def solvate( ion_conc, is_neutral, is_aligned, + match_water, work_dir, property_map, ) diff --git a/python/BioSimSpace/Solvent/_solvent.py b/python/BioSimSpace/Solvent/_solvent.py index 7e3d4e944..0bcb4a682 100644 --- a/python/BioSimSpace/Solvent/_solvent.py +++ b/python/BioSimSpace/Solvent/_solvent.py @@ -142,6 +142,7 @@ def solvate( ion_conc, is_neutral, is_aligned, + match_water, work_dir, property_map, ) From d55d93f05152c7621a955b38ca8d149714d903fb Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Wed, 18 Oct 2023 16:30:50 +0100 Subject: [PATCH 2/3] Test generic solvate function as well as specialised tip3p function. --- tests/Sandpit/Exscientia/Solvent/test_solvent.py | 12 +++++++++--- tests/Solvent/test_solvent.py | 10 ++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/Sandpit/Exscientia/Solvent/test_solvent.py b/tests/Sandpit/Exscientia/Solvent/test_solvent.py index f3a0b8978..e4fb56b26 100644 --- a/tests/Sandpit/Exscientia/Solvent/test_solvent.py +++ b/tests/Sandpit/Exscientia/Solvent/test_solvent.py @@ -1,11 +1,13 @@ import pytest import tempfile +from functools import partial + from sire.legacy.IO import GroTop import BioSimSpace.Sandpit.Exscientia as BSS -from tests.Sandpit.Exscientia.conftest import has_gromacs +from tests.conftest import has_gromacs @pytest.fixture(scope="module") @@ -18,8 +20,12 @@ def system(): @pytest.mark.parametrize("match_water", [True, False]) +@pytest.mark.parametrize( + "function", + [partial(BSS.Solvent.solvate, "tip3p"), BSS.Solvent.tip3p], +) @pytest.mark.skipif(not has_gromacs, reason="Requires GROMACS to be installed") -def test_crystal_water(system, match_water): +def test_crystal_water(system, match_water, function): """ Test that user defined crystal waters can be preserved during solvation and on write to GroTop format. @@ -35,7 +41,7 @@ def test_crystal_water(system, match_water): box, angles = BSS.Box.cubic(5.5 * BSS.Units.Length.nanometer) # Create the solvated system. - solvated = BSS.Solvent.tip3p(system, box, angles, match_water=match_water) + solvated = function(system, box, angles, match_water=match_water) # Search for the crystal waters in the solvated system. try: diff --git a/tests/Solvent/test_solvent.py b/tests/Solvent/test_solvent.py index 7edf20cbf..185bb6373 100644 --- a/tests/Solvent/test_solvent.py +++ b/tests/Solvent/test_solvent.py @@ -1,6 +1,8 @@ import pytest import tempfile +from functools import partial + from sire.legacy.IO import GroTop import BioSimSpace as BSS @@ -18,8 +20,12 @@ def system(): @pytest.mark.parametrize("match_water", [True, False]) +@pytest.mark.parametrize( + "function", + [partial(BSS.Solvent.solvate, "tip3p"), BSS.Solvent.tip3p], +) @pytest.mark.skipif(not has_gromacs, reason="Requires GROMACS to be installed") -def test_crystal_water(system, match_water): +def test_crystal_water(system, match_water, function): """ Test that user defined crystal waters can be preserved during solvation and on write to GroTop format. @@ -35,7 +41,7 @@ def test_crystal_water(system, match_water): box, angles = BSS.Box.cubic(5.5 * BSS.Units.Length.nanometer) # Create the solvated system. - solvated = BSS.Solvent.tip3p(system, box, angles, match_water=match_water) + solvated = function(system, box, angles, match_water=match_water) # Search for the crystal waters in the solvated system. try: From 222f2c835e9fc6334e468b9b570b5ec50394ce38 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Mon, 23 Oct 2023 19:35:47 +0100 Subject: [PATCH 3/3] Use sandpit conftest. --- tests/Sandpit/Exscientia/Solvent/test_solvent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Sandpit/Exscientia/Solvent/test_solvent.py b/tests/Sandpit/Exscientia/Solvent/test_solvent.py index e4fb56b26..7e6f7de25 100644 --- a/tests/Sandpit/Exscientia/Solvent/test_solvent.py +++ b/tests/Sandpit/Exscientia/Solvent/test_solvent.py @@ -7,7 +7,7 @@ import BioSimSpace.Sandpit.Exscientia as BSS -from tests.conftest import has_gromacs +from tests.Sandpit.Exscientia.conftest import has_gromacs @pytest.fixture(scope="module")