mdtraj.reporters.DCDReporter

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

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)

Methods

__init__(file, reportInterval[, atomSubset])
close() Close the underlying trajectory file
describeNextReport(simulation) Get information about the next report this object will generate.
report(simulation, state) Generate a report.
close()

Close the underlying trajectory file

describeNextReport(simulation)

Get information about the next report this object will generate.

Parameters:

simulation : simtk.openmm.app.Simulation

The Simulation to generate a report for

Returns:

report_description : tuple

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(simulation, state)

Generate a report.

Parameters:

simulation : simtk.openmm.app.Simulation

The Simulation to generate a report for

state : simtk.openmm.State

The current state of the simulation