Skip to content

Commit e5a3f00

Browse files
authored
Merge pull request #135 from OpenBioSim/feature_taylor
Expose Taylor softcore options and pass through to Loch
2 parents fc897fe + 038b550 commit e5a3f00

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/somd2/config/_config.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def __init__(
151151
rest2_scale=1.0,
152152
rest2_selection=None,
153153
softcore_form="zacharias",
154+
taylor_power=1,
154155
output_directory="output",
155156
restart=False,
156157
use_backup=False,
@@ -438,6 +439,11 @@ def __init__(
438439
The soft-core potential form to use for alchemical interactions. This can be
439440
either "zacharias" or "taylor". The default is "zacharias".
440441
442+
taylor_power: int
443+
The power to use for the alpha term in the Taylor soft-core LJ expression,
444+
i.e. sig6 = sigma^6 / (alpha^m * sigma^6 + r^6). Must be between 0 and 4.
445+
The default is 1. Only used when softcore_form is "taylor".
446+
441447
output_directory: str
442448
Path to a directory to store output files.
443449
@@ -567,6 +573,7 @@ def __init__(
567573
self.restart = restart
568574
self.use_backup = use_backup
569575
self.softcore_form = softcore_form
576+
self.taylor_power = taylor_power
570577
self.somd1_compatibility = somd1_compatibility
571578
self.pert_file = pert_file
572579
self.save_crash_report = save_crash_report
@@ -2204,6 +2211,21 @@ def softcore_form(self, softcore_form):
22042211
else:
22052212
self._softcore_form = softcore_form
22062213

2214+
@property
2215+
def taylor_power(self):
2216+
return self._taylor_power
2217+
2218+
@taylor_power.setter
2219+
def taylor_power(self, taylor_power):
2220+
if not isinstance(taylor_power, int):
2221+
try:
2222+
taylor_power = int(taylor_power)
2223+
except Exception:
2224+
raise ValueError("'taylor_power' must be of type 'int'")
2225+
if not 0 <= taylor_power <= 4:
2226+
raise ValueError("'taylor_power' must be between 0 and 4")
2227+
self._taylor_power = taylor_power
2228+
22072229
@property
22082230
def use_backup(self):
22092231
return self._use_backup

src/somd2/runner/_base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ def __init__(self, system, config):
209209
# If specified, use the Taylor soft-core form.
210210
if self._config.softcore_form == "taylor":
211211
self._config._extra_args["use_taylor_softening"] = True
212+
self._config._extra_args["taylor_power"] = self._config.taylor_power
212213

213214
# We're running in SOMD1 compatibility mode.
214215
if self._config.somd1_compatibility:
@@ -769,6 +770,8 @@ def __init__(self, system, config):
769770
"radius": str(self._config.gcmc_radius),
770771
"reference": self._config.gcmc_selection,
771772
"restart": self._is_restart,
773+
"softcore_form": self._config.softcore_form,
774+
"taylor_power": self._config.taylor_power,
772775
"standard_volume": str(self._config.gcmc_standard_volume),
773776
"tolerance": self._config.gcmc_tolerance,
774777
}

0 commit comments

Comments
 (0)