DCDFile

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

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, append=False)

Create a DCD file and write out the header, or open an existing file to append.

Parameters:
  • 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
  • append (bool=False) – If True, open an existing DCD file to append to. If False, create a new file.

Methods

__init__(file, topology, dt[, firstStep, ...]) Create a DCD file and write out the header, or open an existing file to append.
writeModel(positions[, unitCellDimensions, ...]) Write out a model to the DCD file.
__delattr__

x.__delattr__(‘name’) <==> del x.name

__format__()

default object formatter

__getattribute__

x.__getattribute__(‘name’) <==> x.name

__hash__
__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__
__setattr__

x.__setattr__(‘name’, value) <==> x.name = value

__sizeof__() → int

size of object in memory, in bytes

__str__
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.

Parameters:
  • 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.