Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

DCDFile Class Reference
[Molecular Dynamics Trajectory File Formats]

DCD Trajectory file format. More...

#include <DCDFile.h>

Inheritance diagram for DCDFile:

TrajectoryFile File List of all members.

Public Member Functions

Constructors and Destructor
 DCDFile () throw ()
 Default constructor.
 DCDFile (const DCDFile &file) throw (Exception::FileNotFound)
 Copy constructor.
 DCDFile (const String &name, File::OpenMode open_mode=std::ios::in) throw (Exception::FileNotFound)
 Detailed constructor.
virtual ~DCDFile () throw ()
 Destructor.
Assignment
const DCDFileoperator= (const DCDFile &file) throw ()
 Assignment operator.
virtual void clear () throw ()
 Clear method.
Predicates
bool operator== (const DCDFile &file) const throw ()
 Equality operator.
bool isSwappingBytes () const throw ()
bool hasVelocities () const throw ()
Public methods for file handling
virtual bool open (const String &name, File::OpenMode open_mode=std::ios::in) throw (Exception::FileNotFound)
 open a DCDFile
bool init () throw ()
 Initialize this instance, i.
virtual bool readHeader () throw ()
 Read the header of an existing file.
virtual bool writeHeader () throw ()
 Write a header Return true if the header could be written successfully, false ow.
virtual bool seekAndWriteHeader () throw ()
virtual bool append (const SnapShot &snapshot) throw ()
 Append a SnapShot to an existing file.
virtual bool read (SnapShot &snapshot) throw ()
 Read the next snapshot from the file.
virtual bool flushToDisk (const std::vector< SnapShot > &buffer) throw (File::CannotWrite)
 Write several SnapShots to disk.
Accessors
void enableVelocityStorage () throw ()
void disableVelocityStorage () throw ()

Protected Member Functions

void writeSize_ (const Size &data) throw ()
void writeFloat_ (const float &data) throw ()
void writeVector_ (const vector< Vector3 > &v) throw ()
float readFloat_ () throw ()
Size readSize_ () throw ()
bool readSize_ (Size expected_size, const String &what) throw ()
bool readVector_ (vector< Vector3 > &v) throw ()

Protected Attributes

Size verbosity_
bool swap_bytes_
bool has_velocities_
bool charmm_extra_block_A_
bool charmm_extra_block_B_
String CORD_
Size step_number_of_starting_time_
Size steps_between_saves_
double time_step_length_
Size number_of_comments_
Position current_snapshot_
BinaryFileAdaptor< Sizeadapt_size_
BinaryFileAdaptor< float > adapt_float_

Detailed Description

DCD Trajectory file format.

This class enables BALL to write DCD files that can be read by VMD. The format stems from the xplor package. This format is NOT portable.

The header is described in the documentation for the nested DCDHeader class.
Header of a DCD file: Got this description from http://www.arl.hpc.mil/PET/cta/ccm/software/fmd/Docs/html/fmd_ug.html. Quote: "The exact format of these files is quite ugly, as it reproduces the binary record format of unformatted FORTRAN files. Each such "record" begins with 4 bytes containing the integer value of the number of bytes in the following record. It ends with a record containing the same 4 bytes."
The header consists of several blocks. Each block starts and ends with the number of bytes enclosed between those numbers, i. e. a block consisting of 8 bytes starts with the number 8 followed by 8 bytes of data and ends with the number 8.
TODO: complete header description


Member Function Documentation

virtual bool DCDFile::append const SnapShot snapshot  )  throw () [virtual]
 

Append a SnapShot to an existing file.

Note that this method does not update the header.

Parameters:
snapshot the snapshot we want to save
Returns:
true, if writing was successful

Reimplemented from TrajectoryFile.

virtual bool DCDFile::flushToDisk const std::vector< SnapShot > &  buffer  )  throw (File::CannotWrite) [virtual]
 

Write several SnapShots to disk.

Parameters:
buffer a vector of snapshots
Returns:
true, if flushing was successful, false ow.

Reimplemented from TrajectoryFile.

bool DCDFile::init  )  throw ()
 

Initialize this instance, i.

e. read the header and update members

virtual bool DCDFile::read SnapShot snapshot  )  throw () [virtual]
 

Read the next snapshot from the file.

Parameters:
snapshot a buffer for result delivery
Returns:
true, if a snapshot could be read, false ow.

Reimplemented from TrajectoryFile.

virtual bool DCDFile::readHeader  )  throw () [virtual]
 

Read the header of an existing file.

Return true if the header could be read successfully, false ow.

Reimplemented from TrajectoryFile.

virtual bool DCDFile::writeHeader  )  throw () [virtual]
 

Write a header Return true if the header could be written successfully, false ow.

Reimplemented from TrajectoryFile.