LOOS  v2.3.2
ccpdb.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_CCPDB_HPP)
23 #define LOOS_CCPDB_HPP
24 
25 
26 #include <iostream>
27 #include <string>
28 #include <stdexcept>
29 
30 #include <loos_defs.hpp>
31 #include <Trajectory.hpp>
32 
33 #include <pdb.hpp>
34 
35 
36 namespace loos {
37 
39 
51  class CCPDB : public Trajectory {
52  public:
53  explicit CCPDB(const std::string& s) : Trajectory(s), _natoms(0), _nframes(0) { init(); }
54  explicit CCPDB(const char *p) : Trajectory(p), _natoms(0), _nframes(0) { init(); }
55  explicit CCPDB(std::istream& is) : Trajectory(is), _natoms(0), _nframes(0) { init(); }
56 
57  static pTraj create(const std::string& fname, const AtomicGroup& model) {
58  return(pTraj(new CCPDB(fname)));
59  }
60 
61  virtual std::string description() const { return("Concatenated PDB"); }
62 
63  virtual uint nframes(void) const { return(_nframes); }
64  virtual uint natoms(void) const { return(_natoms); }
65  virtual std::vector<GCoord> coords(void);
66 
67 
68  virtual bool hasPeriodicBox(void) const { return(frame.isPeriodic()); }
69  virtual GCoord periodicBox(void) const { return(frame.periodicBox()); }
70 
73  virtual float timestep(void) const { return(0.001); }
74 
76 
88  PDB currentFrame(void) const { return(frame); }
89 
90  virtual bool parseFrame(void);
91 
92  private:
93  void init(void);
94  virtual void rewindImpl(void) { ifs()->clear(); ifs()->seekg(0); }
95  virtual void seekNextFrameImpl(void) { }
96  virtual void seekFrameImpl(const uint);
97  virtual void updateGroupCoordsImpl(AtomicGroup& g);
98 
99  private:
100  uint _natoms, _nframes;
101  PDB frame;
102  std::vector<long> indices;
103  };
104 
105 
106 }
107 
108 #endif
virtual GCoord periodicBox(void) const
Returns the periodic box for the current frame/trajectory.
Definition: ccpdb.hpp:69
virtual uint nframes(void) const
Number of frames in the trajectory.
Definition: ccpdb.hpp:63
Class for interpreting concatenated PDB files as a Trajectory.
Definition: ccpdb.hpp:51
virtual std::string description() const
Return a string describing trajectory format.
Definition: ccpdb.hpp:61
virtual bool hasPeriodicBox(void) const
Definition: ccpdb.hpp:68
bool isPeriodic(void) const
Test whether or not periodic boundary conditions are set.
PDB currentFrame(void) const
Returns the current frame as a PDB object.
Definition: ccpdb.hpp:88
virtual float timestep(void) const
Definition: ccpdb.hpp:73
PDB reading/writing class.
Definition: pdb.hpp:69
virtual std::vector< GCoord > coords(void)
Returns the current frames coordinates as a vector of GCoords.
Definition: ccpdb.cpp:78
Class for handling groups of Atoms (pAtoms, actually)
Definition: AtomicGroup.hpp:87
Namespace for most things not already encapsulated within a class.
virtual uint natoms(void) const
of atoms per frame
Definition: ccpdb.hpp:64
Base-class for polymorphic trajectories.
Definition: Trajectory.hpp:64
virtual bool parseFrame(void)
Parse an actual frame.
Definition: ccpdb.cpp:61
GCoord periodicBox(void) const
Fetch the periodic boundary conditions.