From b55948c92dcc8a61f919cfda5bc43a852d7ea4c1 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Wed, 21 Oct 2026 14:41:16 +0100 Subject: [PATCH 1/2] Fix stale inputs and ignored links file in generateNetwork. [closes #557] --- src/BioSimSpace/Align/_align.py | 13 ++++-- .../Sandpit/Exscientia/Align/_align.py | 13 ++++-- tests/Align/test_align.py | 46 +++++++++++++++++++ tests/Sandpit/Exscientia/Align/test_align.py | 46 +++++++++++++++++++ 4 files changed, 110 insertions(+), 8 deletions(-) diff --git a/src/BioSimSpace/Align/_align.py b/src/BioSimSpace/Align/_align.py index 72f0f50d7..884ba3ef7 100644 --- a/src/BioSimSpace/Align/_align.py +++ b/src/BioSimSpace/Align/_align.py @@ -111,7 +111,8 @@ def generateNetwork( molecule will be used. work_dir : str - The working directory for the LOMAP process. + The working directory for the LOMAP process. Any existing 'inputs' + and 'outputs' sub-directories are replaced on each call. plot_network : bool Whether to plot the network when running from within a notebook. @@ -169,6 +170,7 @@ def generateNetwork( """ import csv as _csv import os as _os + import shutil as _shutil from .. import IO as _IO from .. import _is_notebook, _isVerbose, _Utils @@ -288,9 +290,11 @@ def generateNetwork( # Create the working directory. work_dir = _Utils.WorkDir(work_dir) - # Make the LOMAP input and output directories. - _os.makedirs(work_dir + "/inputs", exist_ok=True) - _os.makedirs(work_dir + "/outputs", exist_ok=True) + # Make fresh LOMAP input and output directories, since LOMAP loads every + # file in the input directory. + for sub_dir in ["inputs", "outputs"]: + _shutil.rmtree(f"{work_dir}/{sub_dir}", ignore_errors=True) + _os.makedirs(f"{work_dir}/{sub_dir}") # Dictionary to map ligand names in the links file to the file names # that are used in the working directory. @@ -386,6 +390,7 @@ def generateNetwork( new_line = f"{links_names[records[0]]} {links_names[records[1]]}" if len(records) > 2: new_line += " " + " ".join(records[2:]) + new_lines.append(new_line + "\n") # Store the path to the new file. lf = f"{work_dir}/inputs/lomap_links_file.txt" diff --git a/src/BioSimSpace/Sandpit/Exscientia/Align/_align.py b/src/BioSimSpace/Sandpit/Exscientia/Align/_align.py index db4675e34..430df2021 100644 --- a/src/BioSimSpace/Sandpit/Exscientia/Align/_align.py +++ b/src/BioSimSpace/Sandpit/Exscientia/Align/_align.py @@ -111,7 +111,8 @@ def generateNetwork( molecule will be used. work_dir : str - The working directory for the LOMAP process. + The working directory for the LOMAP process. Any existing 'inputs' + and 'outputs' sub-directories are replaced on each call. plot_network : bool Whether to plot the network when running from within a notebook. @@ -169,6 +170,7 @@ def generateNetwork( """ import csv as _csv import os as _os + import shutil as _shutil from .. import IO as _IO from .. import _is_notebook, _isVerbose, _Utils @@ -288,9 +290,11 @@ def generateNetwork( # Create the working directory. work_dir = _Utils.WorkDir(work_dir) - # Make the LOMAP input and output directories. - _os.makedirs(work_dir + "/inputs", exist_ok=True) - _os.makedirs(work_dir + "/outputs", exist_ok=True) + # Make fresh LOMAP input and output directories, since LOMAP loads every + # file in the input directory. + for sub_dir in ["inputs", "outputs"]: + _shutil.rmtree(f"{work_dir}/{sub_dir}", ignore_errors=True) + _os.makedirs(f"{work_dir}/{sub_dir}") # Dictionary to map ligand names in the links file to the file names # that are used in the working directory. @@ -386,6 +390,7 @@ def generateNetwork( new_line = f"{links_names[records[0]]} {links_names[records[1]]}" if len(records) > 2: new_line += " " + " ".join(records[2:]) + new_lines.append(new_line + "\n") # Store the path to the new file. lf = f"{work_dir}/inputs/lomap_links_file.txt" diff --git a/tests/Align/test_align.py b/tests/Align/test_align.py index dca7b31be..36fe93a60 100644 --- a/tests/Align/test_align.py +++ b/tests/Align/test_align.py @@ -1643,3 +1643,49 @@ def test_unmapped_attachment_warning_not_swallowed(ejm31, jmc28): with warnings.catch_warnings(): warnings.filterwarnings("error", message=".*ringMatchesRingOnly.*") BSS.Align.matchAtoms(ejm31, jmc28) + + +@pytest.fixture(scope="module") +def network_ligands(): + from rdkit import Chem + from rdkit.Chem import AllChem + + smiles = ["c1ccccc1C", "c1ccccc1CC", "c1ccccc1O", "c1ccccc1N", "C1CCCCC1C(=O)O"] + ligands = [] + for s in smiles: + mol = Chem.AddHs(Chem.MolFromSmiles(s)) + AllChem.EmbedMolecule(mol, randomSeed=42) + ligands.append(mol) + return ligands + + +def test_network_reused_work_dir(network_ligands, tmp_path): + names = [f"lig{x}" for x in range(len(network_ligands))] + + expected = BSS.Align.generateNetwork( + network_ligands, names=names, work_dir=str(tmp_path / "fresh") + ) + + # Run with a subset of ligands, then the full set, in the same directory. + work_dir = str(tmp_path / "reused") + BSS.Align.generateNetwork(network_ligands[1:], names=names[1:], work_dir=work_dir) + result = BSS.Align.generateNetwork(network_ligands, names=names, work_dir=work_dir) + + assert result == expected + + +def test_network_links_file(network_ligands, tmp_path): + names = [f"lig{x}" for x in range(len(network_ligands))] + + links_file = tmp_path / "links.txt" + links_file.write_text("lig1 lig4 -0.5 force\n") + + edges, scores = BSS.Align.generateNetwork( + network_ligands, + names=names, + links_file=str(links_file), + work_dir=str(tmp_path / "lomap"), + ) + + assert (1, 4) in edges + assert scores[edges.index((1, 4))] == pytest.approx(0.5) diff --git a/tests/Sandpit/Exscientia/Align/test_align.py b/tests/Sandpit/Exscientia/Align/test_align.py index 6d265a166..24f49c909 100644 --- a/tests/Sandpit/Exscientia/Align/test_align.py +++ b/tests/Sandpit/Exscientia/Align/test_align.py @@ -1201,3 +1201,49 @@ def test_unmapped_attachment_warning_not_swallowed(ejm31, jmc28): with warnings.catch_warnings(): warnings.filterwarnings("error", message=".*ringMatchesRingOnly.*") BSS.Align.matchAtoms(ejm31, jmc28) + + +@pytest.fixture(scope="module") +def network_ligands(): + from rdkit import Chem + from rdkit.Chem import AllChem + + smiles = ["c1ccccc1C", "c1ccccc1CC", "c1ccccc1O", "c1ccccc1N", "C1CCCCC1C(=O)O"] + ligands = [] + for s in smiles: + mol = Chem.AddHs(Chem.MolFromSmiles(s)) + AllChem.EmbedMolecule(mol, randomSeed=42) + ligands.append(mol) + return ligands + + +def test_network_reused_work_dir(network_ligands, tmp_path): + names = [f"lig{x}" for x in range(len(network_ligands))] + + expected = BSS.Align.generateNetwork( + network_ligands, names=names, work_dir=str(tmp_path / "fresh") + ) + + # Run with a subset of ligands, then the full set, in the same directory. + work_dir = str(tmp_path / "reused") + BSS.Align.generateNetwork(network_ligands[1:], names=names[1:], work_dir=work_dir) + result = BSS.Align.generateNetwork(network_ligands, names=names, work_dir=work_dir) + + assert result == expected + + +def test_network_links_file(network_ligands, tmp_path): + names = [f"lig{x}" for x in range(len(network_ligands))] + + links_file = tmp_path / "links.txt" + links_file.write_text("lig1 lig4 -0.5 force\n") + + edges, scores = BSS.Align.generateNetwork( + network_ligands, + names=names, + links_file=str(links_file), + work_dir=str(tmp_path / "lomap"), + ) + + assert (1, 4) in edges + assert scores[edges.index((1, 4))] == pytest.approx(0.5) From efca810765f9542f17953d5ae39137f5e54f6b01 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Wed, 21 Oct 2026 15:15:55 +0100 Subject: [PATCH 2/2] Disable NAGL for OpenFF parameterisation in tests. [closes #556] --- tests/Align/test_align.py | 8 ++++---- tests/IO/test_file_cache.py | 10 +++++++--- tests/IO/test_openff_gromacs.py | 8 ++++++-- tests/Parameters/test_parameters.py | 2 +- tests/Process/test_gromacs.py | 2 +- tests/Process/test_openmm.py | 2 +- tests/Sandpit/Exscientia/Align/test_align.py | 8 ++++---- tests/Sandpit/Exscientia/IO/test_file_cache.py | 10 +++++++--- tests/Sandpit/Exscientia/IO/test_openff_gromacs.py | 8 ++++++-- .../Sandpit/Exscientia/Parameters/test_parameters.py | 2 +- tests/Sandpit/Exscientia/Process/test_gromacs.py | 2 +- tests/Sandpit/Exscientia/Process/test_openmm.py | 2 +- .../Exscientia/Process/test_position_restraint.py | 4 ++-- tests/Sandpit/Exscientia/Process/test_restart.py | 4 ++-- tests/Sandpit/Exscientia/Protocol/test_config.py | 12 +++++++++--- .../Exscientia/_SireWrappers/test_molecule.py | 2 +- .../Sandpit/Exscientia/_SireWrappers/test_system.py | 10 +++++++--- tests/Sandpit/Exscientia/conftest.py | 4 ++-- tests/_SireWrappers/test_system.py | 10 +++++++--- 19 files changed, 70 insertions(+), 40 deletions(-) diff --git a/tests/Align/test_align.py b/tests/Align/test_align.py index 36fe93a60..3f9850b7c 100644 --- a/tests/Align/test_align.py +++ b/tests/Align/test_align.py @@ -939,8 +939,8 @@ def test_ring_opening_and_size_change(ligands, mapping): m0 = BSS.IO.readMolecules(f"{url}/{ligands[0]}.sdf.bz2")[0] m1 = BSS.IO.readMolecules(f"{url}/{ligands[1]}.sdf.bz2")[0] - m0 = BSS.Parameters.openff_unconstrained_2_1_1(m0).getMolecule() - m1 = BSS.Parameters.openff_unconstrained_2_1_1(m1).getMolecule() + m0 = BSS.Parameters.openff_unconstrained_2_1_1(m0, use_nagl=False).getMolecule() + m1 = BSS.Parameters.openff_unconstrained_2_1_1(m1, use_nagl=False).getMolecule() m0 = BSS.Align.rmsdAlign(m0, m1, mapping) @@ -1237,10 +1237,10 @@ def test_ring_breaking_cross_bond_cleanup(): } mol0 = BSS.Parameters.openff_unconstrained_2_2_1( - BSS.IO.readMolecules(f"{url}/5033.sdf")[0] + BSS.IO.readMolecules(f"{url}/5033.sdf")[0], use_nagl=False ).getMolecule() mol1 = BSS.Parameters.openff_unconstrained_2_2_1( - BSS.IO.readMolecules(f"{url}/5035.sdf")[0] + BSS.IO.readMolecules(f"{url}/5035.sdf")[0], use_nagl=False ).getMolecule() mol0_aligned = BSS.Align.rmsdAlign(mol0, mol1, mapping) diff --git a/tests/IO/test_file_cache.py b/tests/IO/test_file_cache.py index 0fa9035f9..219bb055f 100644 --- a/tests/IO/test_file_cache.py +++ b/tests/IO/test_file_cache.py @@ -115,11 +115,15 @@ def test_file_cache_mol_nums(): BSS.IO.clearCache() # Create an initial system. - system = BSS.Parameters.openff_unconstrained_2_0_0("CO").getMolecule().toSystem() + system = ( + BSS.Parameters.openff_unconstrained_2_0_0("CO", use_nagl=False) + .getMolecule() + .toSystem() + ) # Create two different 5 atom molecules. - mol0 = BSS.Parameters.openff_unconstrained_2_0_0("C").getMolecule() - mol1 = BSS.Parameters.openff_unconstrained_2_0_0("CF").getMolecule() + mol0 = BSS.Parameters.openff_unconstrained_2_0_0("C", use_nagl=False).getMolecule() + mol1 = BSS.Parameters.openff_unconstrained_2_0_0("CF", use_nagl=False).getMolecule() # Create two new systems by adding the different molecules to the original # system. These will have the same UID, but different molecule numbers. diff --git a/tests/IO/test_openff_gromacs.py b/tests/IO/test_openff_gromacs.py index b556c430d..97e9b5f92 100644 --- a/tests/IO/test_openff_gromacs.py +++ b/tests/IO/test_openff_gromacs.py @@ -19,10 +19,14 @@ def test_molecule_combine(): # which have different parameters. # Toluene. - m0 = BSS.Parameters.openff_unconstrained_2_0_0("Cc1ccccc1").getMolecule() + m0 = BSS.Parameters.openff_unconstrained_2_0_0( + "Cc1ccccc1", use_nagl=False + ).getMolecule() # Benzene. - m1 = BSS.Parameters.openff_unconstrained_2_0_0("c1ccccc1").getMolecule() + m1 = BSS.Parameters.openff_unconstrained_2_0_0( + "c1ccccc1", use_nagl=False + ).getMolecule() # Translate m1 such that the molecules don't interact. m1.translate(3 * [50 * BSS.Units.Length.angstrom]) diff --git a/tests/Parameters/test_parameters.py b/tests/Parameters/test_parameters.py index a744cda19..d20343bfc 100644 --- a/tests/Parameters/test_parameters.py +++ b/tests/Parameters/test_parameters.py @@ -73,7 +73,7 @@ def test_molecule_rename(): # Create the parameterised molecule. mol = BSS.Parameters.openff_unconstrained_2_0_0( - "[C@@H](C(F)(F)F)(OC(F)F)Cl" + "[C@@H](C(F)(F)F)(OC(F)F)Cl", use_nagl=False ).getMolecule() # Make sure the name is correct. diff --git a/tests/Process/test_gromacs.py b/tests/Process/test_gromacs.py index 5a4b59daa..731e1975e 100644 --- a/tests/Process/test_gromacs.py +++ b/tests/Process/test_gromacs.py @@ -232,7 +232,7 @@ def test_vacuum_com(): """ # Create a test molecule. - mol = BSS.Parameters.openff_unconstrained_2_0_0("CC").getMolecule() + mol = BSS.Parameters.openff_unconstrained_2_0_0("CC", use_nagl=False).getMolecule() # Create a short minimisation protocol. protocol = BSS.Protocol.Minimisation(steps=100) diff --git a/tests/Process/test_openmm.py b/tests/Process/test_openmm.py index f57fd1852..7b7815ad9 100644 --- a/tests/Process/test_openmm.py +++ b/tests/Process/test_openmm.py @@ -80,7 +80,7 @@ def test_rhombic_dodecahedron(): """Test that OpenMM can load and run rhombic dodecahedral triclinic spaces.""" # Create a methane molecule. - mol = BSS.Parameters.openff_unconstrained_2_0_0("C").getMolecule() + mol = BSS.Parameters.openff_unconstrained_2_0_0("C", use_nagl=False).getMolecule() # Generate box dimensions and angles for a hexagonal rhombic dodecahedron. box, angles = BSS.Box.rhombicDodecahedronHexagon(5 * BSS.Units.Length.nanometer) diff --git a/tests/Sandpit/Exscientia/Align/test_align.py b/tests/Sandpit/Exscientia/Align/test_align.py index 24f49c909..05a599944 100644 --- a/tests/Sandpit/Exscientia/Align/test_align.py +++ b/tests/Sandpit/Exscientia/Align/test_align.py @@ -81,14 +81,14 @@ def test_invalid_prematch(system0, system1, prematch): @pytest.fixture() def propane(): return BSS.Parameters.parameterise( - "CCC", "openff_unconstrained-2.0.0" + "CCC", "openff_unconstrained-2.0.0", use_nagl=False ).getMolecule() @pytest.fixture() def butane(): return BSS.Parameters.parameterise( - "CCCC", "openff_unconstrained-2.0.0" + "CCCC", "openff_unconstrained-2.0.0", use_nagl=False ).getMolecule() @@ -902,8 +902,8 @@ def test_ring_opening_and_size_change(ligands, mapping): m0 = BSS.IO.readMolecules(f"{url}/{ligands[0]}.sdf.bz2")[0] m1 = BSS.IO.readMolecules(f"{url}/{ligands[1]}.sdf.bz2")[0] - m0 = BSS.Parameters.openff_unconstrained_2_1_1(m0).getMolecule() - m1 = BSS.Parameters.openff_unconstrained_2_1_1(m1).getMolecule() + m0 = BSS.Parameters.openff_unconstrained_2_1_1(m0, use_nagl=False).getMolecule() + m1 = BSS.Parameters.openff_unconstrained_2_1_1(m1, use_nagl=False).getMolecule() m0 = BSS.Align.rmsdAlign(m0, m1, mapping) diff --git a/tests/Sandpit/Exscientia/IO/test_file_cache.py b/tests/Sandpit/Exscientia/IO/test_file_cache.py index 23fc03446..5f129beef 100644 --- a/tests/Sandpit/Exscientia/IO/test_file_cache.py +++ b/tests/Sandpit/Exscientia/IO/test_file_cache.py @@ -116,11 +116,15 @@ def test_file_cache_mol_nums(): BSS.IO.clearCache() # Create an initial system. - system = BSS.Parameters.openff_unconstrained_2_0_0("CO").getMolecule().toSystem() + system = ( + BSS.Parameters.openff_unconstrained_2_0_0("CO", use_nagl=False) + .getMolecule() + .toSystem() + ) # Create two different 5 atom molecules. - mol0 = BSS.Parameters.openff_unconstrained_2_0_0("C").getMolecule() - mol1 = BSS.Parameters.openff_unconstrained_2_0_0("CF").getMolecule() + mol0 = BSS.Parameters.openff_unconstrained_2_0_0("C", use_nagl=False).getMolecule() + mol1 = BSS.Parameters.openff_unconstrained_2_0_0("CF", use_nagl=False).getMolecule() # Create two new systems by adding the different molecules to the original # system. These will have the same UID, but different molecule numbers. diff --git a/tests/Sandpit/Exscientia/IO/test_openff_gromacs.py b/tests/Sandpit/Exscientia/IO/test_openff_gromacs.py index 14c9cb659..b8d184584 100644 --- a/tests/Sandpit/Exscientia/IO/test_openff_gromacs.py +++ b/tests/Sandpit/Exscientia/IO/test_openff_gromacs.py @@ -27,10 +27,14 @@ def test_molecule_combine(): # which have different parameters. # Toluene. - m0 = BSS.Parameters.openff_unconstrained_2_0_0("Cc1ccccc1").getMolecule() + m0 = BSS.Parameters.openff_unconstrained_2_0_0( + "Cc1ccccc1", use_nagl=False + ).getMolecule() # Benzene. - m1 = BSS.Parameters.openff_unconstrained_2_0_0("c1ccccc1").getMolecule() + m1 = BSS.Parameters.openff_unconstrained_2_0_0( + "c1ccccc1", use_nagl=False + ).getMolecule() # Translate m1 such that the molecules don't interact. m1.translate(3 * [50 * BSS.Units.Length.angstrom]) diff --git a/tests/Sandpit/Exscientia/Parameters/test_parameters.py b/tests/Sandpit/Exscientia/Parameters/test_parameters.py index a512ff8d9..b49898ed8 100644 --- a/tests/Sandpit/Exscientia/Parameters/test_parameters.py +++ b/tests/Sandpit/Exscientia/Parameters/test_parameters.py @@ -78,7 +78,7 @@ def test_molecule_rename(): # Create the parameterised molecule. mol = BSS.Parameters.openff_unconstrained_2_0_0( - "[C@@H](C(F)(F)F)(OC(F)F)Cl" + "[C@@H](C(F)(F)F)(OC(F)F)Cl", use_nagl=False ).getMolecule() # Make sure the name is correct. diff --git a/tests/Sandpit/Exscientia/Process/test_gromacs.py b/tests/Sandpit/Exscientia/Process/test_gromacs.py index d74965de6..325afefe1 100644 --- a/tests/Sandpit/Exscientia/Process/test_gromacs.py +++ b/tests/Sandpit/Exscientia/Process/test_gromacs.py @@ -483,7 +483,7 @@ def test_vacuum_com(): """ # Create a test molecule. - mol = BSS.Parameters.openff_unconstrained_2_0_0("CC").getMolecule() + mol = BSS.Parameters.openff_unconstrained_2_0_0("CC", use_nagl=False).getMolecule() # Create a short minimisation protocol. protocol = BSS.Protocol.Minimisation(steps=100) diff --git a/tests/Sandpit/Exscientia/Process/test_openmm.py b/tests/Sandpit/Exscientia/Process/test_openmm.py index 0a83ee671..c52d57817 100644 --- a/tests/Sandpit/Exscientia/Process/test_openmm.py +++ b/tests/Sandpit/Exscientia/Process/test_openmm.py @@ -139,7 +139,7 @@ def test_rhombic_dodecahedron(): """Test that OpenMM can load and run rhombic dodecahedral triclinic spaces.""" # Create a methane molecule. - mol = BSS.Parameters.openff_unconstrained_2_0_0("C").getMolecule() + mol = BSS.Parameters.openff_unconstrained_2_0_0("C", use_nagl=False).getMolecule() # Generate box dimensions and angles for a hexagonal rhombic dodecahedron. box, angles = BSS.Box.rhombicDodecahedronHexagon(5 * BSS.Units.Length.nanometer) diff --git a/tests/Sandpit/Exscientia/Process/test_position_restraint.py b/tests/Sandpit/Exscientia/Process/test_position_restraint.py index bb5583d14..553fcd6d7 100644 --- a/tests/Sandpit/Exscientia/Process/test_position_restraint.py +++ b/tests/Sandpit/Exscientia/Process/test_position_restraint.py @@ -20,8 +20,8 @@ @pytest.fixture def system(): ff = "openff_unconstrained-2.0.0" - mol0 = BSS.Parameters.parameterise("c1ccccc1C", ff).getMolecule() - mol1 = BSS.Parameters.parameterise("c1ccccc1", ff).getMolecule() + mol0 = BSS.Parameters.parameterise("c1ccccc1C", ff, use_nagl=False).getMolecule() + mol1 = BSS.Parameters.parameterise("c1ccccc1", ff, use_nagl=False).getMolecule() return BSS.Align.merge(mol0, mol1).toSystem() diff --git a/tests/Sandpit/Exscientia/Process/test_restart.py b/tests/Sandpit/Exscientia/Process/test_restart.py index ec09718b0..f09961c18 100644 --- a/tests/Sandpit/Exscientia/Process/test_restart.py +++ b/tests/Sandpit/Exscientia/Process/test_restart.py @@ -16,8 +16,8 @@ @pytest.fixture def system(): ff = "openff_unconstrained-2.0.0" - mol0 = BSS.Parameters.parameterise("c1ccccc1C", ff).getMolecule() - mol1 = BSS.Parameters.parameterise("c1ccccc1", ff).getMolecule() + mol0 = BSS.Parameters.parameterise("c1ccccc1C", ff, use_nagl=False).getMolecule() + mol1 = BSS.Parameters.parameterise("c1ccccc1", ff, use_nagl=False).getMolecule() return BSS.Align.merge(mol0, mol1).toSystem() diff --git a/tests/Sandpit/Exscientia/Protocol/test_config.py b/tests/Sandpit/Exscientia/Protocol/test_config.py index 9ecd3ca86..cc39bd1df 100644 --- a/tests/Sandpit/Exscientia/Protocol/test_config.py +++ b/tests/Sandpit/Exscientia/Protocol/test_config.py @@ -214,7 +214,9 @@ def test_staged_fep_df(self, system): @pytest.fixture(scope="module") def system_and_mdr_restraint(): # Benzene. - m = BSS.Parameters.openff_unconstrained_2_0_0("c1ccccc1").getMolecule() + m = BSS.Parameters.openff_unconstrained_2_0_0( + "c1ccccc1", use_nagl=False + ).getMolecule() m._sire_object = m._sire_object.edit().rename("LIG").molecule().commit() # Assign atoms for restraint @@ -271,7 +273,9 @@ class TestGromacsABFE: @pytest.fixture(scope="class") def system(): # Benzene. - m0 = BSS.Parameters.openff_unconstrained_2_0_0("c1ccccc1").getMolecule() + m0 = BSS.Parameters.openff_unconstrained_2_0_0( + "c1ccccc1", use_nagl=False + ).getMolecule() m0._sire_object = m0._sire_object.edit().rename("LIG").molecule().commit() protocol = FreeEnergyMinimisation( lam=0.0, @@ -425,7 +429,9 @@ class TestSomdABFE: @pytest.fixture(scope="class") def system_and_boresch_restraint(): # Benzene. - m = BSS.Parameters.openff_unconstrained_2_0_0("c1ccccc1").getMolecule() + m = BSS.Parameters.openff_unconstrained_2_0_0( + "c1ccccc1", use_nagl=False + ).getMolecule() # Assign atoms for restraint atom_1 = m.getAtoms()[0] diff --git a/tests/Sandpit/Exscientia/_SireWrappers/test_molecule.py b/tests/Sandpit/Exscientia/_SireWrappers/test_molecule.py index eef91f38e..43b91814a 100644 --- a/tests/Sandpit/Exscientia/_SireWrappers/test_molecule.py +++ b/tests/Sandpit/Exscientia/_SireWrappers/test_molecule.py @@ -134,7 +134,7 @@ def test_extract(system): ) def test_lipid(lipid): ff = "openff_unconstrained-2.0.0" - mol = BSS.Parameters.parameterise("c1ccccc1C", ff).getMolecule() + mol = BSS.Parameters.parameterise("c1ccccc1C", ff, use_nagl=False).getMolecule() if lipid: sire_obj = mol._sire_object c = sire_obj.cursor() diff --git a/tests/Sandpit/Exscientia/_SireWrappers/test_system.py b/tests/Sandpit/Exscientia/_SireWrappers/test_system.py index c68a9cfe3..29bd54528 100644 --- a/tests/Sandpit/Exscientia/_SireWrappers/test_system.py +++ b/tests/Sandpit/Exscientia/_SireWrappers/test_system.py @@ -380,11 +380,15 @@ def test_isSame_mol_nums(): # but contain different MolNums. # Create an initial system. - system = BSS.Parameters.openff_unconstrained_2_0_0("CO").getMolecule().toSystem() + system = ( + BSS.Parameters.openff_unconstrained_2_0_0("CO", use_nagl=False) + .getMolecule() + .toSystem() + ) # Create two different 5 atom molecules. - mol0 = BSS.Parameters.openff_unconstrained_2_0_0("C").getMolecule() - mol1 = BSS.Parameters.openff_unconstrained_2_0_0("CF").getMolecule() + mol0 = BSS.Parameters.openff_unconstrained_2_0_0("C", use_nagl=False).getMolecule() + mol1 = BSS.Parameters.openff_unconstrained_2_0_0("CF", use_nagl=False).getMolecule() # Create two new systems by adding the different molecules to the original # system. These will have the same UID, but different molecule numbers. diff --git a/tests/Sandpit/Exscientia/conftest.py b/tests/Sandpit/Exscientia/conftest.py index 82268b3b3..e98e7ce94 100644 --- a/tests/Sandpit/Exscientia/conftest.py +++ b/tests/Sandpit/Exscientia/conftest.py @@ -144,14 +144,14 @@ def get_energy( @pytest.fixture def benzene(): return BSS.Parameters.parameterise( - "c1ccccc1", "openff_unconstrained-2.0.0" + "c1ccccc1", "openff_unconstrained-2.0.0", use_nagl=False ).getMolecule() @pytest.fixture def pyrrole(): return BSS.Parameters.parameterise( - "C1=CNC=C1", "openff_unconstrained-2.0.0" + "C1=CNC=C1", "openff_unconstrained-2.0.0", use_nagl=False ).getMolecule() diff --git a/tests/_SireWrappers/test_system.py b/tests/_SireWrappers/test_system.py index ba7d225ee..18a89ed0d 100644 --- a/tests/_SireWrappers/test_system.py +++ b/tests/_SireWrappers/test_system.py @@ -371,11 +371,15 @@ def test_isSame_mol_nums(): # but contain different MolNums. # Create an initial system. - system = BSS.Parameters.openff_unconstrained_2_0_0("CO").getMolecule().toSystem() + system = ( + BSS.Parameters.openff_unconstrained_2_0_0("CO", use_nagl=False) + .getMolecule() + .toSystem() + ) # Create two different 5 atom molecules. - mol0 = BSS.Parameters.openff_unconstrained_2_0_0("C").getMolecule() - mol1 = BSS.Parameters.openff_unconstrained_2_0_0("CF").getMolecule() + mol0 = BSS.Parameters.openff_unconstrained_2_0_0("C", use_nagl=False).getMolecule() + mol1 = BSS.Parameters.openff_unconstrained_2_0_0("CF", use_nagl=False).getMolecule() # Create two new systems by adding the different molecules to the original # system. These will have the same UID, but different molecule numbers.