-
Notifications
You must be signed in to change notification settings - Fork 1
/
mdfiles.h
58 lines (40 loc) · 976 Bytes
/
mdfiles.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
#ifndef MD_FILES_H_
#define MD_FILES_H_
#include "atom.h"
#include "molecule.h"
#include <iostream>
namespace md_files {
class CoordinateFile {
protected:
FILE *_file; // the XYZ file listing all the atom coordinates
std::string _path;
char _line[1000];
public:
typedef Eigen::Map<VecR> coord_t;
typedef std::vector<coord_t> coord_set_t;
typedef coord_set_t::const_iterator coord_it;
CoordinateFile (const std::string path)
:
_file ((FILE *)NULL),
_path(path) {
_file = fopen (path.c_str(), "r");
if (_file == (FILE *)NULL)
{
printf ("Couldn't load the Coordinate file %s\n", path.c_str());
exit(1);
}
}
virtual ~CoordinateFile () {
fclose (_file);
}
char * ReadLine () {
fgets (_line, 1000, _file);
return _line;
}
char * Line () {
return _line;
}
virtual void LoadNext () = 0;
}; // Coordinate file
} // namespace md_files
#endif