From 7b80ccf3e5946c93087ff59ad306cb782bedb636 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Tue, 24 Oct 2023 14:02:39 +0100 Subject: [PATCH] Backport fix from PR #190. [ci skip] --- .../BioSimSpace/Sandpit/Exscientia/Solvent/_solvent.py | 1 + python/BioSimSpace/Solvent/_solvent.py | 1 + tests/Sandpit/Exscientia/Solvent/test_solvent.py | 10 ++++++++-- tests/Solvent/test_solvent.py | 10 ++++++++-- 4 files changed, 18 insertions(+), 4 deletions(-) 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, ) diff --git a/tests/Sandpit/Exscientia/Solvent/test_solvent.py b/tests/Sandpit/Exscientia/Solvent/test_solvent.py index f3a0b8978..7e6f7de25 100644 --- a/tests/Sandpit/Exscientia/Solvent/test_solvent.py +++ b/tests/Sandpit/Exscientia/Solvent/test_solvent.py @@ -1,6 +1,8 @@ import pytest import tempfile +from functools import partial + from sire.legacy.IO import GroTop import BioSimSpace.Sandpit.Exscientia 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: 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: