1 |
tim |
1710 |
/* |
2 |
|
|
* Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project |
3 |
|
|
* |
4 |
|
|
* Contact: oopse@oopse.org |
5 |
|
|
* |
6 |
|
|
* This program is free software; you can redistribute it and/or |
7 |
|
|
* modify it under the terms of the GNU Lesser General Public License |
8 |
|
|
* as published by the Free Software Foundation; either version 2.1 |
9 |
|
|
* of the License, or (at your option) any later version. |
10 |
|
|
* All we ask is that proper credit is given for our work, which includes |
11 |
|
|
* - but is not limited to - adding the above copyright notice to the beginning |
12 |
|
|
* of your source code files, and to any copyright notice that you may distribute |
13 |
|
|
* with programs based on this work. |
14 |
|
|
* |
15 |
|
|
* This program is distributed in the hope that it will be useful, |
16 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 |
|
|
* GNU Lesser General Public License for more details. |
19 |
|
|
* |
20 |
|
|
* You should have received a copy of the GNU Lesser General Public License |
21 |
|
|
* along with this program; if not, write to the Free Software |
22 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
|
|
* |
24 |
|
|
*/ |
25 |
gezelter |
1490 |
|
26 |
tim |
1710 |
/** |
27 |
|
|
* @file SimInfo.hpp |
28 |
|
|
* @author tlin |
29 |
|
|
* @date 11/02/2004 |
30 |
|
|
* @version 1.0 |
31 |
|
|
*/ |
32 |
|
|
|
33 |
|
|
#ifndef BRAINS_SIMMODEL_HPP |
34 |
|
|
#define BRAINS_SIMMODEL_HPP |
35 |
tim |
1719 |
|
36 |
|
|
#include <iostream> |
37 |
gezelter |
1490 |
#include <vector> |
38 |
tim |
1719 |
#include <utility> |
39 |
gezelter |
1490 |
|
40 |
tim |
1710 |
#include "brains/fSimulation.h" |
41 |
tim |
1492 |
#include "primitives/Molecule.hpp" |
42 |
tim |
1719 |
#include "types/MoleculeStamp.hpp" |
43 |
tim |
1710 |
#include "utils/PropertyMap.hpp" |
44 |
tim |
1719 |
#include "io/Globals.hpp" |
45 |
gezelter |
1490 |
|
46 |
tim |
1710 |
namespace oopse{ |
47 |
gezelter |
1490 |
|
48 |
tim |
1710 |
/** |
49 |
|
|
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
50 |
|
|
* @brief |
51 |
|
|
*/ |
52 |
|
|
class SimInfo { |
53 |
|
|
public: |
54 |
|
|
SimInfo(); |
55 |
|
|
virtual ~SimInfo(); |
56 |
gezelter |
1490 |
|
57 |
tim |
1710 |
/** |
58 |
|
|
* Adds a molecule |
59 |
|
|
* @return return true if adding successfully, return false if the molecule is already in SimInfo |
60 |
|
|
* @param mol molecule to be added |
61 |
|
|
*/ |
62 |
|
|
bool addMolecule(Molecule* mol); |
63 |
gezelter |
1490 |
|
64 |
tim |
1710 |
/** |
65 |
|
|
* Removes a molecule from SimInfo |
66 |
|
|
* @return true if removing successfully, return false if molecule is not in this SimInfo |
67 |
|
|
*/ |
68 |
|
|
bool removeMolecule(Molecule* mol); |
69 |
gezelter |
1490 |
|
70 |
tim |
1710 |
/** |
71 |
|
|
* Returns the number of molecules. |
72 |
|
|
* @return the number of molecules in this SimInfo |
73 |
|
|
*/ |
74 |
|
|
int getNMolecules() { |
75 |
|
|
return molecules_.size(); |
76 |
|
|
} |
77 |
gezelter |
1490 |
|
78 |
tim |
1710 |
/** Returns the total number of atoms in this SimInfo */ |
79 |
|
|
unsigned int getNAtoms() { |
80 |
|
|
return nAtoms_; |
81 |
|
|
} |
82 |
gezelter |
1490 |
|
83 |
tim |
1710 |
/** Returns the total number of bonds in this SimInfo */ |
84 |
|
|
unsigned int getNBonds(){ |
85 |
|
|
return nBonds_; |
86 |
|
|
} |
87 |
gezelter |
1490 |
|
88 |
tim |
1710 |
/** Returns the total number of bends in this SimInfo */ |
89 |
|
|
unsigned int getNBends() { |
90 |
|
|
return nBends_; |
91 |
|
|
} |
92 |
gezelter |
1490 |
|
93 |
tim |
1710 |
/** Returns the total number of torsions in this SimInfo */ |
94 |
|
|
unsigned int getNTorsions() { |
95 |
|
|
return nTorsions_; |
96 |
|
|
} |
97 |
gezelter |
1490 |
|
98 |
tim |
1710 |
/** Returns the total number of rigid bodies in this SimInfo */ |
99 |
|
|
unsigned int getNRigidBodies() { |
100 |
|
|
return nRigidBodies_; |
101 |
|
|
} |
102 |
gezelter |
1490 |
|
103 |
tim |
1710 |
/** Returns the total number of integrable objects in this SimInfo */ |
104 |
|
|
unsigned int getNIntegrableObjects() { |
105 |
|
|
return nIntegrableObjects_; |
106 |
|
|
} |
107 |
gezelter |
1490 |
|
108 |
tim |
1710 |
/** Returns the total number of cutoff groups in this SimInfo */ |
109 |
|
|
unsigned int getNCutoffGroups() { |
110 |
|
|
return nCutoffGroups_; |
111 |
|
|
} |
112 |
gezelter |
1490 |
|
113 |
tim |
1710 |
/** Returns the total number of constraints in this SimInfo */ |
114 |
|
|
unsigned int getNConstraints() { |
115 |
|
|
return nConstraints_; |
116 |
|
|
} |
117 |
|
|
|
118 |
|
|
/** |
119 |
|
|
* Returns the first molecule in this SimInfo and intialize the iterator. |
120 |
|
|
* @return the first molecule, return NULL if there is not molecule in this SimInfo |
121 |
|
|
* @param i the iterator of molecule array (user shouldn't change it) |
122 |
|
|
*/ |
123 |
|
|
Molecule* beginMolecule(std::vector<Molecule*>::iterator& i); |
124 |
gezelter |
1490 |
|
125 |
tim |
1710 |
/** |
126 |
|
|
* Returns the next avaliable Molecule based on the iterator. |
127 |
|
|
* @return the next avaliable molecule, return NULL if reaching the end of the array |
128 |
|
|
* @param i the iterator of molecule array |
129 |
|
|
*/ |
130 |
|
|
Molecule* nextMolecule(std::vector<Molecule*>::iterator& i); |
131 |
gezelter |
1490 |
|
132 |
tim |
1710 |
/** Returns the number of degrees of freedom */ |
133 |
|
|
int getNDF() { |
134 |
|
|
return ndf_; |
135 |
|
|
} |
136 |
gezelter |
1490 |
|
137 |
tim |
1710 |
/** Returns the number of raw degrees of freedom */ |
138 |
|
|
int getNDFRaw() { |
139 |
|
|
return ndfRaw_; |
140 |
|
|
} |
141 |
gezelter |
1490 |
|
142 |
tim |
1710 |
/** Returns the number of translational degrees of freedom */ |
143 |
|
|
int getNDFTrans() { |
144 |
|
|
return ndfTrans_; |
145 |
|
|
} |
146 |
gezelter |
1490 |
|
147 |
tim |
1710 |
/** Returns the snapshot manager. */ |
148 |
|
|
SnapshotManager* getSnapshotManager() { |
149 |
|
|
return sman_; |
150 |
|
|
} |
151 |
gezelter |
1490 |
|
152 |
tim |
1710 |
/** Sets the snapshot manager. */ |
153 |
|
|
void setSnapshotManager(SnapshotManager* sman) { |
154 |
|
|
sman_ = sman; |
155 |
|
|
} |
156 |
tim |
1712 |
|
157 |
tim |
1719 |
/** Returns the force field */ |
158 |
tim |
1712 |
ForceField* getForceField() { |
159 |
|
|
return forceField_; |
160 |
|
|
} |
161 |
tim |
1719 |
|
162 |
|
|
/** Sets the force field */ |
163 |
tim |
1712 |
void setForceField(ForceField* ff) { |
164 |
|
|
forceField_ = ff; |
165 |
|
|
} |
166 |
tim |
1719 |
|
167 |
|
|
Globals* getGlobals() { |
168 |
|
|
return globals_; |
169 |
|
|
} |
170 |
|
|
|
171 |
|
|
void setGlobals(Globals* globals) { |
172 |
|
|
globals_ = globals; |
173 |
|
|
} |
174 |
|
|
|
175 |
|
|
int* getExcludeList() { |
176 |
|
|
return exclude_.getExcludeList(); |
177 |
|
|
} |
178 |
|
|
|
179 |
tim |
1710 |
private: |
180 |
gezelter |
1490 |
|
181 |
tim |
1710 |
void calcNDF(); |
182 |
|
|
void calcNDFRaw(); |
183 |
|
|
void calcNDFTrans(); |
184 |
gezelter |
1490 |
|
185 |
tim |
1719 |
void addExcludePairs(Molecule* mol); |
186 |
|
|
void removeExcludePairs(Molecule* mol); |
187 |
|
|
|
188 |
tim |
1710 |
int ndf_; |
189 |
|
|
int ndfRaw_; |
190 |
|
|
int ndfTrans_; |
191 |
|
|
|
192 |
|
|
int nAtoms_; |
193 |
|
|
int nBonds_; |
194 |
|
|
int nBends_; |
195 |
|
|
int nTorsions_; |
196 |
|
|
int nRigidBodies_; |
197 |
|
|
int nIntegrableObjects_; |
198 |
|
|
int nCutoffGroups_; |
199 |
|
|
int nConstraints_; |
200 |
gezelter |
1490 |
|
201 |
tim |
1719 |
simtype fInfo_; |
202 |
|
|
Exclude exclude_; |
203 |
tim |
1712 |
ForceField* forceField_; |
204 |
tim |
1710 |
|
205 |
|
|
std::vector<Molecule*> molecules_; /**< Molecule array */ |
206 |
|
|
PropertyMap properties_; /** Generic Property */ |
207 |
|
|
SnapshotManager* sman_; /** SnapshotManager */ |
208 |
gezelter |
1490 |
|
209 |
tim |
1719 |
std::vector<std::pair<MoleculeStamp*, int> > moleculeStamps_; |
210 |
|
|
Globals* globals_; |
211 |
gezelter |
1490 |
}; |
212 |
|
|
|
213 |
tim |
1710 |
} //namespace oopse |
214 |
|
|
#endif //BRAINS_SIMMODEL_HPP |