-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport fixes from PR #260. [ci skip]
- Loading branch information
Showing
32 changed files
with
646 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
# | ||
|
@@ -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()}'" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
# | ||
|
@@ -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'" | ||
|
@@ -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'" | ||
|
@@ -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 " | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
# | ||
|
@@ -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'" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
# | ||
|
@@ -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): | ||
""" | ||
|
@@ -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. | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
# | ||
|
@@ -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): | ||
""" | ||
|
@@ -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. | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
# | ||
|
@@ -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): | ||
""" | ||
|
@@ -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. | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
# | ||
|
@@ -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): | ||
""" | ||
|
@@ -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. | ||
|
@@ -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 | ||
|
Oops, something went wrong.