-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
Background
When doing a simulation restart, one might not always have on hand exactly how the reporter was initially created. In those cases, it would be good to be able to just pass the path to the storage & checkpoint files and have it read the relevant control parameters. This is something that is done with analysis_particle_indices and checkpoint_interval and therefore used to be true before the reporter was extended to have position_interval and velocity_interval.
The ask / task
We add position_interval and velocity_interval to the open code here:
openmmtools/openmmtools/multistate/multistatereporter.py
Lines 359 to 382 in 16b62a2
| if on_file_interval != self._checkpoint_interval: | |
| logger.debug("checkpoint_interval != on-file checkpoint interval! " | |
| "Using on file analysis interval of {}.".format(on_file_interval)) | |
| self._checkpoint_interval = on_file_interval | |
| # Check the special particle indices | |
| # Handle the "variable does not exist" case | |
| if 'analysis_particle_indices' not in self._storage_analysis.variables: | |
| n_particles = len(self._analysis_particle_indices) | |
| # This dimension won't exist if the above statement does not either | |
| self._storage_analysis.createDimension('analysis_particles', n_particles) | |
| ncvar_analysis_particles = \ | |
| self._storage_analysis.createVariable('analysis_particle_indices', int, 'analysis_particles') | |
| ncvar_analysis_particles[:] = self._analysis_particle_indices | |
| ncvar_analysis_particles.long_name = ("analysis_particle_indices[analysis_particles] is the indices of " | |
| "the particles with extra information stored about them in the" | |
| "analysis file.") | |
| # Now handle the "variable does exist but does not match the provided ones" | |
| # Although redundant if it was just created, its an easy check to make | |
| stored_analysis_particles = self._storage_analysis.variables['analysis_particle_indices'][:] | |
| if self._analysis_particle_indices != tuple(stored_analysis_particles.astype(int)): | |
| logger.debug("analysis_particle_indices != on-file analysis_particle_indices!" | |
| "Using on file analysis indices of {}".format(stored_analysis_particles)) | |
| self._analysis_particle_indices = tuple(stored_analysis_particles.astype(int)) |
Metadata
Metadata
Assignees
Labels
No labels