24#if !defined(LOOS_DCD_HPP)
33#include <loos_defs.hpp>
35#include <Trajectory.hpp>
64 static bool suppress_warnings;
68 typedef union {
unsigned int ui;
int i;
char c[4];
float f; } DataOverlay;
77 explicit DCD(
const std::string s) :
Trajectory(s), _natoms(0), _nframes(0),
78 qcrys(std::vector<double>(6)),
79 frame_size(0), first_frame_pos(0),
80 swabbing(false) { initTrajectory(); }
84 qcrys(std::vector<double>(6)), frame_size(0),
85 first_frame_pos(0), swabbing(false) { initTrajectory(); }
88 explicit DCD(std::istream& fs) :
Trajectory(fs), _natoms(0), _nframes(0),
89 qcrys(std::vector<double>(6)), frame_size(0), first_frame_pos(0),
90 swabbing(false) { initTrajectory(); };
92 std::string
description()
const {
return(
"CHARMM/NAMD DCD"); }
94 static pTraj create(
const std::string& fname,
const AtomicGroup& model) {
95 return(pTraj(
new DCD(fname)));
102 virtual uint
natoms(
void)
const;
109 std::vector<std::string> titles(
void)
const;
111 int icntrl(
const int)
const;
112 void icntrl(
const int,
const int);
115 std::vector<double> crystalParams(
void)
const;
116 bool hasCrystalParams(
void)
const;
119 virtual uint
nframes(
void)
const;
122 std::vector<dcd_real>
xcoords(
void)
const;
124 std::vector<dcd_real>
ycoords(
void)
const;
126 std::vector<dcd_real>
zcoords(
void)
const;
129 unsigned int nsteps(
void)
const;
130 float delta(
void)
const;
131 int nsavc(
void)
const;
132 int nfile(
void)
const;
133 int nfixed(
void)
const;
140 virtual std::vector<GCoord>
coords(
void)
const;
144 std::vector<GCoord>
mappedCoords(
const std::vector<int>& map);
148 static void setSuppression(
const bool b) { suppress_warnings = b; }
156 void readHeader(
void);
158 void initTrajectory();
160 uint calculateNumberOfFrames();
163 virtual void seekNextFrameImpl(
void) { }
165 virtual void seekFrameImpl(
const uint);
168 virtual void rewindImpl(
void);
171 virtual void updateGroupCoordsImpl(AtomicGroup& g);
175 void allocateSpace(
const int n);
176 bool readCrystalParams(
void);
177 bool readCoordLine(std::vector<float>& v);
179 void endianMatch(pStream& fsw);
182 unsigned int readRecordLen(
void);
183 DataOverlay* readF77Line(
unsigned int *len);
191 std::vector<std::string> _titles;
192 std::vector<double> qcrys;
195 std::streamoff frame_size;
196 std::streampos first_frame_pos;
200 std::vector<dcd_real> xcrds, ycrds, zcrds;
Class for handling groups of Atoms (pAtoms, actually)
Definition AtomicGroup.hpp:108
Class for reading DCD files.
Definition dcd.hpp:63
DCD(std::istream &fs)
Begin reading from the stream ifs.
Definition dcd.hpp:88
virtual bool hasPeriodicBox(void) const
Definition dcd.cpp:43
virtual uint nframes(void) const
Number of frames in the trajectory.
Definition dcd.cpp:60
std::vector< dcd_real > zcoords(void) const
Return the raw coords...
Definition dcd.cpp:64
virtual bool parseFrame(void)
Parse a frame of the DCD.
Definition dcd.cpp:349
virtual double velocityConversionFactor() const
Conversion applied to velocities to get to \AA/ps.
Definition dcd.hpp:107
std::vector< dcd_real > xcoords(void) const
Return the raw coords...
Definition dcd.cpp:62
DCD(const char *s)
Begin reading from the file named s.
Definition dcd.hpp:83
virtual GCoord periodicBox(void) const
Returns the periodic box for the current frame/trajectory.
Definition dcd.cpp:44
std::string description() const
Return a string describing trajectory format.
Definition dcd.hpp:92
bool nativeFormat(void) const
Returns true if the DCD file being read is in the native endian format.
Definition dcd.cpp:73
std::vector< dcd_real > ycoords(void) const
Return the raw coords...
Definition dcd.cpp:63
std::vector< GCoord > mappedCoords(const std::vector< int > &map)
Interleave coords, selecting entries indexed by map.
Definition dcd.cpp:397
virtual std::vector< GCoord > coords(void) const
Auto-interleave the coords into a vector of GCoord()'s.
Definition dcd.cpp:385
virtual uint natoms(void) const
Definition dcd.cpp:42
virtual float timestep(void) const
Timestep per frame.
Definition dcd.cpp:59
DCD(const std::string s)
Begin reading from the file named s.
Definition dcd.hpp:77
virtual bool hasVelocities() const
Whether or not the trajectory format supports velocities.
Definition dcd.hpp:106
Generic LOOS exception.
Definition exceptions.hpp:40
Base-class for polymorphic trajectories.
Definition Trajectory.hpp:65
Namespace for most things not already encapsulated within a class.
Definition version.cpp:3