class simtk.openmm.app.dcdfile.DCDFile(file, topology, dt, firstStep=0, interval=1)

DCDFile provides methods for creating DCD files.

DCD is a file format for storing simulation trajectories. It is supported by many programs, such as CHARMM, NAMD, and X-PLOR. Note, however, that different programs produce subtly different versions of the format. This class generates the CHARMM version. Also note that there is no standard byte ordering (big-endian or little-endian) for this format. This class always generates files with little-endian ordering.

To use this class, create a DCDFile object, then call writeModel() once for each model in the file.

__init__(file, topology, dt, firstStep=0, interval=1)

Create a DCD file and write out the header.

  • file (file) – A file to write to
  • topology (Topology) – The Topology defining the molecular system being written
  • dt (time) – The time step used in the trajectory
  • firstStep (int=0) – The index of the first step in the trajectory
  • interval (int=1) – The frequency (measured in time steps) at which states are written to the trajectory


__init__(file, topology, dt[, firstStep, ...]) Create a DCD file and write out the header.
writeModel(positions[, unitCellDimensions, ...]) Write out a model to the DCD file.
writeModel(positions, unitCellDimensions=None, periodicBoxVectors=None)

Write out a model to the DCD file.

The periodic box can be specified either by the unit cell dimensions (for a rectangular box), or the full set of box vectors (for an arbitrary triclinic box). If neither is specified, the box vectors specified in the Topology will be used. Regardless of the value specified, no dimensions will be written if the Topology does not represent a periodic system.

  • positions (list) – The list of atomic positions to write
  • unitCellDimensions (Vec3=None) – The dimensions of the crystallographic unit cell.
  • periodicBoxVectors (tuple of Vec3=None) – The vectors defining the periodic box.