1 |
/* |
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 |
|
26 |
/** |
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 |
|
36 |
#include <iostream> |
37 |
#include <vector> |
38 |
#include <utility> |
39 |
|
40 |
#include "brains/fSimulation.h" |
41 |
#include "primitives/Molecule.hpp" |
42 |
#include "types/MoleculeStamp.hpp" |
43 |
#include "utils/PropertyMap.hpp" |
44 |
#include "io/Globals.hpp" |
45 |
|
46 |
namespace oopse{ |
47 |
|
48 |
/** |
49 |
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
50 |
* @brief |
51 |
*/ |
52 |
class SimInfo { |
53 |
public: |
54 |
SimInfo(); |
55 |
virtual ~SimInfo(); |
56 |
|
57 |
/** |
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 |
|
64 |
/** |
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 |
|
70 |
/** |
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 |
|
78 |
/** Returns the total number of atoms in this SimInfo */ |
79 |
unsigned int getNAtoms() { |
80 |
return nAtoms_; |
81 |
} |
82 |
|
83 |
/** Returns the total number of bonds in this SimInfo */ |
84 |
unsigned int getNBonds(){ |
85 |
return nBonds_; |
86 |
} |
87 |
|
88 |
/** Returns the total number of bends in this SimInfo */ |
89 |
unsigned int getNBends() { |
90 |
return nBends_; |
91 |
} |
92 |
|
93 |
/** Returns the total number of torsions in this SimInfo */ |
94 |
unsigned int getNTorsions() { |
95 |
return nTorsions_; |
96 |
} |
97 |
|
98 |
/** Returns the total number of rigid bodies in this SimInfo */ |
99 |
unsigned int getNRigidBodies() { |
100 |
return nRigidBodies_; |
101 |
} |
102 |
|
103 |
/** Returns the total number of integrable objects in this SimInfo */ |
104 |
unsigned int getNIntegrableObjects() { |
105 |
return nIntegrableObjects_; |
106 |
} |
107 |
|
108 |
/** Returns the total number of cutoff groups in this SimInfo */ |
109 |
unsigned int getNCutoffGroups() { |
110 |
return nCutoffGroups_; |
111 |
} |
112 |
|
113 |
/** 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 |
|
125 |
/** |
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 |
|
132 |
/** Returns the number of degrees of freedom */ |
133 |
int getNdf() { |
134 |
return ndf_; |
135 |
} |
136 |
|
137 |
/** Returns the number of raw degrees of freedom */ |
138 |
int getNdfRaw() { |
139 |
return ndfRaw_; |
140 |
} |
141 |
|
142 |
/** Returns the number of translational degrees of freedom */ |
143 |
int getNdfTrans() { |
144 |
return ndfTrans_; |
145 |
} |
146 |
|
147 |
/** Returns the snapshot manager. */ |
148 |
SnapshotManager* getSnapshotManager() { |
149 |
return sman_; |
150 |
} |
151 |
|
152 |
/** Sets the snapshot manager. */ |
153 |
void setSnapshotManager(SnapshotManager* sman) { |
154 |
sman_ = sman; |
155 |
} |
156 |
|
157 |
/** Returns the force field */ |
158 |
ForceField* getForceField() { |
159 |
return forceField_; |
160 |
} |
161 |
|
162 |
/** Sets the force field */ |
163 |
void setForceField(ForceField* ff) { |
164 |
forceField_ = ff; |
165 |
} |
166 |
|
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 |
Vector3d getComVel(); |
180 |
|
181 |
Vector3d getCom(); |
182 |
|
183 |
int getSeed() { |
184 |
return seed_; |
185 |
} |
186 |
|
187 |
void setSeed(int seed) { |
188 |
seed_ = seed; |
189 |
} |
190 |
|
191 |
private: |
192 |
|
193 |
void calcNdf(); |
194 |
void calcNdfRaw(); |
195 |
void calcNdfTrans(); |
196 |
|
197 |
void addExcludePairs(Molecule* mol); |
198 |
void removeExcludePairs(Molecule* mol); |
199 |
|
200 |
int ndf_; |
201 |
int ndfRaw_; |
202 |
int ndfTrans_; |
203 |
|
204 |
int nAtoms_; |
205 |
int nBonds_; |
206 |
int nBends_; |
207 |
int nTorsions_; |
208 |
int nRigidBodies_; |
209 |
int nIntegrableObjects_; |
210 |
int nCutoffGroups_; |
211 |
int nConstraints_; |
212 |
|
213 |
simtype fInfo_; |
214 |
Exclude exclude_; |
215 |
ForceField* forceField_; |
216 |
|
217 |
std::vector<Molecule*> molecules_; /**< Molecule array */ |
218 |
PropertyMap properties_; /** Generic Property */ |
219 |
SnapshotManager* sman_; /** SnapshotManager */ |
220 |
|
221 |
std::vector<std::pair<MoleculeStamp*, int> > moleculeStamps_; |
222 |
Globals* globals_; |
223 |
|
224 |
int seed_; |
225 |
}; |
226 |
|
227 |
} //namespace oopse |
228 |
#endif //BRAINS_SIMMODEL_HPP |