-
Notifications
You must be signed in to change notification settings - Fork 1
/
gmx_coordinate_file.h
61 lines (40 loc) · 1.33 KB
/
gmx_coordinate_file.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef GMX_COORDINATE_FILE_H_
#define GMX_COORDINATE_FILE_H_
#ifndef CPLUSCPLUS
#define CPLUSPLUS 1
#endif
#include "vecr.h"
#include "xdrfile/xdrfile.h"
#include <iostream>
namespace gromacs {
class GMXCoordinateFile {
public:
GMXCoordinateFile (const std::string path);
virtual ~GMXCoordinateFile ();
int size () const { return _natoms; }
virtual void LoadFirst();
//! load the next frame of the xdr file, and parse the appropriate arrays
virtual void LoadNext() = 0;
//! Prints a whole lot of information about the xdr/coordinate file (e.g. box size, number of atoms, etc)
virtual void PrintInfo () const;
VecR_it begin_coords () const { return _coords.begin(); }
VecR_it end_coords () const { return _coords.end(); }
VecR_it begin_vels () const { return _vels.begin(); }
VecR_it end_vels () const { return _vels.end(); }
VecR_it begin_forces () const { return _forces.begin(); }
VecR_it end_forces () const { return _forces.end(); }
protected:
std::string _path;
XDRFILE * _file;
int _natoms;
int _frame;
float _time;
float _lambda;
matrix _box;
rvec *_x, *_v, *_f; // coordinates, velocities, and forces from each timeframe
VecR_vec _coords, _vels, _forces;
void PrintBox () const;
void Print (const VecR_vec& vec) const;
};
} // namespace gromacs
#endif