NetCDFReporter¶
- class mdhelper.openmm.reporter.NetCDFReporter(file: str, interval: int, append: bool = False, periodic: bool = None, *, velocities: bool = False, forces: bool = False, subset: slice | ndarray[int] | Topology = None)[source]¶
Bases:
object
A NetCDF trajectory reporter for OpenMM that can report velocities and forces in addition to time and coordinates for all particles in the simulation or just a subset.
- Parameters:
- filestr
Filename of NetCDF file to which the data is saved. If file does not have the
.nc
extension, it will automatically be appended.- intervalint
Interval (in timesteps) at which to write frames.
- appendbool, keyword-only, default:
False
If
True
, the existing NetCDF file is opened for data to be appended to. IfFalse
, a new NetCDF file is opened (and will clobber an existing file with the same name).- periodicbool, keyword-only, optional
Specifies whether particle positions should be translated so the center of every molecule lies in the same periodic box. If
None
(the default), it will automatically decide whether to translate molecules based on whether the system being simulated uses periodic boundary conditions.- velocitiesbool, keyword-only, default:
False
Specifies whether particle velocities should be written to file.
- forcesbool, keyword-only, default:
False
Specifies whether forces exerted on particles should be written to file.
- subsetslice, numpy.ndarray, or openmm.app.Topology, keyword-only, optional
Slice or array containing the indices of particles to report data for. If an OpenMM topology is provided instead, the indices are determined from the atoms found in the topology.
Methods
Get information about the next report this NetCDF reporter will generate.
Generate a report.
- describeNextReport(simulation: Simulation) tuple[int, bool, bool, bool, bool, bool] [source]¶
Get information about the next report this NetCDF reporter will generate.
- Parameters:
- simulationopenmm.app.Simulation
OpenMM simulation to generate a report for.
- Returns:
- reporttuple
A six-element tuple containing
the number of steps until the next report,
whether the report will require coordinates,
whether the report will require velocities,
whether the report will require forces,
whether the report will require energies, and
whether coordinates should be wrapped to lie in a single periodic box.
- report(simulation: Simulation, state: State) None [source]¶
Generate a report.
- Parameters:
- simulationopenmm.app.Simulation
OpenMM simulation to generate a report for.
- stateopenmm.State
Current OpenMM simulation state.