Skip to content

Commit

Permalink
MultiStateReporter use 0 for do not write
Browse files Browse the repository at this point in the history
  • Loading branch information
richardjgowers committed Jul 17, 2023
1 parent 4805553 commit 59ca4d5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions openmmtools/multistate/multistatereporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ class MultiStateReporter(object):
analysis_particle_indices : tuple of ints, Optional. Default: () (empty tuple)
If specified, it will serialize positions and velocities for the specified particles, at every iteration, in the
reporter storage (.nc) file. If empty, no positions or velocities will be stored in this file for any atoms.
position_interval : int or None, default 1
the frequency at which to write positions relative to analysis information
None would prevent information being written
velocity_interval : int or None, default 1
the frequency at which to write positions relative to analysis information
None would prevent information being written
position_interval : int, default 1
the frequency at which to write positions relative to analysis
information, 0 would prevent information being written
velocity_interval : int, default 1
the frequency at which to write positions relative to analysis
information, 0 would prevent information being written
Attributes
----------
Expand Down Expand Up @@ -216,10 +216,12 @@ def checkpoint_interval(self):

@property
def position_interval(self):
"""Interval relative to energies that positions are written at"""
return self._position_interval

@property
def velocity_interval(self):
"""Interval relative to energies that velocities are written at"""
return self._velocity_interval

def storage_exists(self, skip_size=False):
Expand Down Expand Up @@ -1673,10 +1675,10 @@ def _write_sampler_states_to_given_file(self, sampler_states: list, iteration: i
# write out pos/vel - if checkpointing,
# or if interval matches desired frequency
write_pos = (storage_file == 'checkpoint' or
(self._position_interval is not None
(self._position_interval != 0
and not (write_iteration % self._position_interval)))
write_vel = (storage_file == 'checkpoint' or
(self._velocity_interval is not None
(self._velocity_interval != 0
and not (write_iteration % self._velocity_interval)))

# Write the sampler state if we are on the checkpoint interval OR if told to ignore the interval
Expand Down

0 comments on commit 59ca4d5

Please sign in to comment.