LOOS  v2.3.2
loos::DCD Class Reference

Class for reading DCD files. More...

#include <dcd.hpp>

Inheritance diagram for loos::DCD:
Collaboration diagram for loos::DCD:


class  EndOfFile

Public Member Functions

 DCD (const std::string s)
 Begin reading from the file named s.
 DCD (const char *s)
 Begin reading from the file named s.
 DCD (std::istream &fs)
 Begin reading from the stream ifs.
std::string description () const
 Return a string describing trajectory format.
virtual uint natoms (void) const

of atoms per frame

virtual bool hasPeriodicBox (void) const
virtual GCoord periodicBox (void) const
 Returns the periodic box for the current frame/trajectory.
std::vector< std::string > titles (void) const
int icntrl (const int) const
void icntrl (const int, const int)
std::vector< double > crystalParams (void) const
bool hasCrystalParams (void) const
virtual float timestep (void) const
 Timestep per frame.
virtual uint nframes (void) const
 Number of frames in the trajectory.
std::vector< dcd_real > xcoords (void) const
 Return the raw coords...
std::vector< dcd_real > ycoords (void) const
 Return the raw coords...
std::vector< dcd_real > zcoords (void) const
 Return the raw coords...
unsigned int nsteps (void) const
float delta (void) const
int nsavc (void) const
int nfile (void) const
int nfixed (void) const
bool nativeFormat (void) const
 Returns true if the DCD file being read is in the native endian format.
virtual std::vector< GCoordcoords (void)
 Auto-interleave the coords into a vector of GCoord()'s. More...
std::vector< GCoordmappedCoords (const std::vector< int > &map)
 Interleave coords, selecting entries indexed by map.
virtual bool parseFrame (void)
 Parse a frame of the DCD.
- Public Member Functions inherited from loos::Trajectory
 Trajectory (const std::string &s)
 Automatically open the file named s.
 Trajectory (std::istream &fs)
 Open using the given stream...
bool rewind (void)
 Rewinds the readFrame() iterator.
void updateGroupCoords (AtomicGroup &g)
 Update the coordinates in an AtomicGroup with the current frame. More...
void seekNextFrame (void)
void seekFrame (const uint i)
bool readFrame (void)
 Reads the next frame in a trajectory, returning false if at the end.
bool readFrame (const int i)
 Reads a specific frame in a trajectory. More...

Static Public Member Functions

static pTraj create (const std::string &fname, const AtomicGroup &model)
static void setSuppression (const bool b)

Additional Inherited Members

- Protected Attributes inherited from loos::Trajectory
StreamWrapper ifs
bool cached_first
std::string _filename

Detailed Description

Class for reading DCD files.

Instantiating a DCD object with either a filename or an fstream only reads the header from the file, not any frames. When a frame is read, the x,y,z coordinates are stored internally in a vector. This must be copied out to the caller or used to update the coordinates for an AtomicGroup.


  • Does NOT support fixed atoms
  • Does NOT support velocity format
  • Reorders the crystal parameters (if present) so they are in a more sensible order (i.e. a, b, c, alpha, beta, gamma)
  • [Almost] everything returned is a copy
  • Endian detection is based on the expected size of the header

Definition at line 64 of file dcd.hpp.

Member Function Documentation

std::vector< GCoord > loos::DCD::coords ( void  )

Auto-interleave the coords into a vector of GCoord()'s.

This can be a pretty slow operation, so be careful.

Implements loos::Trajectory.

Definition at line 362 of file dcd.cpp.

bool loos::DCD::hasPeriodicBox ( void  ) const

Tests whether or not the given frame/trajectory has periodic boundary information. The presence of periodic box information does not necessarily indicate that said information has been read in yet. For example, the presence of crystal data is in the header so this can be detected before any frame is read, but the crystal data itself is only read when a frame is read in.

Implements loos::Trajectory.

Definition at line 43 of file dcd.cpp.

The documentation for this class was generated from the following files: