mdtraj.reporters.DCDReporter¶
-
class
mdtraj.reporters.
DCDReporter
(file, reportInterval, atomSubset=None)¶ DCDReporter stores a molecular dynamics trajectory in the CHARMM / NAMD DCD Format
- Parameters
- filestr, or DCDTrajectoryFile
Either an open DCDTrajectoryFile object to write to, or a string specifying the filename of a new DCD file to save the trajectory to.
- reportIntervalint
The interval (in time steps) at which to write frames.
- 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 to disk.
Examples
>>> simulation = Simulation(topology, system, integrator) >>> dcd_reporter = DCDReporter('traj.dcd', 100) >>> simulation.reporters.append(dcd_reporter) >>> simulation.step(10000)
>>> traj = mdtraj.trajectory.load('traj.dcd')
- 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, atomSubset=None)¶ Create an OpenMM reporter
- Parameters
- filestr, or HDF5Trajectory
Either an open HDF5Trajecory object to write to, or a string specifying the filename of a new HDF5 file
- reportIntervalint
The interval (in time steps) at which to write frames.
- coordinatesbool, default=True
Whether to write the coordinates to the file.
- timebool, default=True
Whether to write the current time to the file.
- cellbool, default=True
Whether to write the current unitcell dimensions to the file.
- potentialEnergybool, default=True
Whether to write the potential energy to the file.
- kineticEnergybool, default=True
Whether to write the kinetic energy to the file.
- temperaturebool, default=True
Whether to write the instantaneous temperature to the file.
- velocitiesbool, default=False
Whether to write the velocities of each atom 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.
Notes
If you use the atomSubset option to write only a subset of the atoms to disk, the kineticEnergy, potentialEnergy, and temperature fields will not change. They will still refer to the energy and temperature of the whole system, and are not “subsetted” to only include the energy of your subsystem.
Methods
__init__
(self, file, reportInterval[, …])Create an OpenMM reporter
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
-
close
(self)¶ Close the underlying trajectory file
-
describeNextReport
(self, simulation)¶ Get information about the next report this object will generate.
- Parameters
- simulationsimtk.openmm.app.Simulation
The Simulation to generate a report for
- Returns
- report_descriptiontuple
A five element tuple. The first element is the number of steps until the next report. The remaining elements specify whether that report will require positions, velocities, forces, and energies respectively.
-
report
(self, simulation, state)¶ Generate a report.
- Parameters
- simulationsimtk.openmm.app.Simulation
The Simulation to generate a report for
- statesimtk.openmm.State
The current state of the simulation