LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
pdbtraj.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_PDBTRAJ_HPP)
23#define LOOS_PDBTRAJ_HPP
24
25
26#include <iostream>
27#include <fstream>
28#include <string>
29#include <sstream>
30#include <stdexcept>
31
32
33#include <loos_defs.hpp>
34#include <AtomicGroup.hpp>
35#include <Trajectory.hpp>
36
37#include <pdb.hpp>
38
39
40namespace loos {
41
42
44
55 class PDBTraj : public Trajectory {
56 public:
57
60
70 explicit PDBTraj(const std::string& s, uint st, uint en, uint str=1) : Trajectory(), pattern(s), start(st), end(en),
71 stride(str), _natoms(0), _nframes(0), current_index(0),
72 at_end(false) { init(); readFrame(0); cached_first = true; }
73
74 explicit PDBTraj(const char *p, uint st, uint en, uint str=1) : Trajectory(), pattern(std::string(p)),
75 start(st), end(en), stride(str), _natoms(0),
76 _nframes(0), current_index(0), at_end(false) { init(); readFrame(0); cached_first = true; }
77
78
79 std::string description() const { return("Trajectory from set of PDB files"); }
80
81 virtual uint nframes(void) const;
82 virtual uint natoms(void) const;
83 virtual std::vector<GCoord> coords(void) const;
84
92 virtual void updateGroupCoords(AtomicGroup& g);
93
94 virtual bool hasPeriodicBox(void) const;
95 virtual GCoord periodicBox(void) const;
96
97 virtual float timestep(void) const;
98
100 std::string currentName(void) const;
101
103 PDB currentFrame(void) const;
104
105 virtual bool parseFrame(void);
106
107 private:
108 void init(void);
109 virtual void rewindImpl(void);
110 virtual void seekNextFrameImpl(void);
111 virtual void seekFrameImpl(const uint);
112
113
114
115 private:
116 std::string pattern;
117 uint start, end, stride;
118 uint _natoms, _nframes;
119 uint current_index;
120 bool at_end;
121 std::string current_name;
122 PDB frame;
123 };
124
125
126}
127
128#endif
Class for handling groups of Atoms (pAtoms, actually)
Definition AtomicGroup.hpp:108
PDB reading/writing class.
Definition pdb.hpp:69
Class for intepreting separate PDB files as a single trajectory.
Definition pdbtraj.hpp:55
PDBTraj(const std::string &s, uint st, uint en, uint str=1)
Definition pdbtraj.hpp:70
virtual GCoord periodicBox(void) const
Returns the periodic box for the current frame/trajectory.
Definition pdbtraj.cpp:41
std::string description() const
Return a string describing trajectory format.
Definition pdbtraj.hpp:79
virtual uint nframes(void) const
Number of frames in the trajectory.
Definition pdbtraj.cpp:28
virtual void updateGroupCoords(AtomicGroup &g)
Definition pdbtraj.cpp:32
virtual float timestep(void) const
Timestep per frame.
Definition pdbtraj.cpp:42
PDB currentFrame(void) const
See CCPDB::currentFrame() for important notes.
Definition pdbtraj.cpp:44
virtual bool hasPeriodicBox(void) const
Definition pdbtraj.cpp:40
virtual std::vector< GCoord > coords(void) const
Returns the current frames coordinates as a vector of GCoords.
Definition pdbtraj.cpp:101
virtual bool parseFrame(void)
Parse an actual frame.
Definition pdbtraj.cpp:83
std::string currentName(void) const
Returns the auto-generated name for the file containing the current frame.
Definition pdbtraj.cpp:43
virtual uint natoms(void) const
Definition pdbtraj.cpp:29
Base-class for polymorphic trajectories.
Definition Trajectory.hpp:65
bool readFrame(void)
Reads the next frame in a trajectory, returning false if at the end.
Definition Trajectory.hpp:241
-picker
Namespace for most things not already encapsulated within a class.
Definition version.cpp:3