From 4d10c74e4dd8ebb9f1a4c8b5a87bbdb95102a87e Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Mon, 17 Jun 2024 09:22:20 +0100 Subject: [PATCH 1/3] Backport fix from PR #295. [ci skip] --- python/BioSimSpace/Align/_merge.py | 28 +++++ python/BioSimSpace/Process/_somd.py | 90 +++++++++----- .../Sandpit/Exscientia/Align/_merge.py | 28 +++++ .../Sandpit/Exscientia/Process/_somd.py | 113 +++++++++++++----- 4 files changed, 203 insertions(+), 56 deletions(-) diff --git a/python/BioSimSpace/Align/_merge.py b/python/BioSimSpace/Align/_merge.py index f4693e83e..7c0b376ab 100644 --- a/python/BioSimSpace/Align/_merge.py +++ b/python/BioSimSpace/Align/_merge.py @@ -693,6 +693,34 @@ def merge( .molecule() ) + # Tolerance for zero sigma values. + null_lj_sigma = 1e-9 + + # Atoms with zero LJ sigma values need to have their sigma values set to the + # value from the other end state. + for atom in edit_mol.atoms(): + # Get the end state LJ sigma values. + lj0 = atom.property("LJ0") + lj1 = atom.property("LJ1") + + # Lambda = 0 state has a zero sigma value. + if abs(lj0.sigma().value()) <= null_lj_sigma: + # Use the sigma value from the lambda = 1 state. + edit_mol = ( + edit_mol.atom(atom.index()) + .set_property("LJ0", _SireMM.LJParameter(lj1.sigma(), lj0.epsilon())) + .molecule() + ) + + # Lambda = 1 state has a zero sigma value. + if abs(lj1.sigma().value()) <= null_lj_sigma: + # Use the sigma value from the lambda = 0 state. + edit_mol = ( + edit_mol.atom(atom.index()) + .set_property("LJ1", _SireMM.LJParameter(lj0.sigma(), lj1.epsilon())) + .molecule() + ) + # We now need to merge "bond", "angle", "dihedral", and "improper" parameters. # To do so, we extract the properties from molecule1, then add the additional # properties from molecule0, making sure to update the atom indices, and bond diff --git a/python/BioSimSpace/Process/_somd.py b/python/BioSimSpace/Process/_somd.py index a2a0522b2..982d11d86 100644 --- a/python/BioSimSpace/Process/_somd.py +++ b/python/BioSimSpace/Process/_somd.py @@ -1129,6 +1129,10 @@ def _to_pert_file( # 1) Atoms. + # Store a null LJParameter object for dummy atoms. SOMD requires that + # both sigma and epsilon are set to zero for dummy atoms. + dummy_lj = _SireMM.LJParameter() + def atom_sorting_criteria(atom): LJ0 = atom.property("LJ0") LJ1 = atom.property("LJ1") @@ -1156,6 +1160,13 @@ def atom_sorting_criteria(atom): LJ0 = atom.property("LJ0") LJ1 = atom.property("LJ1") + # Dummy atom at lambda = 0. + if _is_dummy(mol, atom.index(), is_lambda1=False): + LJ0 = dummy_lj + # Dummy atom at lambda = 1. + if _is_dummy(mol, atom.index(), is_lambda1=True): + LJ1 = dummy_lj + # Atom data. file.write(" name %s\n" % atom.name().value()) file.write( @@ -1199,6 +1210,13 @@ def atom_sorting_criteria(atom): LJ0 = atom.property("LJ0") LJ1 = atom.property("LJ1") + # Dummy atom at lambda = 0. + if _is_dummy(mol, idx, is_lambda1=False): + LJ0 = dummy_lj + # Dummy atom at lambda = 1. + if _is_dummy(mol, idx, is_lambda1=True): + LJ1 = dummy_lj + # Atom data. file.write(" name %s\n" % atom.name().value()) file.write( @@ -1252,11 +1270,11 @@ def atom_sorting_criteria(atom): # Set LJ/charge based on requested perturbed term. if perturbation_type == "discharge_soft": - if atom.property("element0") == _SireMol.Element( - "X" - ) or atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=False) or _is_dummy( + mol, idx, is_lambda1=True + ): # If perturbing TO dummy: - if atom.property("element1") == _SireMol.Element("X"): + if is_dummy(mol, idx, is_lambda1=True): atom_type1 = atom_type0 # In this step, only remove charges from soft-core perturbations. @@ -1270,7 +1288,7 @@ def atom_sorting_criteria(atom): # If perturbing FROM dummy: else: - # All terms have already been perturbed in "5_grow_soft". + # All terms have already been perturbed in "grow_soft". atom_type1 = atom_type0 LJ0_value = LJ1_value = ( LJ0.sigma().value(), @@ -1290,11 +1308,11 @@ def atom_sorting_criteria(atom): charge0_value = charge1_value = atom.property("charge0").value() elif perturbation_type == "vanish_soft": - if atom.property("element0") == _SireMol.Element( - "X" - ) or atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=False) or _is_dummy( + mol, idx, is_lambda1=True + ): # If perturbing TO dummy: - if atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=True): # allow atom types to change. atom_type0 = atom_type0 atom_type1 = atom_type1 @@ -1308,7 +1326,7 @@ def atom_sorting_criteria(atom): # If perturbing FROM dummy: else: - # All terms have already been perturbed in "5_grow_soft". + # All terms have already been perturbed in "grow_soft". atom_type1 = atom_type0 LJ0_value = LJ1_value = ( LJ0.sigma().value(), @@ -1328,11 +1346,11 @@ def atom_sorting_criteria(atom): charge0_value = charge1_value = atom.property("charge0").value() elif perturbation_type == "flip": - if atom.property("element0") == _SireMol.Element( - "X" - ) or atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=False) or _is_dummy( + mol, idx, is_lambda1=True + ): # If perturbing TO dummy: - if atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=True): # atom types have already been changed. atom_type0 = atom_type1 @@ -1342,7 +1360,7 @@ def atom_sorting_criteria(atom): # If perturbing FROM dummy: else: - # All terms have already been perturbed in "5_grow_soft". + # All terms have already been perturbed in "grow_soft". atom_type1 = atom_type0 LJ0_value = LJ1_value = ( LJ0.sigma().value(), @@ -1362,11 +1380,11 @@ def atom_sorting_criteria(atom): charge1_value = atom.property("charge1").value() elif perturbation_type == "grow_soft": - if atom.property("element0") == _SireMol.Element( - "X" - ) or atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=False) or _is_dummy( + mol, idx, is_lambda1=True + ): # If perturbing TO dummy: - if atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=True): # atom types have already been changed. atom_type0 = atom_type1 @@ -1398,11 +1416,11 @@ def atom_sorting_criteria(atom): charge0_value = charge1_value = atom.property("charge1").value() elif perturbation_type == "charge_soft": - if atom.property("element0") == _SireMol.Element( - "X" - ) or atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=False) or _is_dummy( + mol, idx, is_lambda1=True + ): # If perturbing TO dummy: - if atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=True): # atom types have already been changed. atom_type0 = atom_type1 @@ -2971,11 +2989,13 @@ def _has_dummy(mol, idxs, is_lambda1=False): element_dummy = _SireMol.Element(0) ambertype_dummy = "du" + # Check that the molecule has the ambertype property. + has_ambertype = mol.hasProperty(ambertype_prop) + # Check whether an of the atoms is a dummy. for idx in idxs: - if ( - mol.atom(idx).property(element_prop) == element_dummy - or mol.atom(idx).property(ambertype_prop) == ambertype_dummy + if mol.atom(idx).property(element_prop) == element_dummy or ( + has_ambertype and mol.atom(idx).property(ambertype_prop) == ambertype_dummy ): return True @@ -2985,6 +3005,7 @@ def _has_dummy(mol, idxs, is_lambda1=False): def _is_dummy(mol, idxs, is_lambda1=False): """ Internal function to return whether each atom is a dummy. + If a single index is pased, then a single boolean is returned. Parameters ---------- @@ -3027,17 +3048,30 @@ def _is_dummy(mol, idxs, is_lambda1=False): element_dummy = _SireMol.Element(0) ambertype_dummy = "du" + # Check that the molecule has the ambertype property. + has_ambertype = mol.hasProperty(ambertype_prop) + # Initialise a list to store the state of each atom. is_dummy = [] + # Convert single index to list. + if not isinstance(idxs, list): + idxs = [idxs] + # Check whether each of the atoms is a dummy. for idx in idxs: is_dummy.append( mol.atom(idx).property(element_prop) == element_dummy - or mol.atom(idx).property(ambertype_prop) == ambertype_dummy + or ( + has_ambertype + and mol.atom(idx).property(ambertype_prop) == ambertype_dummy + ) ) - return is_dummy + if len(is_dummy) == 1: + return is_dummy[0] + else: + return is_dummy def _random_suffix(basename, size=4, chars=_string.ascii_uppercase + _string.digits): diff --git a/python/BioSimSpace/Sandpit/Exscientia/Align/_merge.py b/python/BioSimSpace/Sandpit/Exscientia/Align/_merge.py index 29dbf731f..db3d7fdc4 100644 --- a/python/BioSimSpace/Sandpit/Exscientia/Align/_merge.py +++ b/python/BioSimSpace/Sandpit/Exscientia/Align/_merge.py @@ -739,6 +739,34 @@ def merge( edit_mol.atom(idx).setProperty(name, atom.property(prop)).molecule() ) + # Tolerance for zero sigma values. + null_lj_sigma = 1e-9 + + # Atoms with zero LJ sigma values need to have their sigma values set to the + # value from the other end state. + for atom in edit_mol.atoms(): + # Get the end state LJ sigma values. + lj0 = atom.property("LJ0") + lj1 = atom.property("LJ1") + + # Lambda = 0 state has a zero sigma value. + if abs(lj0.sigma().value()) <= null_lj_sigma: + # Use the sigma value from the lambda = 1 state. + edit_mol = ( + edit_mol.atom(atom.index()) + .set_property("LJ0", _SireMM.LJParameter(lj1.sigma(), lj0.epsilon())) + .molecule() + ) + + # Lambda = 1 state has a zero sigma value. + if abs(lj1.sigma().value()) <= null_lj_sigma: + # Use the sigma value from the lambda = 0 state. + edit_mol = ( + edit_mol.atom(atom.index()) + .set_property("LJ1", _SireMM.LJParameter(lj0.sigma(), lj1.epsilon())) + .molecule() + ) + # We now need to merge "bond", "angle", "dihedral", and "improper" parameters. # To do so, we extract the properties from molecule1, then add the additional # properties from molecule0, making sure to update the atom indices, and bond diff --git a/python/BioSimSpace/Sandpit/Exscientia/Process/_somd.py b/python/BioSimSpace/Sandpit/Exscientia/Process/_somd.py index c9850f543..97e410269 100644 --- a/python/BioSimSpace/Sandpit/Exscientia/Process/_somd.py +++ b/python/BioSimSpace/Sandpit/Exscientia/Process/_somd.py @@ -1209,6 +1209,10 @@ def _to_pert_file( # 1) Atoms. + # Store a null LJParameter object for dummy atoms. SOMD requires that + # both sigma and epsilon are set to zero for dummy atoms. + dummy_lj = _SireMM.LJParameter() + def atom_sorting_criteria(atom): LJ0 = atom.property("LJ0") LJ1 = atom.property("LJ1") @@ -1236,6 +1240,13 @@ def atom_sorting_criteria(atom): LJ0 = atom.property("LJ0") LJ1 = atom.property("LJ1") + # Dummy atom at lambda = 0. + if _is_dummy(mol, atom.index(), is_lambda1=False): + LJ0 = dummy_lj + # Dummy atom at lambda = 1. + if _is_dummy(mol, atom.index(), is_lambda1=True): + LJ1 = dummy_lj + # Atom data. file.write(" name %s\n" % atom.name().value()) file.write( @@ -1279,6 +1290,13 @@ def atom_sorting_criteria(atom): LJ0 = atom.property("LJ0") LJ1 = atom.property("LJ1") + # Dummy atom at lambda = 0. + if _is_dummy(mol, idx, is_lambda1=False): + LJ0 = dummy_lj + # Dummy atom at lambda = 1. + if _is_dummy(mol, idx, is_lambda1=True): + LJ1 = dummy_lj + # Atom data. file.write(" name %s\n" % atom.name().value()) file.write( @@ -1318,6 +1336,10 @@ def atom_sorting_criteria(atom): # Only require the initial Lennard-Jones properties. LJ0 = atom.property("LJ0") + # Dummy atom at lambda = 0. + if _is_dummy(mol, atom.index(), is_lambda1=False): + LJ0 = dummy_lj + # Atom data. Create dummy pert file with identical initial and final properties. file.write(" name %s\n" % atom.name().value()) file.write( @@ -1360,6 +1382,10 @@ def atom_sorting_criteria(atom): # Only require the initial Lennard-Jones properties. LJ0 = atom.property("LJ0") + # Dummy atom at lambda = 0. + if _is_dummy(mol, idx, is_lambda1=False): + LJ0 = dummy_lj + # Atom data. Create dummy pert file with identical initial and final properties. file.write(" name %s\n" % atom.name().value()) file.write( @@ -1400,6 +1426,10 @@ def atom_sorting_criteria(atom): LJ1 = atom.property("LJ1") charge1_value = atom.property("charge1").value() + # Dummy atom at lambda = 1. + if _is_dummy(mol, atom.index(), is_lambda1=True): + LJ1 = dummy_lj + # Atom data. Create dummy pert file with identical initial and final properties. file.write(" name %s\n" % atom.name().value()) file.write( @@ -1437,6 +1467,10 @@ def atom_sorting_criteria(atom): LJ1 = atom.property("LJ1") charge1_value = atom.property("charge1").value() + # Dummy atom at lambda = 1. + if _is_dummy(mol, idx, is_lambda1=True): + LJ1 = dummy_lj + # Atom data. Create dummy pert file with identical initial and final properties. file.write(" name %s\n" % atom.name().value()) file.write( @@ -1478,6 +1512,13 @@ def atom_sorting_criteria(atom): LJ0 = atom.property("LJ0") LJ1 = atom.property("LJ1") + # Dummy atom at lambda = 0. + if _is_dummy(mol, idx, is_lambda1=False): + LJ0 = dummy_lj + # Dummy atom at lambda = 1. + if _is_dummy(mol, idx, is_lambda1=True): + LJ1 = dummy_lj + # Atom data. # Get the atom types: atom_type0 = atom.property("ambertype0") @@ -1485,11 +1526,11 @@ def atom_sorting_criteria(atom): # Set LJ/charge based on requested perturbed term. if perturbation_type == "discharge_soft": - if atom.property("element0") == _SireMol.Element( - "X" - ) or atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=False) or _is_dummy( + mol, idx, is_lambda1=True + ): # If perturbing TO dummy: - if atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=True): atom_type1 = atom_type0 # In this step, only remove charges from soft-core perturbations. @@ -1503,7 +1544,7 @@ def atom_sorting_criteria(atom): # If perturbing FROM dummy: else: - # All terms have already been perturbed in "5_grow_soft". + # All terms have already been perturbed in "grow_soft". atom_type1 = atom_type0 LJ0_value = LJ1_value = ( LJ0.sigma().value(), @@ -1523,11 +1564,11 @@ def atom_sorting_criteria(atom): charge0_value = charge1_value = atom.property("charge0").value() elif perturbation_type == "vanish_soft": - if atom.property("element0") == _SireMol.Element( - "X" - ) or atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=False) or _is_dummy( + mol, idx, is_lambda1=True + ): # If perturbing TO dummy: - if atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=True): # allow atom types to change. atom_type0 = atom_type0 atom_type1 = atom_type1 @@ -1541,7 +1582,7 @@ def atom_sorting_criteria(atom): # If perturbing FROM dummy: else: - # All terms have already been perturbed in "5_grow_soft". + # All terms have already been perturbed in "grow_soft". atom_type1 = atom_type0 LJ0_value = LJ1_value = ( LJ0.sigma().value(), @@ -1561,11 +1602,11 @@ def atom_sorting_criteria(atom): charge0_value = charge1_value = atom.property("charge0").value() elif perturbation_type == "flip": - if atom.property("element0") == _SireMol.Element( - "X" - ) or atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=False) or _is_dummy( + mol, idx, is_lambda1=True + ): # If perturbing TO dummy: - if atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=True): # atom types have already been changed. atom_type0 = atom_type1 @@ -1575,7 +1616,7 @@ def atom_sorting_criteria(atom): # If perturbing FROM dummy: else: - # All terms have already been perturbed in "5_grow_soft". + # All terms have already been perturbed in "grow_soft". atom_type1 = atom_type0 LJ0_value = LJ1_value = ( LJ0.sigma().value(), @@ -1595,11 +1636,11 @@ def atom_sorting_criteria(atom): charge1_value = atom.property("charge1").value() elif perturbation_type == "grow_soft": - if atom.property("element0") == _SireMol.Element( - "X" - ) or atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=False) or _is_dummy( + mol, idx, is_lambda1=True + ): # If perturbing TO dummy: - if atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=True): # atom types have already been changed. atom_type0 = atom_type1 @@ -1631,11 +1672,11 @@ def atom_sorting_criteria(atom): charge0_value = charge1_value = atom.property("charge1").value() elif perturbation_type == "charge_soft": - if atom.property("element0") == _SireMol.Element( - "X" - ) or atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=False) or _is_dummy( + mol, idx, is_lambda1=True + ): # If perturbing TO dummy: - if atom.property("element1") == _SireMol.Element("X"): + if _is_dummy(mol, idx, is_lambda1=True): # atom types have already been changed. atom_type0 = atom_type1 @@ -3308,11 +3349,13 @@ def _has_dummy(mol, idxs, is_lambda1=False): element_dummy = _SireMol.Element(0) ambertype_dummy = "du" + # Check that the molecule has the ambertype property. + has_ambertype = mol.hasProperty(ambertype_prop) + # Check whether an of the atoms is a dummy. for idx in idxs: - if ( - mol.atom(idx).property(element_prop) == element_dummy - or mol.atom(idx).property(ambertype_prop) == ambertype_dummy + if mol.atom(idx).property(element_prop) == element_dummy or ( + has_ambertype and mol.atom(idx).property(ambertype_prop) == ambertype_dummy ): return True @@ -3322,6 +3365,7 @@ def _has_dummy(mol, idxs, is_lambda1=False): def _is_dummy(mol, idxs, is_lambda1=False): """ Internal function to return whether each atom is a dummy. + If a single index is pased, then a single boolean is returned. Parameters ---------- @@ -3364,17 +3408,30 @@ def _is_dummy(mol, idxs, is_lambda1=False): element_dummy = _SireMol.Element(0) ambertype_dummy = "du" + # Check that the molecule has the ambertype property. + has_ambertype = mol.hasProperty(ambertype_prop) + # Initialise a list to store the state of each atom. is_dummy = [] + # Convert single index to list. + if not isinstance(idxs, list): + idxs = [idxs] + # Check whether each of the atoms is a dummy. for idx in idxs: is_dummy.append( mol.atom(idx).property(element_prop) == element_dummy - or mol.atom(idx).property(ambertype_prop) == ambertype_dummy + or ( + has_ambertype + and mol.atom(idx).property(ambertype_prop) == ambertype_dummy + ) ) - return is_dummy + if len(is_dummy) == 1: + return is_dummy[0] + else: + return is_dummy def _random_suffix(basename, size=4, chars=_string.ascii_uppercase + _string.digits): From befa558f1d651e4c1b92ae616d981705d2db24e4 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Mon, 17 Jun 2024 09:24:15 +0100 Subject: [PATCH 2/3] Backport fix from PR #298. [ci skip] --- python/BioSimSpace/Parameters/_parameters.py | 42 ++++++++++++------- .../Exscientia/Parameters/_parameters.py | 42 ++++++++++++------- 2 files changed, 56 insertions(+), 28 deletions(-) diff --git a/python/BioSimSpace/Parameters/_parameters.py b/python/BioSimSpace/Parameters/_parameters.py index 6e8570bb9..825e71490 100644 --- a/python/BioSimSpace/Parameters/_parameters.py +++ b/python/BioSimSpace/Parameters/_parameters.py @@ -111,8 +111,10 @@ def parameterise( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ if not isinstance(forcefield, str): @@ -208,8 +210,10 @@ def _parameterise_amber_protein( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ if not isinstance(forcefield, str): @@ -314,8 +318,10 @@ def gaff( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ if _amber_home is None: @@ -407,8 +413,10 @@ def gaff2( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ if _amber_home is None: @@ -506,8 +514,10 @@ def _parameterise_openff( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ from sire.legacy.Base import findExe as _findExe @@ -1068,8 +1078,10 @@ def _function( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ return _parameterise_amber_protein( name, @@ -1133,8 +1145,10 @@ def _function( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ return _parameterise_openff( name, diff --git a/python/BioSimSpace/Sandpit/Exscientia/Parameters/_parameters.py b/python/BioSimSpace/Sandpit/Exscientia/Parameters/_parameters.py index 6e8570bb9..825e71490 100644 --- a/python/BioSimSpace/Sandpit/Exscientia/Parameters/_parameters.py +++ b/python/BioSimSpace/Sandpit/Exscientia/Parameters/_parameters.py @@ -111,8 +111,10 @@ def parameterise( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ if not isinstance(forcefield, str): @@ -208,8 +210,10 @@ def _parameterise_amber_protein( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ if not isinstance(forcefield, str): @@ -314,8 +318,10 @@ def gaff( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ if _amber_home is None: @@ -407,8 +413,10 @@ def gaff2( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ if _amber_home is None: @@ -506,8 +514,10 @@ def _parameterise_openff( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ from sire.legacy.Base import findExe as _findExe @@ -1068,8 +1078,10 @@ def _function( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ return _parameterise_amber_protein( name, @@ -1133,8 +1145,10 @@ def _function( Returns ------- - molecule : :class:`Molecule ` - The parameterised molecule. + process : :class:`Process ` + A process to parameterise the molecule in the background. Call the + .getMolecule() method on the returned process to block until the + parameterisation is complete and get the parameterised molecule. """ return _parameterise_openff( name, From fb4be17f67b61d94ce419fdc8bd0b7fc5d138486 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Mon, 17 Jun 2024 09:25:23 +0100 Subject: [PATCH 3/3] Backport fix from PR #300. [ci skip] --- python/BioSimSpace/IO/_io.py | 2 +- python/BioSimSpace/Sandpit/Exscientia/IO/_io.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/BioSimSpace/IO/_io.py b/python/BioSimSpace/IO/_io.py index ff475f349..bf1dbbd5a 100644 --- a/python/BioSimSpace/IO/_io.py +++ b/python/BioSimSpace/IO/_io.py @@ -764,7 +764,7 @@ def saveMolecules( continue # Add the file format to the property map. - _property_map["fileformat"] = _SireBase.wrap(format) + _property_map["fileformat"] = format # Warn the user if any molecules are parameterised with a force field # that uses geometric combining rules. While we can write this to file diff --git a/python/BioSimSpace/Sandpit/Exscientia/IO/_io.py b/python/BioSimSpace/Sandpit/Exscientia/IO/_io.py index ff475f349..bf1dbbd5a 100644 --- a/python/BioSimSpace/Sandpit/Exscientia/IO/_io.py +++ b/python/BioSimSpace/Sandpit/Exscientia/IO/_io.py @@ -764,7 +764,7 @@ def saveMolecules( continue # Add the file format to the property map. - _property_map["fileformat"] = _SireBase.wrap(format) + _property_map["fileformat"] = format # Warn the user if any molecules are parameterised with a force field # that uses geometric combining rules. While we can write this to file