LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
loos::TRR Class Reference

Class representing the GROMACS TRR trajectory files. More...

#include <trr.hpp>

Inheritance diagram for loos::TRR:
Inheritance graph
[legend]
Collaboration diagram for loos::TRR:
Collaboration graph
[legend]

Public Member Functions

 TRR (const std::string &s)
 
 TRR (const char *p)
 
 TRR (std::istream &is)
 
std::string description () const
 Return a string describing trajectory format.
 
uint natoms (void) const
 
float timestep (void) const
 
uint nframes (void) const
 Number of frames in the trajectory.
 
bool hasPeriodicBox (void) const
 
GCoord periodicBox (void) const
 Returns the periodic box for the current frame/trajectory.
 
std::vector< GCoordcoords (void) const
 Returns the current frames coordinates as a vector of GCoords.
 
std::vector< double > virial (void) const
 
std::vector< double > pressure (void) const
 
std::vector< GCoordforces (void) const
 
bool isDouble (void) const
 
bool hasVirial (void) const
 
bool hasPressure (void) const
 
bool hasCoords (void) const
 
bool hasVelocities (void) const
 Whether or not the trajectory format supports velocities.
 
bool hasForces (void) const
 
double time (void) const
 
double lambda (void) const
 
int step (void) const
 
bool parseFrame (void)
 Parse an actual frame.
 
- 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...
 
 Trajectory (const Trajectory &t)
 
virtual std::string filename () const
 Return the stored filename.
 
virtual double velocityConversionFactor () const
 Conversion applied to velocities to get to \AA/ps.
 
bool rewind (void)
 Rewinds the readFrame() iterator.
 
void updateGroupCoords (AtomicGroup &g)
 Update the coordinates in an AtomicGroup with the current frame.
 
virtual std::vector< GCoordvelocities (void) const
 Returns the current frame's velocities as a vector of GCoords.
 
void updateGroupVelocities (AtomicGroup &g)
 
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.
 
bool atEnd () const
 
uint currentFrame () const
 

Static Public Member Functions

static pTraj create (const std::string &fname, const AtomicGroup &model)
 

Additional Inherited Members

- Public Types inherited from loos::Trajectory
typedef boost::shared_ptr< std::istream > pStream
 
- Protected Member Functions inherited from loos::Trajectory
void setInputStream (const std::string &fname)
 
void setInputStream (std::istream &fs)
 
- Protected Attributes inherited from loos::Trajectory
pStream ifs
 
bool cached_first
 
std::string _filename
 
uint _current_frame
 

Detailed Description

Class representing the GROMACS TRR trajectory files.

The TRR format can technically have differing numbers of atoms or even components (ie coords, velocities, forces) per frame. This is supported by LOOS, to an extent. If the components vary, then so long as there are coordinates, there should be no problem. If the number of atoms vary and you're using the updateGroupCoords() function, then care must be taken that the group matches the frame. Recall that the atomids are actually indices into the trajectory frame (ie atomid 1 takes its coords from the first trajectory coordinate, etc).

The TRR format can be written in either a single or double precision format. Internally, LOOS will read in either and translate it into whatever the default size is for LOOS (ie GCoord, which by default is a double). Metadata, such as lambda, or box sizes, are always upconverted to double by LOOS.

Since the TRR frame size is not fixed, the entire trajectory will be quickly scanned to build up an index of where the frames begin (see the loos::XTC class for more information).

Finally, note that GROMACS stores data in nm whereas LOOS uses angstroms, so coordinate/box data will be automatically scaled by LOOS.

Member Function Documentation

◆ coords()

std::vector< GCoord > loos::TRR::coords ( void ) const
inlinevirtual

Returns the current frames coordinates as a vector of GCoords.

Some formats, notably DCDs, do not interleave their coordinates. This means that this could be a potentially expensive operation.

Implements loos::Trajectory.

◆ description()

std::string loos::TRR::description ( ) const
inlinevirtual

Return a string describing trajectory format.

Reimplemented from loos::Trajectory.

◆ hasPeriodicBox()

bool loos::TRR::hasPeriodicBox ( void ) const
inlinevirtual

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.

◆ hasVelocities()

bool loos::TRR::hasVelocities ( void ) const
inlinevirtual

Whether or not the trajectory format supports velocities.

Reimplemented from loos::Trajectory.

◆ natoms()

uint loos::TRR::natoms ( void ) const
inlinevirtual

of atoms per frame

Implements loos::Trajectory.

◆ nframes()

uint loos::TRR::nframes ( void ) const
inlinevirtual

Number of frames in the trajectory.

Implements loos::Trajectory.

◆ parseFrame()

bool loos::TRR::parseFrame ( void )
inlinevirtual

Parse an actual frame.

parseFrame() is expected to read in a frame through the Trajectory's StreamWrapper. It returns a bool indicating whether or not it was able to actually read a frame (i.e. false indicates EOF).

Implements loos::Trajectory.

◆ periodicBox()

GCoord loos::TRR::periodicBox ( void ) const
inlinevirtual

Returns the periodic box for the current frame/trajectory.

Implements loos::Trajectory.

◆ timestep()

float loos::TRR::timestep ( void ) const
inlinevirtual

GROMACS trajectories do not define a timestep value as DCD does

Implements loos::Trajectory.


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