Skip to content

Commit

Permalink
Merge pull request #147 from OpenBioSim/backport_146
Browse files Browse the repository at this point in the history
Backport fix from PR #146
  • Loading branch information
lohedges authored Aug 1, 2023
2 parents 60e0884 + bbe3dea commit 058e702
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion python/BioSimSpace/Process/_openmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,")
Expand All @@ -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(
Expand Down
10 changes: 9 additions & 1 deletion python/BioSimSpace/Sandpit/Exscientia/Process/_openmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,")
Expand All @@ -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(
Expand Down

0 comments on commit 058e702

Please sign in to comment.