-
Notifications
You must be signed in to change notification settings - Fork 0
/
PDBSetup.h
122 lines (109 loc) · 3.45 KB
/
PDBSetup.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.31
Copyright (C) 2018 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
********************************************************************************/
#ifndef PDB_SETUP_H
#define PDB_SETUP_H
#include <vector>
#include <map> //for function lookup table.
#include "InputAbstracts.h" //For FWReadableBase
#include "BasicTypes.h" //For uint
#include "EnsemblePreprocessor.h" //For BOX_TOTAL, etc.
#include "PDBConst.h" //For fields positions, etc.
#include "XYZArray.h" //For box dimensions.
namespace config_setup
{
struct RestartSettings;
}
struct FWReadableBase;
namespace pdb_setup
{
struct Remarks : FWReadableBase {
uint currBox;
double disp[BOX_TOTAL], rotate[BOX_TOTAL], vol[BOX_TOTAL];
bool restart, reached;
void SetRestart(config_setup::RestartSettings const& r);
void Read(FixedWidthReader & pdb);
void SetBox(const uint b)
{
currBox = b;
}
private:
void CheckGOMC(std::string const& varName);
};
struct Cryst1 : FWReadableBase {
//box dimensions
uint currBox;
bool hasVolume;
XYZArray axis;
double cellAngle[BOX_TOTAL][3];
Cryst1(void) : currBox(0), hasVolume(false), axis(BOX_TOTAL) {}
void SetBox(const uint b)
{
currBox = b;
}
void Read(FixedWidthReader & pdb);
};
class Atoms : public FWReadableBase
{
public:
//Set the current residue to something other than 1
Atoms(void) : restart(false), currBox(0), count(0),
currRes(10) {}
void SetRestart(config_setup::RestartSettings const& r);
void SetBox(const uint b)
{
currBox = b;
firstResInFile = true;
}
void Assign(std::string const& atomName,
std::string const& resName,
const uint resNum,
const char l_chain,
const double l_x,
const double l_y,
const double l_z,
const double l_occ,
const double l_beta);
void Read(FixedWidthReader & file);
//private:
//member data
std::vector<char> chainLetter; //chain ids of each molecule
std::vector<double> x, y, z; //coordinates of each particle
std::vector<double> beta; //beta value of each molecule
std::vector<uint> box;
std::vector<std::string> atomAliases, resNamesFull, resNames,
resKindNames;
std::vector<uint> startIdxRes, resKinds, molBeta;
bool restart, firstResInFile;
//CurrRes is used to store res vals, currBox is used to
//determine box either via the file (new) or the occupancy
//(restart), count allows overwriting of coordinates during
//second box read (restart only)
uint currBox, count, currRes;
std::string currResname;
};
}
struct PDBSetup {
pdb_setup::Atoms atoms;
pdb_setup::Cryst1 cryst;
pdb_setup::Remarks remarks;
PDBSetup(void) : dataKinds(SetReadFunctions()) {}
void Init(config_setup::RestartSettings const& restart,
std::string const*const name);
private:
//Map variable names to functions
std::map<std::string, FWReadableBase *> SetReadFunctions(void)
{
std::map<std::string, FWReadableBase *> funct;
funct[pdb_entry::label::REMARK] = &remarks;
funct[pdb_entry::label::CRYST1] = &cryst;
funct[pdb_entry::label::ATOM] = &atoms;
return funct;
}
const std::map<std::string, FWReadableBase *> dataKinds;
static const std::string pdbAlias[];
};
#endif /*PDB_SETUP_H*/