faunus
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Faunus::XTCReader Class Reference

Reads frames from an XTC file (GROMACS compressed trajectory file format). More...

#include <io.h>

Public Member Functions

 XTCReader (const std::string &filename)
 
int getNumberOfCoordinates ()
 Returns number of coordinates (atoms) in each frame. More...
 
bool read (TrajectoryFrame &frame)
 Reads the next frame in the trajectory from a file. More...
 
template<RequirePointIterator begin_iterator, typename end_iterator >
bool read (int &step, float &time, Point &box, begin_iterator coordinates_begin, end_iterator coordinates_end)
 Reads the next frame in the trajectory. More...
 

Public Attributes

std::string filename
 name of the trajectory file, mainly for error reporting
 

Protected Member Functions

bool readFrame ()
 Actual wrapper around C function that reads the next frame into xtc_frame. More...
 

Detailed Description

Reads frames from an XTC file (GROMACS compressed trajectory file format).

It is a wrapper around C function calls.

Frames are stored into a TrajectoryFrame structure or as a list of positions in an output iterator. The class is responsible for I/O operations, not data conversion. For details about data conversion XTCTrajectoryFrame.

Constructor & Destructor Documentation

◆ XTCReader()

Faunus::XTCReader::XTCReader ( const std::string &  filename)
explicit
Parameters
filenamea name of the XTC file to open

Member Function Documentation

◆ getNumberOfCoordinates()

int Faunus::XTCReader::getNumberOfCoordinates ( )

Returns number of coordinates (atoms) in each frame.

Immutable during object lifetime.

Returns
number of coordinates (atoms)

◆ read() [1/2]

bool Faunus::XTCReader::read ( TrajectoryFrame frame)

Reads the next frame in the trajectory from a file.

Parameters
[out]frametarget frame
Returns
true on success, false at the end of file
Exceptions
std::runtime_errorwhen other I/O error occures

◆ read() [2/2]

template<RequirePointIterator begin_iterator, typename end_iterator >
bool Faunus::XTCReader::read ( int &  step,
float &  time,
Point box,
begin_iterator  coordinates_begin,
end_iterator  coordinates_end 
)
inline

Reads the next frame in the trajectory.

Template Parameters
begin_iterator
end_iterator
Parameters
[out]stepframe step
[out]timeframe timestamp in picoseconds
[out]boxbox dimensions (xyz) in nanometers
[out]coordinates_beginoutput iterator to store coordinates
[out]coordinates_endoutput iterator's end
Returns
true on success, false at the end of file
Exceptions
std::runtime_errorwhen other I/O error occures

◆ readFrame()

bool Faunus::XTCReader::readFrame ( )
protected

Actual wrapper around C function that reads the next frame into xtc_frame.

Returns
true on success, false at the end of file
Exceptions
std::runtime_errorwhen other I/O error occures

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