Loading...
Searching...
No Matches
BALL::TRRFile Class Reference
Molecular Modeling » File Formats » Molecular Dynamics Trajectory File Formats

`#include <BALL/FORMAT/TRRFile.h>`

Inheritance diagram for BALL::TRRFile:

## Classes

class | TRRHeader

## Public Member Functions

Constructors and Destructor
| TRRFile ()
| Default constructor.
| TRRFile (const String &name, File::OpenMode open_mode=std::ios::in)
| Construct and open a file.
virtual | ~TRRFile ()
| Destructor.
Assignment
virtual void | clear ()
| Clear method.
Predicates
bool | operator== (const TRRFile &file) const
| Equality operator.
Public methods for file handling
virtual bool | init ()
| Initialize the file for usage.
virtual bool | readHeader ()
virtual bool | writeNextHeader (const TRRHeader &header)
virtual bool | readNextHeader (TRRHeader &header)
virtual bool | append (const SnapShot &snapshot)
virtual bool | read (SnapShot &snapshot)
virtual bool | skipFrame ()
virtual Size | getNumberOfSnapShots ()
virtual TRRFile & | operator>> (SnapShotManager &ssm)
| Read the whole file into a SnapShotManager.
virtual bool | flushToDisk (const std::vector< SnapShot > &buffer)
Public Member Functions inherited from BALL::TrajectoryFile
| TrajectoryFile ()
| Default constructor.
| TrajectoryFile (const String &filename, File::OpenMode open_mode=std::ios::in)
virtual | ~TrajectoryFile ()
| Destructor.
bool | operator== (const TrajectoryFile &file) const
| Equality operator.
Size | getNumberOfAtoms () const
virtual bool | writeHeader ()
Public Member Functions inherited from BALL::File
| File ()
| File (const String &name, OpenMode open_mode=std::ios::in)
virtual | ~File ()
bool | isValid () const
bool | open (const String &name, File::OpenMode open_mode=std::ios::in)
bool | reopen ()
bool | reopen (File::OpenMode open_mode)
void | close ()
const String & | getName () const
void | setName (const String &name)
const String & | getOriginalName () const
Size | getSize ()
File::OpenMode | getOpenMode () const
Type | getType (bool trace_link) const
bool | copyTo (const String &destination_name, Size buffer_size=4096)
bool | moveTo (const String &destination_name)
bool | remove ()
bool | renameTo (const String &new_path)
bool | truncate (Size size=0)
std::fstream & | getFileStream ()
TransformationManager & | getTransformationManager ()
const TransformationManager & | getTransformationManager () const
bool | operator== (const File &file) const
bool | operator!= (const File &file) const
bool | isOpen () const
bool | isClosed () const
bool | isAccessible () const
bool | isCanonized () const
bool | isReadable () const
bool | isWritable () const
bool | isExecutable () const

## Static Public Attributes

static const double | to_angstrom
static const double | to_nanometer
Static Public Attributes inherited from BALL::File
static const OpenMode | MODE_IN
| Open for input (default).
static const OpenMode | MODE_OUT
| Open for output.
static const OpenMode | MODE_APP
| Append. Seek to end before each write operation.
static const OpenMode | MODE_BINARY
| Binary mode.
static const OpenMode | MODE_ATE
| Seek to end directly after opening.
static const OpenMode | MODE_TRUNC
| Truncate an existing file.
static const String | TRANSFORMATION_EXEC_PREFIX
| Prefix for filenames that are created through the execution of commands "exec:".
static const String | TRANSFORMATION_FILE_PREFIX
| Prefix for files (to mimick URL-like behavior) "file:".
static const String | TRANSFORMATION_FTP_PREFIX
| Prefix for FTP-transfers "ftp://".
static const String | TRANSFORMATION_HTTP_PREFIX
| Prefix for HTTP-transfer "http://".

## Accessors

TRRHeader | header_
Size | precision_
bool | has_velocities_
bool | has_forces_
Size | timestep_index_
float | timestep_
Vector3 | box1_
Vector3 | box2_
Vector3 | box3_
BinaryFileAdaptor< Size > | adapt_size_
BinaryFileAdaptor< char > | adapt_char_
BinaryFileAdaptor< float > | adapt_float_
BinaryFileAdaptor< double > | adapt_double_
Size | old_file_size_
bool | hasVelocities () const
void | setVelocityStorage (bool storage)
bool | hasForces () const
void | setForceStorage (bool storage)
Size | getPrecision () const
bool | setPrecision (const Size precision)
float | getTimestep () const
void | setTimestep (float timestep)
Vector3 | getBoundingBoxX () const
Vector3 | getBoundingBoxY () const
Vector3 | getBoundingBoxZ () const
void | setBoundingBox (const Vector3 &x, const Vector3 &y, const Vector3 &z)

## Additional Inherited Members

Public Types inherited from BALL::File
typedef std::ios::openmode | OpenMode
enum | Transformation { TRANSFORMATION__EXEC = 1 , TRANSFORMATION__FILTER = 2 , TRANSFORMATION__URL = 3 }
enum | Type { TYPE__UNKNOWN = 0 , TYPE__DIRECTORY = 1 , TYPE__CHAR_SPECIAL_FILE = 2 , TYPE__BLOCK_SPECIAL_FILE = 3 , TYPE__REGULAR_FILE = 4 , TYPE__SYMBOLIC_LINK = 5 , TYPE__SOCKET = 6 , TYPE__FIFO_SPECIAL_FILE = 7 }
static Size | getSize (String name)
static Type | getType (String name, bool trace_link)
static bool | copy (String source_name, String destination_name, Size buffer_size=4096)
static bool | move (const String &source_name, const String &destination_name)
static bool | remove (String name)
static bool | rename (String old_path, String new_path)
static bool | truncate (String path, Size size=0)
static bool | createTemporaryFilename (String &temporary, const String &suffix=".TMP")
static void | enableTransformation (Transformation transformation)
static void | disableTransformation (Transformation transformation)
static bool | isTransformationEnabled (Transformation transformation)
static void | registerTransformation (const String &pattern, const String &exec)
static void | unregisterTransformation (const String &pattern)
static bool | isAccessible (String name)
static bool | isReadable (String name)
static bool | isWritable (String name)
static bool | isExecutable (String name)
Size | number_of_snapshots_
Size | number_of_atoms_
String | name_
String | original_name_
OpenMode | open_mode_
bool | is_open_
bool | is_temporary_
static HashSet< String > | created_temp_filenames_
static TransformationManager | transformation_manager_
static Size | transformation_methods_

## Detailed Description

TRR Trajectory file format. This class enables BALL to read and write GROMACS TRR files. This format is portable.

  In a TRR file, each timestep is preceded by a header. The header is handled by the nested TRRHeader class.

Definition at line 28 of file TRRFile.h.

## Constructor & Destructor Documentation

## TRRFile() [1/2]

BALL::TRRFile::TRRFile | ( |  | ) |

Default constructor.

## TRRFile() [2/2]

BALL::TRRFile::TRRFile | ( | const String & | name,
|  | File::OpenMode | open_mode = std::ios::in )

Construct and open a file.

## ~TRRFile()

virtual BALL::TRRFile::~TRRFile | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## append()

virtual bool BALL::TRRFile::append | ( | const SnapShot & | snapshot | ) |

virtual

Append a SnapShot to an existing file

Parameters

  snapshot | the SnapShot we want to store

Returns
  true, if writing was successful

Reimplemented from BALL::TrajectoryFile.

## clear()

virtual void BALL::TRRFile::clear | ( |  | ) |

virtual

Clear method.

Reimplemented from BALL::TrajectoryFile.

## flushToDisk()

virtual bool BALL::TRRFile::flushToDisk | ( | const std::vector< SnapShot > & | buffer | ) |

virtual

Flush the SnapShot buffer to disk.

Exceptions

  File::CannotWrite | if writing to the file failed

Reimplemented from BALL::TrajectoryFile.

## getBoundingBoxX()

Vector3 BALL::TRRFile::getBoundingBoxX | ( |  | ) | const

## getBoundingBoxY()

Vector3 BALL::TRRFile::getBoundingBoxY | ( |  | ) | const

## getBoundingBoxZ()

Vector3 BALL::TRRFile::getBoundingBoxZ | ( |  | ) | const

## getNumberOfSnapShots()

virtual Size BALL::TRRFile::getNumberOfSnapShots | ( |  | ) |

virtual

get the number of snapshots stored in this instance.

Returns
  the number of snapshots of this instance

Reimplemented from BALL::TrajectoryFile.

## getPrecision()

Size BALL::TRRFile::getPrecision | ( |  | ) | const

## getTimestep()

float BALL::TRRFile::getTimestep | ( |  | ) | const

## hasForces()

bool BALL::TRRFile::hasForces | ( |  | ) | const

## hasVelocities()

bool BALL::TRRFile::hasVelocities | ( |  | ) | const

## init()

virtual bool BALL::TRRFile::init | ( |  | ) |

virtual

Initialize the file for usage.

## operator==()

bool BALL::TRRFile::operator== | ( | const TRRFile & | file | ) | const

Equality operator.

## operator>>()

virtual TRRFile & BALL::TRRFile::operator>> | ( | SnapShotManager & | ssm | ) |

virtual

Read the whole file into a SnapShotManager.

## read()

virtual bool BALL::TRRFile::read | ( | SnapShot & | snapshot | ) |

virtual

Read the next snapshot from the file

Parameters

  snapshot | a buffer for result delivery

Returns
  true, if a snapshot could be read, false otherwise.

Reimplemented from BALL::TrajectoryFile.

## readHeader()

virtual bool BALL::TRRFile::readHeader | ( |  | ) |

virtual

Read file header This function is actually a nop, since TRRFiles don't have file headers; it is only provided for interface reasons.

Reimplemented from BALL::TrajectoryFile.

## readNextHeader()

virtual bool BALL::TRRFile::readNextHeader | ( | TRRHeader & | header | ) |

virtual

Reads the next header preceding the next data block.

Parameters

  header | a buffer for result delivery

Returns
  true, if a header could be read, false ow.

## setBoundingBox()

void BALL::TRRFile::setBoundingBox | ( | const Vector3 & | x,
|  | const Vector3 & | y,
|  | const Vector3 & | z )

## setForceStorage()

void BALL::TRRFile::setForceStorage | ( | bool | storage | ) |

## setPrecision()

bool BALL::TRRFile::setPrecision | ( | const Size | precision | ) |

## setTimestep()

void BALL::TRRFile::setTimestep | ( | float | timestep | ) |

## setVelocityStorage()

void BALL::TRRFile::setVelocityStorage | ( | bool | storage | ) |

## skipFrame()

virtual bool BALL::TRRFile::skipFrame | ( |  | ) |

virtual

Skip the next snapshot in the file

Returns
  true, if a snapshot could be read, false otherwise.

## writeNextHeader()

virtual bool BALL::TRRFile::writeNextHeader | ( | const TRRHeader & | header | ) |

virtual

Writes the next header that shall preceed the next data block.

Parameters

  header | the TRRHeader we want to write

Returns
  true, if a header could be written, false ow.

## Member Data Documentation

## adapt_char_

BinaryFileAdaptor<char> BALL::TRRFile::adapt_char_

protected

Definition at line 315 of file TRRFile.h.

## adapt_double_

BinaryFileAdaptor<double> BALL::TRRFile::adapt_double_

protected

Definition at line 317 of file TRRFile.h.

## adapt_float_

BinaryFileAdaptor<float> BALL::TRRFile::adapt_float_

protected

Definition at line 316 of file TRRFile.h.

## adapt_size_

BinaryFileAdaptor<Size> BALL::TRRFile::adapt_size_

protected

Definition at line 314 of file TRRFile.h.

## box1_

Vector3 BALL::TRRFile::box1_

protected

Definition at line 312 of file TRRFile.h.

## box2_

Vector3 BALL::TRRFile::box2_

protected

Definition at line 312 of file TRRFile.h.

## box3_

Vector3 BALL::TRRFile::box3_

protected

Definition at line 312 of file TRRFile.h.

## has_forces_

bool BALL::TRRFile::has_forces_

protected

Definition at line 302 of file TRRFile.h.

## has_velocities_

bool BALL::TRRFile::has_velocities_

protected

Definition at line 299 of file TRRFile.h.

## header_

TRRHeader BALL::TRRFile::header_

protected

Definition at line 293 of file TRRFile.h.

## old_file_size_

Size BALL::TRRFile::old_file_size_

protected

Definition at line 319 of file TRRFile.h.

## precision_

Size BALL::TRRFile::precision_

protected

Definition at line 296 of file TRRFile.h.

## timestep_

float BALL::TRRFile::timestep_

protected

Definition at line 308 of file TRRFile.h.

## timestep_index_

Size BALL::TRRFile::timestep_index_

protected

Definition at line 305 of file TRRFile.h.

## to_angstrom

const double BALL::TRRFile::to_angstrom

static

Definition at line 33 of file TRRFile.h.

## to_nanometer

const double BALL::TRRFile::to_nanometer

static

Definition at line 34 of file TRRFile.h.