31#if !defined(LOOS_XTC_HPP)
39#include <loos_defs.hpp>
43#include <AtomicGroup.hpp>
44#include <Trajectory.hpp>
46#include <boost/format.hpp>
64 static const uint min_compressed_system_size;
75 static const int magicints[];
76 static const int firstidx, lastidx;
78 static const int magic;
85 explicit XTC(
const std::string& s) :
Trajectory(s), xdr_file(ifs.get()),natoms_(0) {
89 explicit XTC(std::istream& is) :
Trajectory(is), xdr_file(ifs.get()), natoms_(0) {
93 std::string
description()
const {
return(
"Gromacs XTC (compressed trajectory)"); }
94 static pTraj create(
const std::string& fname,
const AtomicGroup& model) {
95 return(pTraj(
new XTC(fname)));
98 uint
natoms(
void)
const {
return(natoms_); }
99 float timestep(
void)
const {
return(timestep_); }
100 uint
nframes(
void)
const {
return(frame_indices.size()); }
104 uint currentStep(
void)
const {
return(current_header_.step); }
105 double currentTime(
void)
const {
return(current_header_.time); }
108 std::vector<GCoord>
coords(
void)
const {
return(coords_); }
117 coords_.reserve(natoms_);
119 throw(
FileReadError(_filename,
"Unable to read in the first frame"));
123 internal::XDRReader xdr_file;
124 std::vector<size_t> frame_indices;
128 std::vector<GCoord> coords_;
132 bool parseFrame(
void);
137 int sizeofints(uint*,
const uint);
138 int decodebits(
int*, uint);
139 void decodeints(
int*,
const int,
int, uint*,
int*);
140 bool readFrameHeader(
Header&);
141 void scanFrames(
void);
143 void seekNextFrameImpl(
void) { }
144 void seekFrameImpl(uint);
145 void rewindImpl(
void) { ifs->clear(); ifs->seekg(0); }
146 void updateGroupCoordsImpl(AtomicGroup& g);
147 bool readCompressedCoords(
void);
148 bool readUncompressedCoords(
void);
Class for handling groups of Atoms (pAtoms, actually)
Definition AtomicGroup.hpp:108
Errors that occur while reading a file.
Definition exceptions.hpp:185
Base-class for polymorphic trajectories.
Definition Trajectory.hpp:65
Class representing GROMACS reduced precision, compressed trajectories.
Definition xtc.hpp:61
bool hasPeriodicBox(void) const
Definition xtc.hpp:101
uint natoms(void) const
Definition xtc.hpp:98
std::vector< GCoord > coords(void) const
Returns the current frames coordinates as a vector of GCoords.
Definition xtc.hpp:108
std::string description() const
Return a string describing trajectory format.
Definition xtc.hpp:93
GCoord periodicBox(void) const
Returns the periodic box for the current frame/trajectory.
Definition xtc.hpp:102
double precision(void) const
Return the stored file's precision.
Definition xtc.hpp:111
float timestep(void) const
Timestep per frame.
Definition xtc.hpp:99
uint nframes(void) const
Number of frames in the trajectory.
Definition xtc.hpp:100
Namespace for most things not already encapsulated within a class.
Definition version.cpp:3