Skip to content

Commit 39337f6

Browse files
authored
Merge pull request #450 from OpenBioSim/fix_dummy_modifications
Switch to positive boolean dummy_modifications default
2 parents 3c3285f + ce979ad commit 39337f6

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

python/BioSimSpace/Process/_somd.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ def __init__(
238238
self._zero_dummy_impropers = kwargs.get("zero_dummy_impropers", False)
239239
if not isinstance(self._zero_dummy_impropers, bool):
240240
self._zero_dummy_impropers = False
241-
self._no_dummy_modifications = kwargs.get("no_dummy_modifications", False)
242-
if not isinstance(self._no_dummy_modifications, bool):
243-
self._no_dummy_modifications = False
241+
self._dummy_modifications = kwargs.get("dummy_modifications", True)
242+
if not isinstance(self._dummy_modifications, bool):
243+
self._dummy_modifications = True
244244

245245
# The names of the input files.
246246
self._rst_file = _os.path.join(str(self._work_dir), f"{name}.rst7")
@@ -343,7 +343,7 @@ def _setup(self):
343343
zero_dummy_impropers=self._zero_dummy_impropers,
344344
property_map=self._property_map,
345345
perturbation_type=self._protocol.getPerturbationType(),
346-
no_dummy_modifications=self._no_dummy_modifications,
346+
dummy_modifications=self._dummy_modifications,
347347
)
348348

349349
self._input_files.append(self._pert_file)
@@ -926,7 +926,7 @@ def _to_pert_file(
926926
print_all_atoms=False,
927927
property_map={},
928928
perturbation_type="full",
929-
no_dummy_modifications=False,
929+
dummy_modifications=True,
930930
):
931931
"""
932932
Write a perturbation file for a perturbable molecule.
@@ -966,9 +966,10 @@ def _to_pert_file(
966966
"grow_soft" : Perturb all growing soft atom LJ terms (i.e. 0.0->value).
967967
"charge_soft" : Perturb all charging soft atom LJ terms (i.e. 0.0->value).
968968
969-
no_dummy_modifications : bool
970-
Whether to skip modifications to dummy atoms. This is useful when
971-
modifications to dummy atoms have already been applied.
969+
dummy_modifications : bool
970+
Whether to modify bonded interactions involving dummy atoms. It is
971+
useful to disable this when modifications to dummy atom terms have
972+
already been applied to the system externally.
972973
973974
Returns
974975
-------
@@ -1006,8 +1007,8 @@ def _to_pert_file(
10061007
if not isinstance(perturbation_type, str):
10071008
raise TypeError("'perturbation_type' must be of type 'str'")
10081009

1009-
if not isinstance(no_dummy_modifications, bool):
1010-
raise TypeError("'no_dummy_modifications' must be of type 'bool'")
1010+
if not isinstance(dummy_modifications, bool):
1011+
raise TypeError("'dummy_modifications' must be of type 'bool'")
10111012

10121013
# Convert to lower case and strip whitespace.
10131014
perturbation_type = perturbation_type.lower().replace(" ", "")
@@ -1985,8 +1986,8 @@ def sort_angles(angles, idx):
19851986
initial_dummy = _has_dummy(mol, [idx0, idx1, idx2])
19861987
final_dummy = _has_dummy(mol, [idx0, idx1, idx2], True)
19871988

1988-
# Modifications to dummy states.
1989-
if not no_dummy_modifications:
1989+
# Perform dummy modifications if required.
1990+
if dummy_modifications:
19901991
# Set the angle parameters of the dummy state to those of
19911992
# the non-dummy end state.
19921993
if initial_dummy and final_dummy:
@@ -2329,7 +2330,7 @@ def sort_dihedrals(dihedrals, idx):
23292330
all_dummy_final = all(_is_dummy(mol, [idx0, idx1, idx2, idx3], True))
23302331

23312332
# Perform dummy modifications if required.
2332-
if not no_dummy_modifications:
2333+
if dummy_modifications:
23332334
# Dummies are present in both end states, use null potentials.
23342335
if has_dummy_initial and has_dummy_final:
23352336
amber_dihedral0 = _SireMM.AmberDihedral()
@@ -2729,7 +2730,7 @@ def sort_dihedrals(dihedrals, idx):
27292730
all_dummy_final = all(_is_dummy(mol, [idx0, idx1, idx2, idx3], True))
27302731

27312732
# Perform dummy modifications if required.
2732-
if not no_dummy_modifications:
2733+
if dummy_modifications:
27332734
# Dummies are present in both end states, use null potentials.
27342735
if has_dummy_initial and has_dummy_final:
27352736
amber_dihedral0 = _SireMM.AmberDihedral()

0 commit comments

Comments
 (0)