mdtraj.reporters.DCDReporter

class mdtraj.reporters.DCDReporter(file, reportInterval, atomSubset=None)[source]

DCDReporter stores a molecular dynamics trajectory in the CHARMM / NAMD DCD Format

Parameters:
  • file (str, 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.

  • reportInterval (int) – The interval (in time steps) at which to write frames.

  • atomSubset (array_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()

Close the underlying trajectory file

describeNextReport(simulation)

Get information about the next report this object will generate.

report(simulation, state)

Generate a report.

__init__(file, reportInterval, atomSubset=None)[source]

Create an OpenMM reporter

Parameters:
  • file (str, or HDF5Trajectory) – Either an open HDF5Trajecory object to write to, or a string specifying the filename of a new HDF5 file

  • reportInterval (int) – The interval (in time steps) at which to write frames.

  • coordinates (bool, default=True) – Whether to write the coordinates to the file.

  • time (bool, default=True) – Whether to write the current time to the file.

  • cell (bool, default=True) – Whether to write the current unitcell dimensions to the file.

  • potentialEnergy (bool, default=True) – Whether to write the potential energy to the file.

  • kineticEnergy (bool, default=True) – Whether to write the kinetic energy to the file.

  • temperature (bool, default=True) – Whether to write the instantaneous temperature to the file.

  • velocities (bool, default=False) – Whether to write the velocities of each atom to the file

  • atomSubset (array_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__(file, reportInterval[, atomSubset])

Create an OpenMM reporter

close()

Close the underlying trajectory file

describeNextReport(simulation)

Get information about the next report this object will generate.

report(simulation, state)

Generate a report.

Attributes

backend