mdtraj.reporters.NetCDFReporter¶
-
class
mdtraj.reporters.
NetCDFReporter
(file, reportInterval, coordinates=True, time=True, cell=True, atomSubset=None)¶ NetCDFReporter stores a molecular dynamics trajectory in the AMBER NetCDF format.
- Parameters
- filestr, or NetCDFTrajectoryFile
Either an open NetCDFTrajectoryFile object to write to, or a string specifying the filename of a new NetCDF file
- reportIntervalint
The interval (in time steps) at which to write frames.
- coordinatesbool
Whether to write the coordinates to the file.
- timebool
Whether to write the current time to the file.
- cellbool
Whether to write the current unitcell dimensions to the file.
- atomSubsetarray_like, default=None
Only write a subset of the atoms, with these (zero based) indices to the file. If None, all of the atoms will be written.
Examples
>>> simulation = Simulation(topology, system, integrator) >>> nc_reporter = NetCDFReporter('traj.h5', 100) >>> simulation.reporters.append(nc_reporter) >>> simulation.step(10000)
>>> traj = mdtraj.trajectory.load('traj.nc')
- Attributes
- backend
Methods
close
(self)Close the underlying trajectory file
describeNextReport
(self, simulation)Get information about the next report this object will generate.
report
(self, simulation, state)Generate a report.
-
__init__
(self, file, reportInterval, coordinates=True, time=True, cell=True, atomSubset=None)¶ Create a NetCDFReporter.
Methods
__init__
(self, file, reportInterval[, …])Create a NetCDFReporter.
close
(self)Close the underlying trajectory file
describeNextReport
(self, simulation)Get information about the next report this object will generate.
report
(self, simulation, state)Generate a report.
Attributes
backend