Skip to content

Commit d25426d

Browse files
authored
Merge pull request #263 from OpenBioSim/backport_2023.5.1
Backport 2023.5.1
2 parents 034ddd4 + 539b0ae commit d25426d

38 files changed

+676
-539
lines changed

doc/source/changelog.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ company supporting open-source development of fostering academic/industrial coll
99
within the biomolecular simulation community. Our software is hosted via the `OpenBioSim`
1010
`GitHub <https://github.com/OpenBioSim/biosimspace>`__ organisation.
1111

12+
`2023.5.1 <https://github.com/openbiosim/biosimspace/compare/2023.5.0...2023.5.1>`_ - Mar 20 2024
13+
-------------------------------------------------------------------------------------------------
14+
15+
* Fixed path to user links file in the :func:`generateNetwork <BioSimSpace.Align.generateNetwork>` function (`#233 <https://github.com/OpenBioSim/biosimspace/pull/233>`__).
16+
* Fixed redirection of stderr (`#233 <https://github.com/OpenBioSim/biosimspace/pull/233>`__).
17+
* 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>`__).
18+
* 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>`__).
19+
* Improve error handling and message when attempting to extract an all dummy atom selection (`#251 <https://github.com/OpenBioSim/biosimspace/pull/251>`__).
20+
* Don't set SOMD specific end-state properties when decoupling a molecule (`#253 <https://github.com/OpenBioSim/biosimspace/pull/253>`__).
21+
* 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>`__).
22+
* Exclude standard free ions from the AMBER position restraint mask (`#260 <https://github.com/OpenBioSim/biosimspace/pull/260>`__).
23+
* Update the ``BioSimSpace.Types._GeneralUnit.__pow__`` operator to support fractional exponents (`#260 <https://github.com/OpenBioSim/biosimspace/pull/260>`__).
24+
1225
`2023.5.0 <https://github.com/openbiosim/biosimspace/compare/2023.4.1...2023.5.0>`_ - Dec 16 2023
1326
-------------------------------------------------------------------------------------------------
1427

python/BioSimSpace/Process/_gromacs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,8 +1995,10 @@ def _add_position_restraints(self):
19951995
# Create a copy of the system.
19961996
system = self._system.copy()
19971997

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

20012003
# Convert the water model topology so that it matches the GROMACS naming convention.
20022004
system._set_water_topology("GROMACS")

python/BioSimSpace/Protocol/_position_restraint_mixin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
######################################################################
22
# BioSimSpace: Making biomolecular simulation a breeze!
33
#
4-
# Copyright: 2017-2023
4+
# Copyright: 2017-2024
55
#
66
# Authors: Lester Hedges <lester.hedges@gmail.com>
77
#
@@ -214,7 +214,7 @@ def setForceConstant(self, force_constant):
214214
)
215215

216216
# Validate the dimensions.
217-
if force_constant.dimensions() != (0, 0, 0, 1, -1, 0, -2):
217+
if force_constant.dimensions() != (1, 0, -2, 0, 0, -1, 0):
218218
raise ValueError(
219219
"'force_constant' has invalid dimensions! "
220220
f"Expected dimensions are 'M Q-1 T-2', found '{force_constant.unit()}'"

python/BioSimSpace/Sandpit/Exscientia/FreeEnergy/_restraint.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
######################################################################
22
# BioSimSpace: Making biomolecular simulation a breeze!
33
#
4-
# Copyright: 2017-2023
4+
# Copyright: 2017-2024
55
#
66
# Authors: Lester Hedges <lester.hedges@gmail.com>
77
#
@@ -174,7 +174,7 @@ def __init__(self, system, restraint_dict, temperature, restraint_type="Boresch"
174174
for key in ["kthetaA", "kthetaB", "kphiA", "kphiB", "kphiC"]:
175175
if restraint_dict["force_constants"][key] != 0:
176176
dim = restraint_dict["force_constants"][key].dimensions()
177-
if dim != (-2, 0, 2, 1, -1, 0, -2):
177+
if dim != (1, 2, -2, 0, 0, -1, -2):
178178
raise ValueError(
179179
f"restraint_dict['force_constants']['{key}'] must be of type "
180180
f"'BioSimSpace.Types.Energy'/'BioSimSpace.Types.Angle^2'"
@@ -202,7 +202,7 @@ def __init__(self, system, restraint_dict, temperature, restraint_type="Boresch"
202202
# Test if the force constant of the bond r1-l1 is the correct unit
203203
# Such as kcal/mol/angstrom^2
204204
dim = restraint_dict["force_constants"]["kr"].dimensions()
205-
if dim != (0, 0, 0, 1, -1, 0, -2):
205+
if dim != (1, 0, -2, 0, 0, -1, 0):
206206
raise ValueError(
207207
"restraint_dict['force_constants']['kr'] must be of type "
208208
"'BioSimSpace.Types.Energy'/'BioSimSpace.Types.Length^2'"
@@ -290,13 +290,13 @@ def __init__(self, system, restraint_dict, temperature, restraint_type="Boresch"
290290
"'BioSimSpace.Types.Length'"
291291
)
292292
if not single_restraint_dict["kr"].dimensions() == (
293+
1,
293294
0,
295+
-2,
294296
0,
295297
0,
296-
1,
297298
-1,
298299
0,
299-
-2,
300300
):
301301
raise ValueError(
302302
"distance_restraint_dict['kr'] must be of type "

python/BioSimSpace/Sandpit/Exscientia/FreeEnergy/_restraint_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
######################################################################
22
# BioSimSpace: Making biomolecular simulation a breeze!
33
#
4-
# Copyright: 2017-2023
4+
# Copyright: 2017-2024
55
#
66
# Authors: Lester Hedges <lester.hedges@gmail.com>
77
#
@@ -641,7 +641,7 @@ def analyse(
641641

642642
if force_constant:
643643
dim = force_constant.dimensions()
644-
if dim != (0, 0, 0, 1, -1, 0, -2):
644+
if dim != (1, 0, -2, 0, 0, -1, 0):
645645
raise ValueError(
646646
"force_constant must be of type "
647647
"'BioSimSpace.Types.Energy'/'BioSimSpace.Types.Length^2'"

python/BioSimSpace/Sandpit/Exscientia/Process/_gromacs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,8 +2099,10 @@ def _add_position_restraints(self, config_options):
20992099
# Create a copy of the system.
21002100
system = self._system.copy()
21012101

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

21052107
# Convert the water model topology so that it matches the GROMACS naming convention.
21062108
system._set_water_topology("GROMACS")

python/BioSimSpace/Sandpit/Exscientia/Protocol/_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,9 @@ def generateAmberConfig(self, extra_options=None, extra_lines=None):
293293
]
294294
restraint_mask = "@" + ",".join(restraint_atom_names)
295295
elif restraint == "heavy":
296-
restraint_mask = "!:WAT & !@H="
296+
restraint_mask = "!:WAT & !@%NA,CL & !@H="
297297
elif restraint == "all":
298-
restraint_mask = "!:WAT"
298+
restraint_mask = "!:WAT & !@%NA,CL"
299299

300300
# We can't do anything about a custom restraint, since we don't
301301
# know anything about the atoms.

python/BioSimSpace/Sandpit/Exscientia/Protocol/_position_restraint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def setForceConstant(self, force_constant):
185185
)
186186

187187
# Validate the dimensions.
188-
if force_constant.dimensions() != (0, 0, 0, 1, -1, 0, -2):
188+
if force_constant.dimensions() != (1, 0, -2, 0, 0, -1, 0):
189189
raise ValueError(
190190
"'force_constant' has invalid dimensions! "
191191
f"Expected dimensions are 'M Q-1 T-2', found '{force_constant.unit()}'"

python/BioSimSpace/Sandpit/Exscientia/Types/_angle.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
######################################################################
22
# BioSimSpace: Making biomolecular simulation a breeze!
33
#
4-
# Copyright: 2017-2023
4+
# Copyright: 2017-2024
55
#
66
# Authors: Lester Hedges <lester.hedges@gmail.com>
77
#
@@ -52,9 +52,8 @@ class Angle(_Type):
5252
# Null type unit for avoiding issue printing configargparse help.
5353
_default_unit = "RADIAN"
5454

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

5958
def __init__(self, *args):
6059
"""
@@ -188,7 +187,8 @@ def _convert_to(self, unit):
188187
"Supported units are: '%s'" % list(self._supported_units.keys())
189188
)
190189

191-
def _validate_unit(self, unit):
190+
@classmethod
191+
def _validate_unit(cls, unit):
192192
"""Validate that the unit are supported."""
193193

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

212212
# Check that the unit is supported.
213-
if unit in self._supported_units:
213+
if unit in cls._supported_units:
214214
return unit
215-
elif unit in self._abbreviations:
216-
return self._abbreviations[unit]
215+
elif unit in cls._abbreviations:
216+
return cls._abbreviations[unit]
217217
else:
218218
raise ValueError(
219-
"Supported units are: '%s'" % list(self._supported_units.keys())
219+
"Supported units are: '%s'" % list(cls._supported_units.keys())
220220
)
221221

222222
@staticmethod

python/BioSimSpace/Sandpit/Exscientia/Types/_area.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
######################################################################
22
# BioSimSpace: Making biomolecular simulation a breeze!
33
#
4-
# Copyright: 2017-2023
4+
# Copyright: 2017-2024
55
#
66
# Authors: Lester Hedges <lester.hedges@gmail.com>
77
#
@@ -72,9 +72,8 @@ class Area(_Type):
7272
# Null type unit for avoiding issue printing configargparse help.
7373
_default_unit = "ANGSTROM2"
7474

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

7978
def __init__(self, *args):
8079
"""
@@ -330,7 +329,8 @@ def _convert_to(self, unit):
330329
"Supported units are: '%s'" % list(self._supported_units.keys())
331330
)
332331

333-
def _validate_unit(self, unit):
332+
@classmethod
333+
def _validate_unit(cls, unit):
334334
"""Validate that the unit is supported."""
335335

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

362362
# Check that the unit is supported.
363-
if unit in self._supported_units:
363+
if unit in cls._supported_units:
364364
return unit
365-
elif unit in self._abbreviations:
366-
return self._abbreviations[unit]
365+
elif unit in cls._abbreviations:
366+
return cls._abbreviations[unit]
367367
else:
368368
raise ValueError(
369-
"Supported units are: '%s'" % list(self._supported_units.keys())
369+
"Supported units are: '%s'" % list(cls._supported_units.keys())
370370
)
371371

372372
@staticmethod

0 commit comments

Comments
 (0)