1 |
gezelter |
246 |
/* |
2 |
|
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
|
* |
4 |
|
|
* The University of Notre Dame grants you ("Licensee") a |
5 |
|
|
* non-exclusive, royalty free, license to use, modify and |
6 |
|
|
* redistribute this software in source and binary code form, provided |
7 |
|
|
* that the following conditions are met: |
8 |
|
|
* |
9 |
|
|
* 1. Acknowledgement of the program authors must be made in any |
10 |
|
|
* publication of scientific results based in part on use of the |
11 |
|
|
* program. An acceptable form of acknowledgement is citation of |
12 |
|
|
* the article in which the program was described (Matthew |
13 |
|
|
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
|
|
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
|
|
* Parallel Simulation Engine for Molecular Dynamics," |
16 |
|
|
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
|
|
* |
18 |
|
|
* 2. Redistributions of source code must retain the above copyright |
19 |
|
|
* notice, this list of conditions and the following disclaimer. |
20 |
|
|
* |
21 |
|
|
* 3. Redistributions in binary form must reproduce the above copyright |
22 |
|
|
* notice, this list of conditions and the following disclaimer in the |
23 |
|
|
* documentation and/or other materials provided with the |
24 |
|
|
* distribution. |
25 |
|
|
* |
26 |
|
|
* This software is provided "AS IS," without a warranty of any |
27 |
|
|
* kind. All express or implied conditions, representations and |
28 |
|
|
* warranties, including any implied warranty of merchantability, |
29 |
|
|
* fitness for a particular purpose or non-infringement, are hereby |
30 |
|
|
* excluded. The University of Notre Dame and its licensors shall not |
31 |
|
|
* be liable for any damages suffered by licensee as a result of |
32 |
|
|
* using, modifying or distributing the software or its |
33 |
|
|
* derivatives. In no event will the University of Notre Dame or its |
34 |
|
|
* licensors be liable for any lost revenue, profit or data, or for |
35 |
|
|
* direct, indirect, special, consequential, incidental or punitive |
36 |
|
|
* damages, however caused and regardless of the theory of liability, |
37 |
|
|
* arising out of the use of or inability to use software, even if the |
38 |
|
|
* University of Notre Dame has been advised of the possibility of |
39 |
|
|
* such damages. |
40 |
|
|
*/ |
41 |
|
|
|
42 |
|
|
/** |
43 |
|
|
* @file SimInfo.hpp |
44 |
|
|
* @author tlin |
45 |
|
|
* @date 11/02/2004 |
46 |
|
|
* @version 1.0 |
47 |
|
|
*/ |
48 |
gezelter |
2 |
|
49 |
gezelter |
246 |
#ifndef BRAINS_SIMMODEL_HPP |
50 |
|
|
#define BRAINS_SIMMODEL_HPP |
51 |
|
|
|
52 |
|
|
#include <iostream> |
53 |
|
|
#include <set> |
54 |
|
|
#include <utility> |
55 |
gezelter |
2 |
#include <vector> |
56 |
|
|
|
57 |
tim |
3 |
#include "brains/Exclude.hpp" |
58 |
gezelter |
246 |
#include "io/Globals.hpp" |
59 |
|
|
#include "math/Vector3.hpp" |
60 |
|
|
#include "types/MoleculeStamp.hpp" |
61 |
|
|
#include "UseTheForce/ForceField.hpp" |
62 |
|
|
#include "utils/PropertyMap.hpp" |
63 |
|
|
#include "utils/LocalIndexManager.hpp" |
64 |
tim |
316 |
|
65 |
gezelter |
246 |
//another nonsense macro declaration |
66 |
gezelter |
2 |
#define __C |
67 |
tim |
3 |
#include "brains/fSimulation.h" |
68 |
gezelter |
2 |
|
69 |
gezelter |
246 |
namespace oopse{ |
70 |
gezelter |
2 |
|
71 |
gezelter |
246 |
//forward decalration |
72 |
|
|
class SnapshotManager; |
73 |
|
|
class Molecule; |
74 |
tim |
316 |
class SelectionManager; |
75 |
gezelter |
246 |
/** |
76 |
|
|
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
77 |
|
|
* @brief As one of the heavy weight class of OOPSE, SimInfo |
78 |
|
|
* One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules. |
79 |
|
|
* And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies, |
80 |
|
|
* cutoff groups, constrains). |
81 |
|
|
* Another major change is the index. No matter single version or parallel version, atoms and |
82 |
|
|
* rigid bodies have both global index and local index. Local index is not important to molecule as well as |
83 |
|
|
* cutoff group. |
84 |
|
|
*/ |
85 |
|
|
class SimInfo { |
86 |
|
|
public: |
87 |
|
|
typedef std::map<int, Molecule*>::iterator MoleculeIterator; |
88 |
gezelter |
2 |
|
89 |
gezelter |
246 |
/** |
90 |
|
|
* Constructor of SimInfo |
91 |
|
|
* @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the |
92 |
|
|
* second element is the total number of molecules with the same molecule stamp in the system |
93 |
|
|
* @param ff pointer of a concrete ForceField instance |
94 |
|
|
* @param simParams |
95 |
|
|
* @note |
96 |
|
|
*/ |
97 |
|
|
SimInfo(std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, ForceField* ff, Globals* simParams); |
98 |
|
|
virtual ~SimInfo(); |
99 |
gezelter |
2 |
|
100 |
gezelter |
246 |
/** |
101 |
|
|
* Adds a molecule |
102 |
|
|
* @return return true if adding successfully, return false if the molecule is already in SimInfo |
103 |
|
|
* @param mol molecule to be added |
104 |
|
|
*/ |
105 |
|
|
bool addMolecule(Molecule* mol); |
106 |
gezelter |
2 |
|
107 |
gezelter |
246 |
/** |
108 |
|
|
* Removes a molecule from SimInfo |
109 |
|
|
* @return true if removing successfully, return false if molecule is not in this SimInfo |
110 |
|
|
*/ |
111 |
|
|
bool removeMolecule(Molecule* mol); |
112 |
gezelter |
2 |
|
113 |
gezelter |
246 |
/** Returns the total number of molecules in the system. */ |
114 |
|
|
int getNGlobalMolecules() { |
115 |
|
|
return nGlobalMols_; |
116 |
|
|
} |
117 |
gezelter |
2 |
|
118 |
gezelter |
246 |
/** Returns the total number of atoms in the system. */ |
119 |
|
|
int getNGlobalAtoms() { |
120 |
|
|
return nGlobalAtoms_; |
121 |
|
|
} |
122 |
gezelter |
2 |
|
123 |
gezelter |
246 |
/** Returns the total number of cutoff groups in the system. */ |
124 |
|
|
int getNGlobalCutoffGroups() { |
125 |
|
|
return nGlobalCutoffGroups_; |
126 |
|
|
} |
127 |
gezelter |
2 |
|
128 |
gezelter |
246 |
/** |
129 |
|
|
* Returns the total number of integrable objects (total number of rigid bodies plus the total number |
130 |
|
|
* of atoms which do not belong to the rigid bodies) in the system |
131 |
|
|
*/ |
132 |
|
|
int getNGlobalIntegrableObjects() { |
133 |
|
|
return nGlobalIntegrableObjects_; |
134 |
|
|
} |
135 |
gezelter |
2 |
|
136 |
gezelter |
246 |
/** |
137 |
|
|
* Returns the total number of integrable objects (total number of rigid bodies plus the total number |
138 |
|
|
* of atoms which do not belong to the rigid bodies) in the system |
139 |
|
|
*/ |
140 |
|
|
int getNGlobalRigidBodies() { |
141 |
|
|
return nGlobalRigidBodies_; |
142 |
|
|
} |
143 |
gezelter |
2 |
|
144 |
gezelter |
246 |
int getNGlobalConstraints(); |
145 |
|
|
/** |
146 |
|
|
* Returns the number of local molecules. |
147 |
|
|
* @return the number of local molecules |
148 |
|
|
*/ |
149 |
|
|
int getNMolecules() { |
150 |
|
|
return molecules_.size(); |
151 |
|
|
} |
152 |
gezelter |
2 |
|
153 |
gezelter |
246 |
/** Returns the number of local atoms */ |
154 |
|
|
unsigned int getNAtoms() { |
155 |
|
|
return nAtoms_; |
156 |
|
|
} |
157 |
gezelter |
2 |
|
158 |
gezelter |
246 |
/** Returns the number of local bonds */ |
159 |
|
|
unsigned int getNBonds(){ |
160 |
|
|
return nBonds_; |
161 |
|
|
} |
162 |
gezelter |
2 |
|
163 |
gezelter |
246 |
/** Returns the number of local bends */ |
164 |
|
|
unsigned int getNBends() { |
165 |
|
|
return nBends_; |
166 |
|
|
} |
167 |
gezelter |
2 |
|
168 |
gezelter |
246 |
/** Returns the number of local torsions */ |
169 |
|
|
unsigned int getNTorsions() { |
170 |
|
|
return nTorsions_; |
171 |
|
|
} |
172 |
gezelter |
2 |
|
173 |
gezelter |
246 |
/** Returns the number of local rigid bodies */ |
174 |
|
|
unsigned int getNRigidBodies() { |
175 |
|
|
return nRigidBodies_; |
176 |
|
|
} |
177 |
gezelter |
2 |
|
178 |
gezelter |
246 |
/** Returns the number of local integrable objects */ |
179 |
|
|
unsigned int getNIntegrableObjects() { |
180 |
|
|
return nIntegrableObjects_; |
181 |
|
|
} |
182 |
gezelter |
2 |
|
183 |
gezelter |
246 |
/** Returns the number of local cutoff groups */ |
184 |
|
|
unsigned int getNCutoffGroups() { |
185 |
|
|
return nCutoffGroups_; |
186 |
|
|
} |
187 |
gezelter |
2 |
|
188 |
gezelter |
246 |
/** Returns the total number of constraints in this SimInfo */ |
189 |
|
|
unsigned int getNConstraints() { |
190 |
|
|
return nConstraints_; |
191 |
|
|
} |
192 |
|
|
|
193 |
|
|
/** |
194 |
|
|
* Returns the first molecule in this SimInfo and intialize the iterator. |
195 |
|
|
* @return the first molecule, return NULL if there is not molecule in this SimInfo |
196 |
|
|
* @param i the iterator of molecule array (user shouldn't change it) |
197 |
|
|
*/ |
198 |
|
|
Molecule* beginMolecule(MoleculeIterator& i); |
199 |
gezelter |
2 |
|
200 |
gezelter |
246 |
/** |
201 |
|
|
* Returns the next avaliable Molecule based on the iterator. |
202 |
|
|
* @return the next avaliable molecule, return NULL if reaching the end of the array |
203 |
|
|
* @param i the iterator of molecule array |
204 |
|
|
*/ |
205 |
|
|
Molecule* nextMolecule(MoleculeIterator& i); |
206 |
gezelter |
2 |
|
207 |
gezelter |
246 |
/** Returns the number of degrees of freedom */ |
208 |
|
|
int getNdf() { |
209 |
|
|
return ndf_; |
210 |
|
|
} |
211 |
gezelter |
2 |
|
212 |
gezelter |
246 |
/** Returns the number of raw degrees of freedom */ |
213 |
|
|
int getNdfRaw() { |
214 |
|
|
return ndfRaw_; |
215 |
|
|
} |
216 |
gezelter |
2 |
|
217 |
gezelter |
246 |
/** Returns the number of translational degrees of freedom */ |
218 |
|
|
int getNdfTrans() { |
219 |
|
|
return ndfTrans_; |
220 |
|
|
} |
221 |
gezelter |
2 |
|
222 |
gezelter |
246 |
//getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying |
223 |
|
|
|
224 |
|
|
/** Returns the total number of z-constraint molecules in the system */ |
225 |
|
|
int getNZconstraint() { |
226 |
|
|
return nZconstraint_; |
227 |
|
|
} |
228 |
gezelter |
2 |
|
229 |
gezelter |
246 |
/** |
230 |
|
|
* Sets the number of z-constraint molecules in the system. |
231 |
|
|
*/ |
232 |
|
|
void setNZconstraint(int nZconstraint) { |
233 |
|
|
nZconstraint_ = nZconstraint; |
234 |
|
|
} |
235 |
|
|
|
236 |
|
|
/** Returns the snapshot manager. */ |
237 |
|
|
SnapshotManager* getSnapshotManager() { |
238 |
|
|
return sman_; |
239 |
|
|
} |
240 |
gezelter |
2 |
|
241 |
gezelter |
246 |
/** Sets the snapshot manager. */ |
242 |
|
|
void setSnapshotManager(SnapshotManager* sman); |
243 |
|
|
|
244 |
|
|
/** Returns the force field */ |
245 |
|
|
ForceField* getForceField() { |
246 |
|
|
return forceField_; |
247 |
|
|
} |
248 |
gezelter |
2 |
|
249 |
gezelter |
246 |
Globals* getSimParams() { |
250 |
|
|
return simParams_; |
251 |
|
|
} |
252 |
gezelter |
2 |
|
253 |
gezelter |
246 |
/** Returns the velocity of center of mass of the whole system.*/ |
254 |
|
|
Vector3d getComVel(); |
255 |
gezelter |
2 |
|
256 |
gezelter |
246 |
/** Returns the center of the mass of the whole system.*/ |
257 |
|
|
Vector3d getCom(); |
258 |
gezelter |
2 |
|
259 |
gezelter |
246 |
/** main driver function to interact with fortran during the initialization and molecule migration */ |
260 |
|
|
void update(); |
261 |
gezelter |
2 |
|
262 |
gezelter |
246 |
/** Returns the local index manager */ |
263 |
|
|
LocalIndexManager* getLocalIndexManager() { |
264 |
|
|
return &localIndexMan_; |
265 |
|
|
} |
266 |
gezelter |
2 |
|
267 |
gezelter |
246 |
int getMoleculeStampId(int globalIndex) { |
268 |
|
|
//assert(globalIndex < molStampIds_.size()) |
269 |
|
|
return molStampIds_[globalIndex]; |
270 |
|
|
} |
271 |
gezelter |
2 |
|
272 |
gezelter |
246 |
/** Returns the molecule stamp */ |
273 |
|
|
MoleculeStamp* getMoleculeStamp(int id) { |
274 |
|
|
return moleculeStamps_[id]; |
275 |
|
|
} |
276 |
gezelter |
2 |
|
277 |
gezelter |
246 |
/** Return the total number of the molecule stamps */ |
278 |
|
|
int getNMoleculeStamp() { |
279 |
|
|
return moleculeStamps_.size(); |
280 |
|
|
} |
281 |
|
|
/** |
282 |
|
|
* Finds a molecule with a specified global index |
283 |
|
|
* @return a pointer point to found molecule |
284 |
|
|
* @param index |
285 |
|
|
*/ |
286 |
|
|
Molecule* getMoleculeByGlobalIndex(int index) { |
287 |
|
|
MoleculeIterator i; |
288 |
|
|
i = molecules_.find(index); |
289 |
gezelter |
2 |
|
290 |
gezelter |
246 |
return i != molecules_.end() ? i->second : NULL; |
291 |
|
|
} |
292 |
gezelter |
2 |
|
293 |
gezelter |
246 |
/** Calculate the maximum cutoff radius based on the atom types */ |
294 |
|
|
double calcMaxCutoffRadius(); |
295 |
gezelter |
2 |
|
296 |
gezelter |
246 |
double getRcut() { |
297 |
|
|
return rcut_; |
298 |
|
|
} |
299 |
gezelter |
2 |
|
300 |
gezelter |
246 |
double getRsw() { |
301 |
|
|
return rsw_; |
302 |
|
|
} |
303 |
|
|
|
304 |
|
|
std::string getFinalConfigFileName() { |
305 |
|
|
return finalConfigFileName_; |
306 |
|
|
} |
307 |
|
|
|
308 |
|
|
void setFinalConfigFileName(const std::string& fileName) { |
309 |
|
|
finalConfigFileName_ = fileName; |
310 |
|
|
} |
311 |
gezelter |
2 |
|
312 |
gezelter |
246 |
std::string getDumpFileName() { |
313 |
|
|
return dumpFileName_; |
314 |
|
|
} |
315 |
|
|
|
316 |
|
|
void setDumpFileName(const std::string& fileName) { |
317 |
|
|
dumpFileName_ = fileName; |
318 |
|
|
} |
319 |
gezelter |
2 |
|
320 |
gezelter |
246 |
std::string getStatFileName() { |
321 |
|
|
return statFileName_; |
322 |
|
|
} |
323 |
|
|
|
324 |
|
|
void setStatFileName(const std::string& fileName) { |
325 |
|
|
statFileName_ = fileName; |
326 |
|
|
} |
327 |
gezelter |
2 |
|
328 |
gezelter |
246 |
/** |
329 |
|
|
* Sets GlobalGroupMembership |
330 |
|
|
* @see #SimCreator::setGlobalIndex |
331 |
|
|
*/ |
332 |
|
|
void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) { |
333 |
|
|
assert(globalGroupMembership.size() == nGlobalAtoms_); |
334 |
|
|
globalGroupMembership_ = globalGroupMembership; |
335 |
|
|
} |
336 |
gezelter |
2 |
|
337 |
gezelter |
246 |
/** |
338 |
|
|
* Sets GlobalMolMembership |
339 |
|
|
* @see #SimCreator::setGlobalIndex |
340 |
|
|
*/ |
341 |
|
|
void setGlobalMolMembership(const std::vector<int>& globalMolMembership) { |
342 |
|
|
assert(globalMolMembership.size() == nGlobalAtoms_); |
343 |
|
|
globalMolMembership_ = globalMolMembership; |
344 |
|
|
} |
345 |
|
|
|
346 |
|
|
|
347 |
|
|
bool isFortranInitialized() { |
348 |
|
|
return fortranInitialized_; |
349 |
|
|
} |
350 |
|
|
|
351 |
|
|
//below functions are just forward functions |
352 |
|
|
//To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the |
353 |
|
|
//the other hand, has-a relation need composing. |
354 |
|
|
/** |
355 |
|
|
* Adds property into property map |
356 |
|
|
* @param genData GenericData to be added into PropertyMap |
357 |
|
|
*/ |
358 |
|
|
void addProperty(GenericData* genData); |
359 |
|
|
|
360 |
|
|
/** |
361 |
|
|
* Removes property from PropertyMap by name |
362 |
|
|
* @param propName the name of property to be removed |
363 |
|
|
*/ |
364 |
|
|
void removeProperty(const std::string& propName); |
365 |
|
|
|
366 |
|
|
/** |
367 |
|
|
* clear all of the properties |
368 |
|
|
*/ |
369 |
|
|
void clearProperties(); |
370 |
|
|
|
371 |
|
|
/** |
372 |
|
|
* Returns all names of properties |
373 |
|
|
* @return all names of properties |
374 |
|
|
*/ |
375 |
|
|
std::vector<std::string> getPropertyNames(); |
376 |
|
|
|
377 |
|
|
/** |
378 |
|
|
* Returns all of the properties in PropertyMap |
379 |
|
|
* @return all of the properties in PropertyMap |
380 |
|
|
*/ |
381 |
|
|
std::vector<GenericData*> getProperties(); |
382 |
|
|
|
383 |
|
|
/** |
384 |
|
|
* Returns property |
385 |
|
|
* @param propName name of property |
386 |
|
|
* @return a pointer point to property with propName. If no property named propName |
387 |
|
|
* exists, return NULL |
388 |
|
|
*/ |
389 |
|
|
GenericData* getPropertyByName(const std::string& propName); |
390 |
|
|
|
391 |
|
|
/** |
392 |
|
|
* add all exclude pairs of a molecule into exclude list. |
393 |
|
|
*/ |
394 |
|
|
void addExcludePairs(Molecule* mol); |
395 |
|
|
|
396 |
|
|
/** |
397 |
|
|
* remove all exclude pairs which belong to a molecule from exclude list |
398 |
|
|
*/ |
399 |
|
|
|
400 |
|
|
void removeExcludePairs(Molecule* mol); |
401 |
tim |
292 |
|
402 |
|
|
|
403 |
|
|
SelectionManager* getSelectionManager() { |
404 |
|
|
return selectMan_; |
405 |
|
|
} |
406 |
tim |
322 |
|
407 |
|
|
/** Returns the unique atom types of local processor in an array */ |
408 |
|
|
std::set<AtomType*> getUniqueAtomTypes(); |
409 |
tim |
292 |
|
410 |
gezelter |
246 |
friend std::ostream& operator <<(std::ostream& o, SimInfo& info); |
411 |
tim |
326 |
|
412 |
|
|
void getCutoff(double& rcut, double& rsw); |
413 |
gezelter |
246 |
|
414 |
|
|
private: |
415 |
|
|
|
416 |
|
|
/** fill up the simtype struct*/ |
417 |
|
|
void setupSimType(); |
418 |
|
|
|
419 |
|
|
/** |
420 |
|
|
* Setup Fortran Simulation |
421 |
|
|
* @see #setupFortranParallel |
422 |
|
|
*/ |
423 |
|
|
void setupFortranSim(); |
424 |
|
|
|
425 |
|
|
/** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ |
426 |
|
|
void setupCutoff(); |
427 |
|
|
|
428 |
|
|
/** Calculates the number of degress of freedom in the whole system */ |
429 |
|
|
void calcNdf(); |
430 |
|
|
void calcNdfRaw(); |
431 |
|
|
void calcNdfTrans(); |
432 |
|
|
|
433 |
|
|
/** |
434 |
|
|
* Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole |
435 |
|
|
* system. |
436 |
|
|
*/ |
437 |
|
|
void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); |
438 |
|
|
|
439 |
|
|
ForceField* forceField_; |
440 |
|
|
Globals* simParams_; |
441 |
|
|
|
442 |
|
|
std::map<int, Molecule*> molecules_; /**< Molecule array */ |
443 |
|
|
|
444 |
|
|
//degress of freedom |
445 |
|
|
int ndf_; /**< number of degress of freedom (excludes constraints), ndf_ is local */ |
446 |
|
|
int ndfRaw_; /**< number of degress of freedom (includes constraints), ndfRaw_ is local */ |
447 |
|
|
int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ |
448 |
|
|
int nZconstraint_; /** number of z-constraint molecules, nZconstraint_ is global */ |
449 |
|
|
|
450 |
|
|
//number of global objects |
451 |
|
|
int nGlobalMols_; /**< number of molecules in the system */ |
452 |
|
|
int nGlobalAtoms_; /**< number of atoms in the system */ |
453 |
|
|
int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */ |
454 |
|
|
int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ |
455 |
|
|
int nGlobalRigidBodies_; /**< number of rigid bodies in this system */ |
456 |
|
|
/** |
457 |
|
|
* the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
458 |
|
|
* corresponding content is the global index of cutoff group this atom belong to. |
459 |
|
|
* It is filled by SimCreator once and only once, since it never changed during the simulation. |
460 |
|
|
*/ |
461 |
|
|
std::vector<int> globalGroupMembership_; |
462 |
|
|
|
463 |
|
|
/** |
464 |
|
|
* the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
465 |
|
|
* corresponding content is the global index of molecule this atom belong to. |
466 |
|
|
* It is filled by SimCreator once and only once, since it is never changed during the simulation. |
467 |
|
|
*/ |
468 |
|
|
std::vector<int> globalMolMembership_; |
469 |
|
|
|
470 |
|
|
|
471 |
|
|
std::vector<int> molStampIds_; /**< stamp id array of all molecules in the system */ |
472 |
|
|
std::vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
473 |
|
|
|
474 |
|
|
//number of local objects |
475 |
|
|
int nAtoms_; /**< number of atoms in local processor */ |
476 |
|
|
int nBonds_; /**< number of bonds in local processor */ |
477 |
|
|
int nBends_; /**< number of bends in local processor */ |
478 |
|
|
int nTorsions_; /**< number of torsions in local processor */ |
479 |
|
|
int nRigidBodies_; /**< number of rigid bodies in local processor */ |
480 |
|
|
int nIntegrableObjects_; /**< number of integrable objects in local processor */ |
481 |
|
|
int nCutoffGroups_; /**< number of cutoff groups in local processor */ |
482 |
|
|
int nConstraints_; /**< number of constraints in local processors */ |
483 |
|
|
|
484 |
|
|
simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/ |
485 |
|
|
Exclude exclude_; |
486 |
|
|
PropertyMap properties_; /**< Generic Property */ |
487 |
|
|
SnapshotManager* sman_; /**< SnapshotManager */ |
488 |
|
|
|
489 |
|
|
/** |
490 |
|
|
* The reason to have a local index manager is that when molecule is migrating to other processors, |
491 |
|
|
* the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the |
492 |
|
|
* information of molecule migrating to current processor, Migrator class can query the LocalIndexManager |
493 |
|
|
* to make a efficient data moving plan. |
494 |
|
|
*/ |
495 |
|
|
LocalIndexManager localIndexMan_; |
496 |
|
|
|
497 |
|
|
//file names |
498 |
|
|
std::string finalConfigFileName_; |
499 |
|
|
std::string dumpFileName_; |
500 |
|
|
std::string statFileName_; |
501 |
|
|
|
502 |
|
|
double rcut_; /**< cutoff radius*/ |
503 |
|
|
double rsw_; /**< radius of switching function*/ |
504 |
|
|
|
505 |
|
|
bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */ |
506 |
tim |
292 |
|
507 |
|
|
SelectionManager* selectMan_; |
508 |
gezelter |
246 |
#ifdef IS_MPI |
509 |
|
|
//in Parallel version, we need MolToProc |
510 |
|
|
public: |
511 |
|
|
|
512 |
|
|
/** |
513 |
|
|
* Finds the processor where a molecule resides |
514 |
|
|
* @return the id of the processor which contains the molecule |
515 |
|
|
* @param globalIndex global Index of the molecule |
516 |
|
|
*/ |
517 |
|
|
int getMolToProc(int globalIndex) { |
518 |
|
|
//assert(globalIndex < molToProcMap_.size()); |
519 |
|
|
return molToProcMap_[globalIndex]; |
520 |
|
|
} |
521 |
|
|
|
522 |
|
|
/** |
523 |
|
|
* Set MolToProcMap array |
524 |
|
|
* @see #SimCreator::divideMolecules |
525 |
|
|
*/ |
526 |
|
|
void setMolToProcMap(const std::vector<int>& molToProcMap) { |
527 |
|
|
molToProcMap_ = molToProcMap; |
528 |
|
|
} |
529 |
|
|
|
530 |
|
|
private: |
531 |
|
|
|
532 |
|
|
void setupFortranParallel(); |
533 |
|
|
|
534 |
|
|
/** |
535 |
|
|
* The size of molToProcMap_ is equal to total number of molecules in the system. |
536 |
|
|
* It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only |
537 |
|
|
* once. |
538 |
|
|
*/ |
539 |
|
|
std::vector<int> molToProcMap_; |
540 |
tim |
292 |
|
541 |
gezelter |
246 |
#endif |
542 |
|
|
|
543 |
gezelter |
2 |
}; |
544 |
|
|
|
545 |
gezelter |
246 |
} //namespace oopse |
546 |
|
|
#endif //BRAINS_SIMMODEL_HPP |
547 |
gezelter |
2 |
|