diff --git a/python/BioSimSpace/Process/_openmm.py b/python/BioSimSpace/Process/_openmm.py index 0ae944f7d..fc0871637 100644 --- a/python/BioSimSpace/Process/_openmm.py +++ b/python/BioSimSpace/Process/_openmm.py @@ -2083,6 +2083,14 @@ def _add_config_reporters( is_time = True is_temperature = True + # Work out the total number of steps. + if isinstance(self._protocol, _Protocol.Minimisation): + total_steps = 1 + else: + total_steps = _math.ceil( + self._protocol.getRunTime() / self._protocol.getTimeStep() + ) + # Write state information to file every 100 steps. self.addToConfig(f"log_file = open('{self._name}.log', 'a')") self.addToConfig(f"simulation.reporters.append(StateDataReporter(log_file,") @@ -2109,7 +2117,7 @@ def _add_config_reporters( ) self.addToConfig(" volume=True,") self.addToConfig( - " totalSteps=True," + f" totalSteps={total_steps}," ) self.addToConfig(" speed=True,") self.addToConfig( diff --git a/python/BioSimSpace/Sandpit/Exscientia/Process/_openmm.py b/python/BioSimSpace/Sandpit/Exscientia/Process/_openmm.py index 338abb748..35b830b65 100644 --- a/python/BioSimSpace/Sandpit/Exscientia/Process/_openmm.py +++ b/python/BioSimSpace/Sandpit/Exscientia/Process/_openmm.py @@ -2123,6 +2123,14 @@ def _add_config_reporters( is_time = True is_temperature = True + # Work out the total number of steps. + if isinstance(self._protocol, _Protocol.Minimisation): + total_steps = 1 + else: + total_steps = _math.ceil( + self._protocol.getRunTime() / self._protocol.getTimeStep() + ) + # Write state information to file every 100 steps. self.addToConfig(f"log_file = open('{self._name}.log', 'a')") self.addToConfig(f"simulation.reporters.append(StateDataReporter(log_file,") @@ -2149,7 +2157,7 @@ def _add_config_reporters( ) self.addToConfig(" volume=True,") self.addToConfig( - " totalSteps=True," + f" totalSteps={total_steps}," ) self.addToConfig(" speed=True,") self.addToConfig(