LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
mdtrajtraj.hpp
1/*
2 This file is part of LOOS.
3
4 LOOS (Lightweight Object-Oriented Structure library)
5 Copyright (c) 2008, Tod D. Romo, Alan Grossfield
6 Department of Biochemistry and Biophysics
7 School of Medicine & Dentistry, University of Rochester
8
9 This package (LOOS) is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation under version 3 of the License.
12
13 This package is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#if !defined(LOOS_MDTRAJ_TRAJ_HPP)
23#define LOOS_MDTRAJ_TRAJ_HPP
24
25
26#include <string>
27
28#include <loos_defs.hpp>
29#include <Coord.hpp>
30#include <Trajectory.hpp>
31
32#include <H5Cpp.h>
33
34namespace loos {
35
37
41 class MDTrajTraj : public Trajectory {
42 public:
43 explicit MDTrajTraj(const std::string& s, const int na) : _natoms(na),
44 periodic(false),
45 _filename(s) {
46 init();
47 }
48
49 explicit MDTrajTraj(std::istream& is, const int na) : Trajectory(is), _natoms(na),
50 periodic(false) {
51 throw(LOOSError("Creating an MDTrajTraj from a stream isn't implemented"));
52 }
53
54 std::string description() const { return("MDTraj HDF5 trajectory"); }
55 static pTraj create(const std::string& fname, const AtomicGroup& model) {
56 return(pTraj(new MDTrajTraj(fname, model.size())));
57 }
58
59
60 virtual uint nframes(void) const { return(_nframes); }
61 virtual uint natoms(void) const { return(_natoms); }
62 virtual std::vector<GCoord> coords(void) const { return(frame); }
63
64 virtual bool hasPeriodicBox(void) const { return(periodic); }
65 virtual GCoord periodicBox(void) const { return(box); }
66
67 //virtual double velocityConversionFactor() const { return(20.455); }
68
74 virtual float timestep(void) const { return(0.0); } // Dummy routine...
75
76 virtual bool parseFrame(void);
77
78
79 private:
80 void init(void);
81 virtual void rewindImpl(void) { _current_frame = 0; }
82 virtual void seekNextFrameImpl(void) { _current_frame++; seekFrameImpl(_current_frame);}
83 virtual void seekFrameImpl(const uint);
84 virtual void updateGroupCoordsImpl(AtomicGroup&);
85 void readRawFrame(const uint i);
86
87
88 private:
89 uint _natoms, _nframes;
90 std::string _filename;
91 bool periodic;
92 GCoord box;
93 std::vector<GCoord> frame;
94
95 // All of the internal stuff to read the HDF5 file
96 H5::H5File file;
97 H5::DataSet box_dataset;
98 H5::DataSpace box_dataspace;
99 H5::DataType box_datatype;
100 H5::DataSpace box_memspace;
101 H5::DataSet coords_dataset;
102 H5::DataSpace coords_dataspace;
103 H5::DataType coords_datatype;
104 H5::DataSpace coord_memspace;
105 float (*one_frame)[3];
106 };
107
108
109}
110#endif
Class for handling groups of Atoms (pAtoms, actually)
Definition AtomicGroup.hpp:108
Generic LOOS exception.
Definition exceptions.hpp:40
Class for reading MDTraj HDF5 coordinate trajectories.
Definition mdtrajtraj.hpp:41
virtual float timestep(void) const
Definition mdtrajtraj.hpp:74
virtual GCoord periodicBox(void) const
Returns the periodic box for the current frame/trajectory.
Definition mdtrajtraj.hpp:65
std::string description() const
Return a string describing trajectory format.
Definition mdtrajtraj.hpp:54
virtual uint natoms(void) const
Definition mdtrajtraj.hpp:61
virtual bool hasPeriodicBox(void) const
Definition mdtrajtraj.hpp:64
virtual bool parseFrame(void)
Parse an actual frame.
Definition mdtrajtraj.cpp:72
virtual std::vector< GCoord > coords(void) const
Returns the current frames coordinates as a vector of GCoords.
Definition mdtrajtraj.hpp:62
virtual uint nframes(void) const
Number of frames in the trajectory.
Definition mdtrajtraj.hpp:60
Base-class for polymorphic trajectories.
Definition Trajectory.hpp:65
-picker
Namespace for most things not already encapsulated within a class.
Definition version.cpp:3