Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/BioSimSpace/Parameters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

import BioSimSpace as BSS

print(BSS.Parameters.force_fields())
print(BSS.Parameters.forceFields())

Parameterise a molecule using GAFF.

Expand Down
2 changes: 1 addition & 1 deletion python/BioSimSpace/Parameters/_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def parameterise(
string.

forcefield : str
The force field. Run BioSimSpace.Parameters.force_fields() to get a
The force field. Run BioSimSpace.Parameters.forceFields() to get a
list of the supported force fields.

ensure_compatible : bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

import BioSimSpace as BSS

print(BSS.Parameters.force_fields())
print(BSS.Parameters.forceFields())

Parameterise a molecule using GAFF.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def parameterise(
string.

forcefield : str
The force field. Run BioSimSpace.Parameters.force_fields() to get a
The force field. Run BioSimSpace.Parameters.forceFields() to get a
list of the supported force fields.

ensure_compatible : bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -983,9 +983,9 @@ def makeCompatibleWith(
propty = mol1.property(_property_map[prop])

# Try making it compatible with the original molecule.
if hasattr(propty, "makeCompatibleWith"):
if hasattr(propty, "make_compatible_with"):
try:
propty = propty.makeCompatibleWith(
propty = propty.make_compatible_with(
mol0, inv_matches
)
except Exception as e:
Expand Down Expand Up @@ -1188,9 +1188,9 @@ def makeCompatibleWith(
propty = mol.property(prop)

# Try making the property compatible with the original molecule.
if hasattr(propty, "makeCompatibleWith"):
if hasattr(propty, "make_compatible_with"):
try:
propty = propty.makeCompatibleWith(mol0, inv_matches)
propty = propty.make_compatible_with(mol0, inv_matches)
except Exception as e:
msg = "Incompatible property: %s" % prop
if _isVerbose():
Expand Down
8 changes: 4 additions & 4 deletions python/BioSimSpace/_SireWrappers/_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,9 +923,9 @@ def makeCompatibleWith(
propty = mol1.property(_property_map[prop])

# Try making it compatible with the original molecule.
if hasattr(propty, "makeCompatibleWith"):
if hasattr(propty, "make_compatible_with"):
try:
propty = propty.makeCompatibleWith(
propty = propty.make_compatible_with(
mol0, inv_matches
)
except Exception as e:
Expand Down Expand Up @@ -1128,9 +1128,9 @@ def makeCompatibleWith(
propty = mol.property(prop)

# Try making the property compatible with the original molecule.
if hasattr(propty, "makeCompatibleWith"):
if hasattr(propty, "make_compatible_with"):
try:
propty = propty.makeCompatibleWith(mol0, inv_matches)
propty = propty.make_compatible_with(mol0, inv_matches)
except Exception as e:
msg = "Incompatible property: %s" % prop
if _isVerbose():
Expand Down
31 changes: 31 additions & 0 deletions tests/Sandpit/Exscientia/_SireWrappers/test_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,34 @@ def test_lipid(lipid):
mol._sire_object = c.commit()

assert mol.isLipid() is lipid


@pytest.mark.skipif(has_amber is False, reason="Requires AMBER to be installed.")
def test_makeCompatibleWith_regression():
"""Test that makeCompatibleWith works correctly for a known regression case."""

import sire as sr

# Load the BACE protein.
protein_xtal = BSS.IO.readMolecules(BSS.IO.expand(url, "bace.pdb"))

# Remove waters.
protein = protein_xtal[0].extract(
[atom.index() for atom in protein_xtal[0].search("not resname WAT").atoms()]
)

# Parameterise with ff14SB.
protein = BSS.Parameters.ff14SB(
protein, work_dir="debug", ensure_compatible=False
).getMolecule()

# Convert to a Sire System and compute the energy.
system = sr.system.System(protein.toSystem()._sire_object)
nrg_compatible = system.energy().value()

# Load in the tLEaP-generated system and compute the energy.
system = sr.load("debug/leap.crd", "debug/leap.top")
nrg_leap = system.energy().value()

# Make sure the energies are approximately equal.
assert nrg_compatible == pytest.approx(nrg_leap, rel=1e-5)
31 changes: 31 additions & 0 deletions tests/_SireWrappers/test_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,34 @@ def test_extract(system):

# Make sure the numbers are different.
assert partial_mol.number() != mol.number()


@pytest.mark.skipif(has_amber is False, reason="Requires AMBER to be installed.")
def test_makeCompatibleWith_regression():
"""Test that makeCompatibleWith works correctly for a known regression case."""

import sire as sr

# Load the BACE protein.
protein_xtal = BSS.IO.readMolecules(BSS.IO.expand(url, "bace.pdb"))

# Remove waters.
protein = protein_xtal[0].extract(
[atom.index() for atom in protein_xtal[0].search("not resname WAT").atoms()]
)

# Parameterise with ff14SB.
protein = BSS.Parameters.ff14SB(
protein, work_dir="debug", ensure_compatible=False
).getMolecule()

# Convert to a Sire System and compute the energy.
system = sr.system.System(protein.toSystem()._sire_object)
nrg_compatible = system.energy().value()

# Load in the tLEaP-generated system and compute the energy.
system = sr.load("debug/leap.crd", "debug/leap.top")
nrg_leap = system.energy().value()

# Make sure the energies are approximately equal.
assert nrg_compatible == pytest.approx(nrg_leap, rel=1e-5)