diff --git a/python/BioSimSpace/Protocol/_equilibration.py b/python/BioSimSpace/Protocol/_equilibration.py index c42b9571..aac74933 100644 --- a/python/BioSimSpace/Protocol/_equilibration.py +++ b/python/BioSimSpace/Protocol/_equilibration.py @@ -50,6 +50,7 @@ def __init__( thermostat_time_constant=_Types.Time(1, "picosecond"), report_interval=200, restart_interval=1000, + restart=False, restraint=None, force_constant=10 * _Units.Energy.kcal_per_mol / _Units.Area.angstrom2, ): @@ -89,6 +90,9 @@ def __init__( The frequency at which restart configurations and trajectory frames are saved. (In integration steps.) + restart : bool + Whether this is a continuation of a previous simulation. + restraint : str, [int] The type of restraint to perform. This should be one of the following options: @@ -155,6 +159,9 @@ def __init__( # Set the restart interval. self.setRestartInterval(restart_interval) + # Set the restart flag. + self.setRestart(restart) + # Set the posistion restraint. _PositionRestraintMixin.__init__(self, restraint, force_constant) @@ -169,7 +176,7 @@ def _get_parm(self): f"thermostat_time_constant={self._thermostat_time_constant}, " f"report_interval={self._report_interval}, " f"restart_interval={self._restart_interval}, " - + _PositionRestraintMixin._get_parm(self) + f"restart={self._restart}, " + _PositionRestraintMixin._get_parm(self) ) def __str__(self): @@ -204,6 +211,7 @@ def __eq__(self, other): and self._thermostat_time_constant == other._thermostat_time_constant and self._report_interval == other._report_interval and self._restart_interval == other._restart_interval + and self._restart == other._restart and _PositionRestraintMixin.__eq__(self, other) ) @@ -484,6 +492,34 @@ def setRestartInterval(self, restart_interval): self._restart_interval = restart_interval + def isRestart(self): + """ + Return whether this restart simulation. + + Returns + ------- + + is_restart : bool + Whether this is a restart simulation. + """ + return self._restart + + def setRestart(self, restart): + """ + Set the restart flag. + + Parameters + ---------- + + restart : bool + Whether this is a restart simulation. + """ + if isinstance(restart, bool): + self._restart = restart + else: + _warnings.warn("Non-boolean restart flag. Defaulting to False!") + self._restart = False + def isConstantTemp(self): """ Return whether the protocol has a constant temperature. diff --git a/python/BioSimSpace/Protocol/_free_energy_equilibration.py b/python/BioSimSpace/Protocol/_free_energy_equilibration.py index 6a2326a9..57fdad8d 100644 --- a/python/BioSimSpace/Protocol/_free_energy_equilibration.py +++ b/python/BioSimSpace/Protocol/_free_energy_equilibration.py @@ -52,6 +52,7 @@ def __init__( thermostat_time_constant=_Types.Time(1, "picosecond"), report_interval=200, restart_interval=1000, + restart=False, restraint=None, force_constant=10 * _Units.Energy.kcal_per_mol / _Units.Area.angstrom2, perturbation_type="full", @@ -106,6 +107,9 @@ def __init__( The frequency at which restart configurations and trajectory frames are saved. (In integration steps.) + restart : bool + Whether this is a continuation of a previous simulation. + restraint : str, [int] The type of restraint to perform. This should be one of the following options: @@ -217,4 +221,5 @@ def _to_regular_protocol(self): restart_interval=self.getRestartInterval(), restraint=self.getRestraint(), force_constant=self.getForceConstant(), + restart=self.isRestart(), )