LOOS  v2.3.2
amber_rst.hpp
1 /*
2  This file is part of LOOS.
3 
4  LOOS (Lightweight Object-Oriented Structure library)
5  Copyright (c) 2009, 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_AMBER_RST_HPP)
23 #define LOOS_AMBER_RST_HPP
24 
25 
26 #include <string>
27 
28 #include <loos_defs.hpp>
29 #include <Coord.hpp>
30 #include <Trajectory.hpp>
31 
32 
33 namespace loos {
34 
36 
37  class AmberRst : public Trajectory {
38  public:
39  explicit AmberRst(const std::string& s, const int na) : Trajectory(s), _natoms(na),
40  current_time(0.0),
41  periodic(false), seek_flag(false) {
42 
43  parseFrame();
44  cached_first = true;
45  }
46 
47 
48 
49  std::string description() const { return("Amber restart (single frame trajectory)"); }
50  static pTraj create(const std::string& fname, const AtomicGroup& model) {
51  return(pTraj(new AmberRst(fname, model.size())));
52  }
53 
54 
55  virtual uint nframes(void) const { return(1); }
56  virtual uint natoms(void) const { return(_natoms); }
57  virtual std::vector<GCoord> coords(void) { return(frame); }
58 
59  virtual bool hasPeriodicBox(void) const { return(periodic); }
60  virtual GCoord periodicBox(void) const { return(box); }
61 
62  virtual float timestep(void) const { return(0.0); } // Dummy routine...
63  greal currentTime(void) const { return(current_time); }
64 
65  virtual bool parseFrame(void);
66 
67  private:
68  virtual void updateGroupCoordsImpl(AtomicGroup&);
69  virtual void rewindImpl(void) { seek_flag = false; cached_first = true; }
70  virtual void seekNextFrameImpl(void);
71  virtual void seekFrameImpl(const uint);
72 
73 
74 
75  private:
76  uint _natoms;
77  greal current_time;
78  bool periodic;
79  GCoord box;
80  std::vector<GCoord> frame;
81 
82  bool seek_flag;
83  };
84 
85 
86 }
87 #endif
std::string description() const
Return a string describing trajectory format.
Definition: amber_rst.hpp:49
virtual bool parseFrame(void)
Parse an actual frame.
Definition: amber_rst.cpp:33
virtual uint natoms(void) const
of atoms per frame
Definition: amber_rst.hpp:56
virtual bool hasPeriodicBox(void) const
Definition: amber_rst.hpp:59
virtual GCoord periodicBox(void) const
Returns the periodic box for the current frame/trajectory.
Definition: amber_rst.hpp:60
Class for handling groups of Atoms (pAtoms, actually)
Definition: AtomicGroup.hpp:87
Namespace for most things not already encapsulated within a class.
virtual std::vector< GCoord > coords(void)
Returns the current frames coordinates as a vector of GCoords.
Definition: amber_rst.hpp:57
Base-class for polymorphic trajectories.
Definition: Trajectory.hpp:64
virtual uint nframes(void) const
Number of frames in the trajectory.
Definition: amber_rst.hpp:55
virtual float timestep(void) const
Timestep per frame.
Definition: amber_rst.hpp:62
Class for reading amber restart files as a single-frame trajectory.
Definition: amber_rst.hpp:37