Skip to content

Commit

Permalink
Merge pull request #263 from OpenBioSim/backport_2023.5.1
Browse files Browse the repository at this point in the history
Backport 2023.5.1
  • Loading branch information
lohedges authored Mar 20, 2024
2 parents 034ddd4 + 539b0ae commit d25426d
Show file tree
Hide file tree
Showing 38 changed files with 676 additions and 539 deletions.
13 changes: 13 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ company supporting open-source development of fostering academic/industrial coll
within the biomolecular simulation community. Our software is hosted via the `OpenBioSim`
`GitHub <https://github.com/OpenBioSim/biosimspace>`__ organisation.

`2023.5.1 <https://github.com/openbiosim/biosimspace/compare/2023.5.0...2023.5.1>`_ - Mar 20 2024
-------------------------------------------------------------------------------------------------

* Fixed path to user links file in the :func:`generateNetwork <BioSimSpace.Align.generateNetwork>` function (`#233 <https://github.com/OpenBioSim/biosimspace/pull/233>`__).
* Fixed redirection of stderr (`#233 <https://github.com/OpenBioSim/biosimspace/pull/233>`__).
* Switched to using ``AtomCoordMatcher`` to map parameterised molecules back to their original topology. This resolves issues where atoms moved between residues following parameterisation (`#235 <https://github.com/OpenBioSim/biosimspace/pull/235>`__).
* Make the GROMACS ``_generate_binary_run_file`` function static so that it can be used when initialising free energy simulations in setup-only mode (`#237 <https://github.com/OpenBioSim/biosimspace/pull/237>`__).
* Improve error handling and message when attempting to extract an all dummy atom selection (`#251 <https://github.com/OpenBioSim/biosimspace/pull/251>`__).
* Don't set SOMD specific end-state properties when decoupling a molecule (`#253 <https://github.com/OpenBioSim/biosimspace/pull/253>`__).
* Only convert to a end-state system when not running a free energy protocol with GROMACS so that hybrid topology isn't lost when using position restraints (`#257 <https://github.com/OpenBioSim/biosimspace/pull/257>`__).
* Exclude standard free ions from the AMBER position restraint mask (`#260 <https://github.com/OpenBioSim/biosimspace/pull/260>`__).
* Update the ``BioSimSpace.Types._GeneralUnit.__pow__`` operator to support fractional exponents (`#260 <https://github.com/OpenBioSim/biosimspace/pull/260>`__).

`2023.5.0 <https://github.com/openbiosim/biosimspace/compare/2023.4.1...2023.5.0>`_ - Dec 16 2023
-------------------------------------------------------------------------------------------------

Expand Down
6 changes: 4 additions & 2 deletions python/BioSimSpace/Process/_gromacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1995,8 +1995,10 @@ def _add_position_restraints(self):
# Create a copy of the system.
system = self._system.copy()

# Convert to the lambda = 0 state if this is a perturbable system.
system = self._checkPerturbable(system)
# Convert to the lambda = 0 state if this is a perturbable system and this
# isn't a free energy protocol.
if not isinstance(self._protocol, _FreeEnergyMixin):
system = self._checkPerturbable(system)

# Convert the water model topology so that it matches the GROMACS naming convention.
system._set_water_topology("GROMACS")
Expand Down
4 changes: 2 additions & 2 deletions python/BioSimSpace/Protocol/_position_restraint_mixin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
######################################################################
# BioSimSpace: Making biomolecular simulation a breeze!
#
# Copyright: 2017-2023
# Copyright: 2017-2024
#
# Authors: Lester Hedges <[email protected]>
#
Expand Down Expand Up @@ -214,7 +214,7 @@ def setForceConstant(self, force_constant):
)

# Validate the dimensions.
if force_constant.dimensions() != (0, 0, 0, 1, -1, 0, -2):
if force_constant.dimensions() != (1, 0, -2, 0, 0, -1, 0):
raise ValueError(
"'force_constant' has invalid dimensions! "
f"Expected dimensions are 'M Q-1 T-2', found '{force_constant.unit()}'"
Expand Down
10 changes: 5 additions & 5 deletions python/BioSimSpace/Sandpit/Exscientia/FreeEnergy/_restraint.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
######################################################################
# BioSimSpace: Making biomolecular simulation a breeze!
#
# Copyright: 2017-2023
# Copyright: 2017-2024
#
# Authors: Lester Hedges <[email protected]>
#
Expand Down Expand Up @@ -174,7 +174,7 @@ def __init__(self, system, restraint_dict, temperature, restraint_type="Boresch"
for key in ["kthetaA", "kthetaB", "kphiA", "kphiB", "kphiC"]:
if restraint_dict["force_constants"][key] != 0:
dim = restraint_dict["force_constants"][key].dimensions()
if dim != (-2, 0, 2, 1, -1, 0, -2):
if dim != (1, 2, -2, 0, 0, -1, -2):
raise ValueError(
f"restraint_dict['force_constants']['{key}'] must be of type "
f"'BioSimSpace.Types.Energy'/'BioSimSpace.Types.Angle^2'"
Expand Down Expand Up @@ -202,7 +202,7 @@ def __init__(self, system, restraint_dict, temperature, restraint_type="Boresch"
# Test if the force constant of the bond r1-l1 is the correct unit
# Such as kcal/mol/angstrom^2
dim = restraint_dict["force_constants"]["kr"].dimensions()
if dim != (0, 0, 0, 1, -1, 0, -2):
if dim != (1, 0, -2, 0, 0, -1, 0):
raise ValueError(
"restraint_dict['force_constants']['kr'] must be of type "
"'BioSimSpace.Types.Energy'/'BioSimSpace.Types.Length^2'"
Expand Down Expand Up @@ -290,13 +290,13 @@ def __init__(self, system, restraint_dict, temperature, restraint_type="Boresch"
"'BioSimSpace.Types.Length'"
)
if not single_restraint_dict["kr"].dimensions() == (
1,
0,
-2,
0,
0,
1,
-1,
0,
-2,
):
raise ValueError(
"distance_restraint_dict['kr'] must be of type "
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
######################################################################
# BioSimSpace: Making biomolecular simulation a breeze!
#
# Copyright: 2017-2023
# Copyright: 2017-2024
#
# Authors: Lester Hedges <[email protected]>
#
Expand Down Expand Up @@ -641,7 +641,7 @@ def analyse(

if force_constant:
dim = force_constant.dimensions()
if dim != (0, 0, 0, 1, -1, 0, -2):
if dim != (1, 0, -2, 0, 0, -1, 0):
raise ValueError(
"force_constant must be of type "
"'BioSimSpace.Types.Energy'/'BioSimSpace.Types.Length^2'"
Expand Down
6 changes: 4 additions & 2 deletions python/BioSimSpace/Sandpit/Exscientia/Process/_gromacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2099,8 +2099,10 @@ def _add_position_restraints(self, config_options):
# Create a copy of the system.
system = self._system.copy()

# Convert to the lambda = 0 state if this is a perturbable system.
system = self._checkPerturbable(system)
# Convert to the lambda = 0 state if this is a perturbable system and this
# isn't a free energy protocol.
if not isinstance(self._protocol, _Protocol._FreeEnergyMixin):
system = self._checkPerturbable(system)

# Convert the water model topology so that it matches the GROMACS naming convention.
system._set_water_topology("GROMACS")
Expand Down
4 changes: 2 additions & 2 deletions python/BioSimSpace/Sandpit/Exscientia/Protocol/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ def generateAmberConfig(self, extra_options=None, extra_lines=None):
]
restraint_mask = "@" + ",".join(restraint_atom_names)
elif restraint == "heavy":
restraint_mask = "!:WAT & !@H="
restraint_mask = "!:WAT & !@%NA,CL & !@H="
elif restraint == "all":
restraint_mask = "!:WAT"
restraint_mask = "!:WAT & !@%NA,CL"

# We can't do anything about a custom restraint, since we don't
# know anything about the atoms.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def setForceConstant(self, force_constant):
)

# Validate the dimensions.
if force_constant.dimensions() != (0, 0, 0, 1, -1, 0, -2):
if force_constant.dimensions() != (1, 0, -2, 0, 0, -1, 0):
raise ValueError(
"'force_constant' has invalid dimensions! "
f"Expected dimensions are 'M Q-1 T-2', found '{force_constant.unit()}'"
Expand Down
18 changes: 9 additions & 9 deletions python/BioSimSpace/Sandpit/Exscientia/Types/_angle.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
######################################################################
# BioSimSpace: Making biomolecular simulation a breeze!
#
# Copyright: 2017-2023
# Copyright: 2017-2024
#
# Authors: Lester Hedges <[email protected]>
#
Expand Down Expand Up @@ -52,9 +52,8 @@ class Angle(_Type):
# Null type unit for avoiding issue printing configargparse help.
_default_unit = "RADIAN"

# The dimension mask:
# Angle, Charge, Length, Mass, Quantity, Temperature, Time
_dimensions = (1, 0, 0, 0, 0, 0, 0)
# The dimension mask.
_dimensions = tuple(list(_supported_units.values())[0].dimensions())

def __init__(self, *args):
"""
Expand Down Expand Up @@ -188,7 +187,8 @@ def _convert_to(self, unit):
"Supported units are: '%s'" % list(self._supported_units.keys())
)

def _validate_unit(self, unit):
@classmethod
def _validate_unit(cls, unit):
"""Validate that the unit are supported."""

# Strip whitespace and convert to upper case.
Expand All @@ -210,13 +210,13 @@ def _validate_unit(self, unit):
unit = unit.replace("AD", "")

# Check that the unit is supported.
if unit in self._supported_units:
if unit in cls._supported_units:
return unit
elif unit in self._abbreviations:
return self._abbreviations[unit]
elif unit in cls._abbreviations:
return cls._abbreviations[unit]
else:
raise ValueError(
"Supported units are: '%s'" % list(self._supported_units.keys())
"Supported units are: '%s'" % list(cls._supported_units.keys())
)

@staticmethod
Expand Down
18 changes: 9 additions & 9 deletions python/BioSimSpace/Sandpit/Exscientia/Types/_area.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
######################################################################
# BioSimSpace: Making biomolecular simulation a breeze!
#
# Copyright: 2017-2023
# Copyright: 2017-2024
#
# Authors: Lester Hedges <[email protected]>
#
Expand Down Expand Up @@ -72,9 +72,8 @@ class Area(_Type):
# Null type unit for avoiding issue printing configargparse help.
_default_unit = "ANGSTROM2"

# The dimension mask:
# Angle, Charge, Length, Mass, Quantity, Temperature, Time
_dimensions = (0, 0, 2, 0, 0, 0, 0)
# The dimension mask.
_dimensions = tuple(list(_supported_units.values())[0].dimensions())

def __init__(self, *args):
"""
Expand Down Expand Up @@ -330,7 +329,8 @@ def _convert_to(self, unit):
"Supported units are: '%s'" % list(self._supported_units.keys())
)

def _validate_unit(self, unit):
@classmethod
def _validate_unit(cls, unit):
"""Validate that the unit is supported."""

# Strip whitespace and convert to upper case.
Expand Down Expand Up @@ -360,13 +360,13 @@ def _validate_unit(self, unit):
unit = unit[0:index] + unit[index + 1 :] + "2"

# Check that the unit is supported.
if unit in self._supported_units:
if unit in cls._supported_units:
return unit
elif unit in self._abbreviations:
return self._abbreviations[unit]
elif unit in cls._abbreviations:
return cls._abbreviations[unit]
else:
raise ValueError(
"Supported units are: '%s'" % list(self._supported_units.keys())
"Supported units are: '%s'" % list(cls._supported_units.keys())
)

@staticmethod
Expand Down
16 changes: 8 additions & 8 deletions python/BioSimSpace/Sandpit/Exscientia/Types/_charge.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
######################################################################
# BioSimSpace: Making biomolecular simulation a breeze!
#
# Copyright: 2017-2023
# Copyright: 2017-2024
#
# Authors: Lester Hedges <[email protected]>
#
Expand Down Expand Up @@ -58,9 +58,8 @@ class Charge(_Type):
# Null type unit for avoiding issue printing configargparse help.
_default_unit = "ELECTRON CHARGE"

# The dimension mask:
# Angle, Charge, Length, Mass, Quantity, Temperature, Time
_dimensions = (0, 1, 0, 0, 0, 0, 0)
# The dimension mask.
_dimensions = tuple(list(_supported_units.values())[0].dimensions())

def __init__(self, *args):
"""
Expand Down Expand Up @@ -182,7 +181,8 @@ def _convert_to(self, unit):
"Supported units are: '%s'" % list(self._supported_units.keys())
)

def _validate_unit(self, unit):
@classmethod
def _validate_unit(cls, unit):
"""Validate that the unit are supported."""

# Strip whitespace and convert to upper case.
Expand Down Expand Up @@ -213,11 +213,11 @@ def _validate_unit(self, unit):
unit = unit.replace("COUL", "C")

# Check that the unit is supported.
if unit in self._abbreviations:
return self._abbreviations[unit]
if unit in cls._abbreviations:
return cls._abbreviations[unit]
else:
raise ValueError(
"Supported units are: '%s'" % list(self._supported_units.keys())
"Supported units are: '%s'" % list(cls._supported_units.keys())
)

@staticmethod
Expand Down
16 changes: 8 additions & 8 deletions python/BioSimSpace/Sandpit/Exscientia/Types/_energy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
######################################################################
# BioSimSpace: Making biomolecular simulation a breeze!
#
# Copyright: 2017-2023
# Copyright: 2017-2024
#
# Authors: Lester Hedges <[email protected]>
#
Expand Down Expand Up @@ -68,9 +68,8 @@ class Energy(_Type):
# Null type unit for avoiding issue printing configargparse help.
_default_unit = "KILO CALORIES PER MOL"

# The dimension mask:
# Angle, Charge, Length, Mass, Quantity, Temperature, Time
_dimensions = (0, 0, 2, 1, -1, 0, -2)
# The dimension mask.
_dimensions = tuple(list(_supported_units.values())[0].dimensions())

def __init__(self, *args):
"""
Expand Down Expand Up @@ -213,7 +212,8 @@ def _convert_to(self, unit):
"Supported units are: '%s'" % list(self._supported_units.keys())
)

def _validate_unit(self, unit):
@classmethod
def _validate_unit(cls, unit):
"""Validate that the unit are supported."""

# Strip whitespace and convert to upper case.
Expand All @@ -235,11 +235,11 @@ def _validate_unit(self, unit):
unit = unit.replace("JOULES", "J")

# Check that the unit is supported.
if unit in self._abbreviations:
return self._abbreviations[unit]
if unit in cls._abbreviations:
return cls._abbreviations[unit]
else:
raise ValueError(
"Supported units are: '%s'" % list(self._supported_units.keys())
"Supported units are: '%s'" % list(cls._supported_units.keys())
)

@staticmethod
Expand Down
Loading

0 comments on commit d25426d

Please sign in to comment.