1 |
/* |
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. Redistributions of source code must retain the above copyright |
10 |
* notice, this list of conditions and the following disclaimer. |
11 |
* |
12 |
* 2. Redistributions in binary form must reproduce the above copyright |
13 |
* notice, this list of conditions and the following disclaimer in the |
14 |
* documentation and/or other materials provided with the |
15 |
* distribution. |
16 |
* |
17 |
* This software is provided "AS IS," without a warranty of any |
18 |
* kind. All express or implied conditions, representations and |
19 |
* warranties, including any implied warranty of merchantability, |
20 |
* fitness for a particular purpose or non-infringement, are hereby |
21 |
* excluded. The University of Notre Dame and its licensors shall not |
22 |
* be liable for any damages suffered by licensee as a result of |
23 |
* using, modifying or distributing the software or its |
24 |
* derivatives. In no event will the University of Notre Dame or its |
25 |
* licensors be liable for any lost revenue, profit or data, or for |
26 |
* direct, indirect, special, consequential, incidental or punitive |
27 |
* damages, however caused and regardless of the theory of liability, |
28 |
* arising out of the use of or inability to use software, even if the |
29 |
* University of Notre Dame has been advised of the possibility of |
30 |
* such damages. |
31 |
* |
32 |
* SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your |
33 |
* research, please cite the appropriate papers when you publish your |
34 |
* work. Good starting points are: |
35 |
* |
36 |
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
37 |
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
38 |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
39 |
* [4] Vardeman & Gezelter, in progress (2009). |
40 |
*/ |
41 |
|
42 |
/** |
43 |
* @file SimInfo.hpp |
44 |
* @author tlin |
45 |
* @date 11/02/2004 |
46 |
* @version 1.0 |
47 |
*/ |
48 |
|
49 |
#ifndef BRAINS_SIMMODEL_HPP |
50 |
#define BRAINS_SIMMODEL_HPP |
51 |
|
52 |
#include <iostream> |
53 |
#include <set> |
54 |
#include <utility> |
55 |
#include <vector> |
56 |
|
57 |
#include "brains/PairList.hpp" |
58 |
#include "io/Globals.hpp" |
59 |
#include "math/Vector3.hpp" |
60 |
#include "math/SquareMatrix3.hpp" |
61 |
#include "types/MoleculeStamp.hpp" |
62 |
#include "UseTheForce/ForceField.hpp" |
63 |
#include "utils/PropertyMap.hpp" |
64 |
#include "utils/LocalIndexManager.hpp" |
65 |
#include "nonbonded/SwitchingFunction.hpp" |
66 |
|
67 |
using namespace std; |
68 |
namespace OpenMD{ |
69 |
//forward declaration |
70 |
class SnapshotManager; |
71 |
class Molecule; |
72 |
class SelectionManager; |
73 |
class StuntDouble; |
74 |
|
75 |
/** |
76 |
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
77 |
* |
78 |
* @brief One of the heavy-weight classes of OpenMD, SimInfo |
79 |
* maintains objects and variables relating to the current |
80 |
* simulation. This includes the master list of Molecules. The |
81 |
* Molecule class maintains all of the concrete objects (Atoms, |
82 |
* Bond, Bend, Torsions, Inversions, RigidBodies, CutoffGroups, |
83 |
* Constraints). In both the single and parallel versions, Atoms and |
84 |
* RigidBodies have both global and local indices. |
85 |
*/ |
86 |
class SimInfo { |
87 |
public: |
88 |
typedef map<int, Molecule*>::iterator MoleculeIterator; |
89 |
|
90 |
/** |
91 |
* Constructor of SimInfo |
92 |
* |
93 |
* @param molStampPairs MoleculeStamp Array. The first element of |
94 |
* the pair is molecule stamp, the second element is the total |
95 |
* number of molecules with the same molecule stamp in the system |
96 |
* |
97 |
* @param ff pointer of a concrete ForceField instance |
98 |
* |
99 |
* @param simParams |
100 |
*/ |
101 |
SimInfo(ForceField* ff, Globals* simParams); |
102 |
virtual ~SimInfo(); |
103 |
|
104 |
/** |
105 |
* Adds a molecule |
106 |
* |
107 |
* @return return true if adding successfully, return false if the |
108 |
* molecule is already in SimInfo |
109 |
* |
110 |
* @param mol molecule to be added |
111 |
*/ |
112 |
bool addMolecule(Molecule* mol); |
113 |
|
114 |
/** |
115 |
* Removes a molecule from SimInfo |
116 |
* |
117 |
* @return true if removing successfully, return false if molecule |
118 |
* is not in this SimInfo |
119 |
*/ |
120 |
bool removeMolecule(Molecule* mol); |
121 |
|
122 |
/** Returns the total number of molecules in the system. */ |
123 |
int getNGlobalMolecules() { |
124 |
return nGlobalMols_; |
125 |
} |
126 |
|
127 |
/** Returns the total number of atoms in the system. */ |
128 |
int getNGlobalAtoms() { |
129 |
return nGlobalAtoms_; |
130 |
} |
131 |
|
132 |
/** Returns the total number of cutoff groups in the system. */ |
133 |
int getNGlobalCutoffGroups() { |
134 |
return nGlobalCutoffGroups_; |
135 |
} |
136 |
|
137 |
/** |
138 |
* Returns the total number of integrable objects (total number of |
139 |
* rigid bodies plus the total number of atoms which do not belong |
140 |
* to the rigid bodies) in the system |
141 |
*/ |
142 |
int getNGlobalIntegrableObjects() { |
143 |
return nGlobalIntegrableObjects_; |
144 |
} |
145 |
|
146 |
/** |
147 |
* Returns the total number of integrable objects (total number of |
148 |
* rigid bodies plus the total number of atoms which do not belong |
149 |
* to the rigid bodies) in the system |
150 |
*/ |
151 |
int getNGlobalRigidBodies() { |
152 |
return nGlobalRigidBodies_; |
153 |
} |
154 |
|
155 |
int getNGlobalConstraints(); |
156 |
/** |
157 |
* Returns the number of local molecules. |
158 |
* @return the number of local molecules |
159 |
*/ |
160 |
int getNMolecules() { |
161 |
return molecules_.size(); |
162 |
} |
163 |
|
164 |
/** Returns the number of local atoms */ |
165 |
unsigned int getNAtoms() { |
166 |
return nAtoms_; |
167 |
} |
168 |
|
169 |
/** Returns the number of local bonds */ |
170 |
unsigned int getNBonds(){ |
171 |
return nBonds_; |
172 |
} |
173 |
|
174 |
/** Returns the number of local bends */ |
175 |
unsigned int getNBends() { |
176 |
return nBends_; |
177 |
} |
178 |
|
179 |
/** Returns the number of local torsions */ |
180 |
unsigned int getNTorsions() { |
181 |
return nTorsions_; |
182 |
} |
183 |
|
184 |
/** Returns the number of local torsions */ |
185 |
unsigned int getNInversions() { |
186 |
return nInversions_; |
187 |
} |
188 |
/** Returns the number of local rigid bodies */ |
189 |
unsigned int getNRigidBodies() { |
190 |
return nRigidBodies_; |
191 |
} |
192 |
|
193 |
/** Returns the number of local integrable objects */ |
194 |
unsigned int getNIntegrableObjects() { |
195 |
return nIntegrableObjects_; |
196 |
} |
197 |
|
198 |
/** Returns the number of local cutoff groups */ |
199 |
unsigned int getNCutoffGroups() { |
200 |
return nCutoffGroups_; |
201 |
} |
202 |
|
203 |
/** Returns the total number of constraints in this SimInfo */ |
204 |
unsigned int getNConstraints() { |
205 |
return nConstraints_; |
206 |
} |
207 |
|
208 |
/** |
209 |
* Returns the first molecule in this SimInfo and intialize the iterator. |
210 |
* @return the first molecule, return NULL if there is not molecule in this SimInfo |
211 |
* @param i the iterator of molecule array (user shouldn't change it) |
212 |
*/ |
213 |
Molecule* beginMolecule(MoleculeIterator& i); |
214 |
|
215 |
/** |
216 |
* Returns the next avaliable Molecule based on the iterator. |
217 |
* @return the next avaliable molecule, return NULL if reaching the end of the array |
218 |
* @param i the iterator of molecule array |
219 |
*/ |
220 |
Molecule* nextMolecule(MoleculeIterator& i); |
221 |
|
222 |
/** Returns the number of degrees of freedom */ |
223 |
int getNdf() { |
224 |
return ndf_ - getFdf(); |
225 |
} |
226 |
|
227 |
/** Returns the number of raw degrees of freedom */ |
228 |
int getNdfRaw() { |
229 |
return ndfRaw_; |
230 |
} |
231 |
|
232 |
/** Returns the number of translational degrees of freedom */ |
233 |
int getNdfTrans() { |
234 |
return ndfTrans_; |
235 |
} |
236 |
|
237 |
/** sets the current number of frozen degrees of freedom */ |
238 |
void setFdf(int fdf) { |
239 |
fdf_local = fdf; |
240 |
} |
241 |
|
242 |
int getFdf(); |
243 |
|
244 |
//getNZconstraint and setNZconstraint ruin the coherence of |
245 |
//SimInfo class, need refactoring |
246 |
|
247 |
/** Returns the total number of z-constraint molecules in the system */ |
248 |
int getNZconstraint() { |
249 |
return nZconstraint_; |
250 |
} |
251 |
|
252 |
/** |
253 |
* Sets the number of z-constraint molecules in the system. |
254 |
*/ |
255 |
void setNZconstraint(int nZconstraint) { |
256 |
nZconstraint_ = nZconstraint; |
257 |
} |
258 |
|
259 |
/** Returns the snapshot manager. */ |
260 |
SnapshotManager* getSnapshotManager() { |
261 |
return sman_; |
262 |
} |
263 |
|
264 |
/** Sets the snapshot manager. */ |
265 |
void setSnapshotManager(SnapshotManager* sman); |
266 |
|
267 |
/** Returns the force field */ |
268 |
ForceField* getForceField() { |
269 |
return forceField_; |
270 |
} |
271 |
|
272 |
Globals* getSimParams() { |
273 |
return simParams_; |
274 |
} |
275 |
|
276 |
/** Returns the velocity of center of mass of the whole system.*/ |
277 |
Vector3d getComVel(); |
278 |
|
279 |
/** Returns the center of the mass of the whole system.*/ |
280 |
Vector3d getCom(); |
281 |
/** Returns the center of the mass and Center of Mass velocity of |
282 |
the whole system.*/ |
283 |
void getComAll(Vector3d& com,Vector3d& comVel); |
284 |
|
285 |
/** Returns intertia tensor for the entire system and system |
286 |
Angular Momentum.*/ |
287 |
void getInertiaTensor(Mat3x3d &intertiaTensor,Vector3d &angularMomentum); |
288 |
|
289 |
/** Returns system angular momentum */ |
290 |
Vector3d getAngularMomentum(); |
291 |
|
292 |
/** Returns volume of system as estimated by an ellipsoid defined |
293 |
by the radii of gyration*/ |
294 |
void getGyrationalVolume(RealType &vol); |
295 |
/** Overloaded version of gyrational volume that also returns |
296 |
det(I) so dV/dr can be calculated*/ |
297 |
void getGyrationalVolume(RealType &vol, RealType &detI); |
298 |
|
299 |
void update(); |
300 |
/** |
301 |
* Do final bookkeeping before Force managers need their data. |
302 |
*/ |
303 |
void prepareTopology(); |
304 |
|
305 |
|
306 |
/** Returns the local index manager */ |
307 |
LocalIndexManager* getLocalIndexManager() { |
308 |
return &localIndexMan_; |
309 |
} |
310 |
|
311 |
int getMoleculeStampId(int globalIndex) { |
312 |
//assert(globalIndex < molStampIds_.size()) |
313 |
return molStampIds_[globalIndex]; |
314 |
} |
315 |
|
316 |
/** Returns the molecule stamp */ |
317 |
MoleculeStamp* getMoleculeStamp(int id) { |
318 |
return moleculeStamps_[id]; |
319 |
} |
320 |
|
321 |
/** Return the total number of the molecule stamps */ |
322 |
int getNMoleculeStamp() { |
323 |
return moleculeStamps_.size(); |
324 |
} |
325 |
/** |
326 |
* Finds a molecule with a specified global index |
327 |
* @return a pointer point to found molecule |
328 |
* @param index |
329 |
*/ |
330 |
Molecule* getMoleculeByGlobalIndex(int index) { |
331 |
MoleculeIterator i; |
332 |
i = molecules_.find(index); |
333 |
|
334 |
return i != molecules_.end() ? i->second : NULL; |
335 |
} |
336 |
|
337 |
int getGlobalMolMembership(int id){ |
338 |
return globalMolMembership_[id]; |
339 |
} |
340 |
|
341 |
/** |
342 |
* returns a vector which maps the local atom index on this |
343 |
* processor to the global atom index. With only one processor, |
344 |
* these should be identical. |
345 |
*/ |
346 |
vector<int> getGlobalAtomIndices(); |
347 |
|
348 |
/** |
349 |
* returns a vector which maps the local cutoff group index on |
350 |
* this processor to the global cutoff group index. With only one |
351 |
* processor, these should be identical. |
352 |
*/ |
353 |
vector<int> getGlobalGroupIndices(); |
354 |
|
355 |
|
356 |
string getFinalConfigFileName() { |
357 |
return finalConfigFileName_; |
358 |
} |
359 |
|
360 |
void setFinalConfigFileName(const string& fileName) { |
361 |
finalConfigFileName_ = fileName; |
362 |
} |
363 |
|
364 |
string getRawMetaData() { |
365 |
return rawMetaData_; |
366 |
} |
367 |
void setRawMetaData(const string& rawMetaData) { |
368 |
rawMetaData_ = rawMetaData; |
369 |
} |
370 |
|
371 |
string getDumpFileName() { |
372 |
return dumpFileName_; |
373 |
} |
374 |
|
375 |
void setDumpFileName(const string& fileName) { |
376 |
dumpFileName_ = fileName; |
377 |
} |
378 |
|
379 |
string getStatFileName() { |
380 |
return statFileName_; |
381 |
} |
382 |
|
383 |
void setStatFileName(const string& fileName) { |
384 |
statFileName_ = fileName; |
385 |
} |
386 |
|
387 |
string getRestFileName() { |
388 |
return restFileName_; |
389 |
} |
390 |
|
391 |
void setRestFileName(const string& fileName) { |
392 |
restFileName_ = fileName; |
393 |
} |
394 |
|
395 |
/** |
396 |
* Sets GlobalGroupMembership |
397 |
* @see #SimCreator::setGlobalIndex |
398 |
*/ |
399 |
void setGlobalGroupMembership(const vector<int>& globalGroupMembership) { |
400 |
assert(globalGroupMembership.size() == static_cast<size_t>(nGlobalAtoms_)); |
401 |
globalGroupMembership_ = globalGroupMembership; |
402 |
} |
403 |
|
404 |
/** |
405 |
* Sets GlobalMolMembership |
406 |
* @see #SimCreator::setGlobalIndex |
407 |
*/ |
408 |
void setGlobalMolMembership(const vector<int>& globalMolMembership) { |
409 |
assert(globalMolMembership.size() == static_cast<size_t>(nGlobalAtoms_)); |
410 |
globalMolMembership_ = globalMolMembership; |
411 |
} |
412 |
|
413 |
|
414 |
bool isTopologyDone() { |
415 |
return topologyDone_; |
416 |
} |
417 |
|
418 |
bool getCalcBoxDipole() { |
419 |
return calcBoxDipole_; |
420 |
} |
421 |
|
422 |
bool getUseAtomicVirial() { |
423 |
return useAtomicVirial_; |
424 |
} |
425 |
|
426 |
/** |
427 |
* Adds property into property map |
428 |
* @param genData GenericData to be added into PropertyMap |
429 |
*/ |
430 |
void addProperty(GenericData* genData); |
431 |
|
432 |
/** |
433 |
* Removes property from PropertyMap by name |
434 |
* @param propName the name of property to be removed |
435 |
*/ |
436 |
void removeProperty(const string& propName); |
437 |
|
438 |
/** |
439 |
* clear all of the properties |
440 |
*/ |
441 |
void clearProperties(); |
442 |
|
443 |
/** |
444 |
* Returns all names of properties |
445 |
* @return all names of properties |
446 |
*/ |
447 |
vector<string> getPropertyNames(); |
448 |
|
449 |
/** |
450 |
* Returns all of the properties in PropertyMap |
451 |
* @return all of the properties in PropertyMap |
452 |
*/ |
453 |
vector<GenericData*> getProperties(); |
454 |
|
455 |
/** |
456 |
* Returns property |
457 |
* @param propName name of property |
458 |
* @return a pointer point to property with propName. If no property named propName |
459 |
* exists, return NULL |
460 |
*/ |
461 |
GenericData* getPropertyByName(const string& propName); |
462 |
|
463 |
/** |
464 |
* add all special interaction pairs (including excluded |
465 |
* interactions) in a molecule into the appropriate lists. |
466 |
*/ |
467 |
void addInteractionPairs(Molecule* mol); |
468 |
|
469 |
/** |
470 |
* remove all special interaction pairs which belong to a molecule |
471 |
* from the appropriate lists. |
472 |
*/ |
473 |
void removeInteractionPairs(Molecule* mol); |
474 |
|
475 |
/** Returns the set of atom types present in this simulation */ |
476 |
set<AtomType*> getSimulatedAtomTypes(); |
477 |
|
478 |
friend ostream& operator <<(ostream& o, SimInfo& info); |
479 |
|
480 |
void getCutoff(RealType& rcut, RealType& rsw); |
481 |
|
482 |
private: |
483 |
|
484 |
/** fill up the simtype struct and other simulation-related variables */ |
485 |
void setupSimVariables(); |
486 |
|
487 |
|
488 |
/** Determine if we need to accumulate the simulation box dipole */ |
489 |
void setupAccumulateBoxDipole(); |
490 |
|
491 |
/** Calculates the number of degress of freedom in the whole system */ |
492 |
void calcNdf(); |
493 |
void calcNdfRaw(); |
494 |
void calcNdfTrans(); |
495 |
|
496 |
/** |
497 |
* Adds molecule stamp and the total number of the molecule with |
498 |
* same molecule stamp in the whole system. |
499 |
*/ |
500 |
void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); |
501 |
|
502 |
// Other classes holdingn important information |
503 |
ForceField* forceField_; /**< provides access to defined atom types, bond types, etc. */ |
504 |
Globals* simParams_; /**< provides access to simulation parameters set by user */ |
505 |
|
506 |
/// Counts of local objects |
507 |
int nAtoms_; /**< number of atoms in local processor */ |
508 |
int nBonds_; /**< number of bonds in local processor */ |
509 |
int nBends_; /**< number of bends in local processor */ |
510 |
int nTorsions_; /**< number of torsions in local processor */ |
511 |
int nInversions_; /**< number of inversions in local processor */ |
512 |
int nRigidBodies_; /**< number of rigid bodies in local processor */ |
513 |
int nIntegrableObjects_; /**< number of integrable objects in local processor */ |
514 |
int nCutoffGroups_; /**< number of cutoff groups in local processor */ |
515 |
int nConstraints_; /**< number of constraints in local processors */ |
516 |
|
517 |
/// Counts of global objects |
518 |
int nGlobalMols_; /**< number of molecules in the system (GLOBAL) */ |
519 |
int nGlobalAtoms_; /**< number of atoms in the system (GLOBAL) */ |
520 |
int nGlobalCutoffGroups_; /**< number of cutoff groups in this system (GLOBAL) */ |
521 |
int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ |
522 |
int nGlobalRigidBodies_; /**< number of rigid bodies in this system (GLOBAL) */ |
523 |
|
524 |
/// Degress of freedom |
525 |
int ndf_; /**< number of degress of freedom (excludes constraints) (LOCAL) */ |
526 |
int fdf_local; /**< number of frozen degrees of freedom (LOCAL) */ |
527 |
int fdf_; /**< number of frozen degrees of freedom (GLOBAL) */ |
528 |
int ndfRaw_; /**< number of degress of freedom (includes constraints), (LOCAL) */ |
529 |
int ndfTrans_; /**< number of translation degress of freedom, (LOCAL) */ |
530 |
int nZconstraint_; /**< number of z-constraint molecules (GLOBAL) */ |
531 |
|
532 |
/// logicals |
533 |
bool usesPeriodicBoundaries_; /**< use periodic boundary conditions? */ |
534 |
bool usesDirectionalAtoms_; /**< are there atoms with position AND orientation? */ |
535 |
bool usesMetallicAtoms_; /**< are there transition metal atoms? */ |
536 |
bool usesElectrostaticAtoms_; /**< are there electrostatic atoms? */ |
537 |
bool usesAtomicVirial_; /**< are we computing atomic virials? */ |
538 |
bool requiresPrepair_; /**< does this simulation require a pre-pair loop? */ |
539 |
bool requiresSkipCorrection_; /**< does this simulation require a skip-correction? */ |
540 |
bool requiresSelfCorrection_; /**< does this simulation require a self-correction? */ |
541 |
|
542 |
public: |
543 |
bool usesElectrostaticAtoms() { return usesElectrostaticAtoms_; } |
544 |
bool usesDirectionalAtoms() { return usesDirectionalAtoms_; } |
545 |
bool usesMetallicAtoms() { return usesMetallicAtoms_; } |
546 |
bool usesAtomicVirial() { return usesAtomicVirial_; } |
547 |
bool requiresPrepair() { return requiresPrepair_; } |
548 |
bool requiresSkipCorrection() { return requiresSkipCorrection_;} |
549 |
bool requiresSelfCorrection() { return requiresSelfCorrection_;} |
550 |
|
551 |
private: |
552 |
/// Data structures holding primary simulation objects |
553 |
map<int, Molecule*> molecules_; /**< map holding pointers to LOCAL molecules */ |
554 |
|
555 |
/// Stamps are templates for objects that are then used to create |
556 |
/// groups of objects. For example, a molecule stamp contains |
557 |
/// information on how to build that molecule (i.e. the topology, |
558 |
/// the atoms, the bonds, etc.) Once the system is built, the |
559 |
/// stamps are no longer useful. |
560 |
vector<int> molStampIds_; /**< stamp id for molecules in the system */ |
561 |
vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
562 |
|
563 |
/** |
564 |
* A vector that maps between the global index of an atom, and the |
565 |
* global index of cutoff group the atom belong to. It is filled |
566 |
* by SimCreator once and only once, since it never changed during |
567 |
* the simulation. It should be nGlobalAtoms_ in size. |
568 |
*/ |
569 |
vector<int> globalGroupMembership_; |
570 |
public: |
571 |
vector<int> getGlobalGroupMembership() { return globalGroupMembership_; } |
572 |
private: |
573 |
|
574 |
/** |
575 |
* A vector that maps between the global index of an atom and the |
576 |
* global index of the molecule the atom belongs to. It is filled |
577 |
* by SimCreator once and only once, since it is never changed |
578 |
* during the simulation. It shoudl be nGlobalAtoms_ in size. |
579 |
*/ |
580 |
vector<int> globalMolMembership_; |
581 |
|
582 |
/** |
583 |
* A vector that maps between the local index of an atom and the |
584 |
* index of the AtomType. |
585 |
*/ |
586 |
vector<int> identArray_; |
587 |
public: |
588 |
vector<int> getIdentArray() { return identArray_; } |
589 |
private: |
590 |
|
591 |
/** |
592 |
* A vector which contains the fractional contribution of an |
593 |
* atom's mass to the total mass of the cutoffGroup that atom |
594 |
* belongs to. In the case of single atom cutoff groups, the mass |
595 |
* factor for that atom is 1. For massless atoms, the factor is |
596 |
* also 1. |
597 |
*/ |
598 |
vector<RealType> massFactors_; |
599 |
public: |
600 |
vector<RealType> getMassFactors() { return massFactors_; } |
601 |
|
602 |
PairList getExcludedInteractions() { return excludedInteractions_; } |
603 |
PairList getOneTwoInteractions() { return oneTwoInteractions_; } |
604 |
PairList getOneThreeInteractions() { return oneThreeInteractions_; } |
605 |
PairList getOneFourInteractions() { return oneFourInteractions_; } |
606 |
|
607 |
private: |
608 |
|
609 |
|
610 |
/// lists to handle atoms needing special treatment in the non-bonded interactions |
611 |
PairList excludedInteractions_; /**< atoms excluded from interacting with each other */ |
612 |
PairList oneTwoInteractions_; /**< atoms that are directly Bonded */ |
613 |
PairList oneThreeInteractions_; /**< atoms sharing a Bend */ |
614 |
PairList oneFourInteractions_; /**< atoms sharing a Torsion */ |
615 |
|
616 |
PropertyMap properties_; /**< Generic Properties can be added */ |
617 |
SnapshotManager* sman_; /**< SnapshotManager (handles particle positions, etc.) */ |
618 |
|
619 |
/** |
620 |
* The reason to have a local index manager is that when molecule |
621 |
* is migrating to other processors, the atoms and the |
622 |
* rigid-bodies will release their local indices to |
623 |
* LocalIndexManager. Combining the information of molecule |
624 |
* migrating to current processor, Migrator class can query the |
625 |
* LocalIndexManager to make a efficient data moving plan. |
626 |
*/ |
627 |
LocalIndexManager localIndexMan_; |
628 |
|
629 |
// unparsed MetaData block for storing in Dump and EOR files: |
630 |
string rawMetaData_; |
631 |
|
632 |
// file names |
633 |
string finalConfigFileName_; |
634 |
string dumpFileName_; |
635 |
string statFileName_; |
636 |
string restFileName_; |
637 |
|
638 |
|
639 |
bool topologyDone_; /** flag to indicate whether the topology has |
640 |
been scanned and all the relevant |
641 |
bookkeeping has been done*/ |
642 |
|
643 |
bool calcBoxDipole_; /**< flag to indicate whether or not we calculate |
644 |
the simulation box dipole moment */ |
645 |
|
646 |
bool useAtomicVirial_; /**< flag to indicate whether or not we use |
647 |
Atomic Virials to calculate the pressure */ |
648 |
|
649 |
public: |
650 |
/** |
651 |
* return an integral objects by its global index. In MPI |
652 |
* version, if the StuntDouble with specified global index does |
653 |
* not belong to local processor, a NULL will be return. |
654 |
*/ |
655 |
StuntDouble* getIOIndexToIntegrableObject(int index); |
656 |
void setIOIndexToIntegrableObject(const vector<StuntDouble*>& v); |
657 |
|
658 |
private: |
659 |
vector<StuntDouble*> IOIndexToIntegrableObject; |
660 |
|
661 |
public: |
662 |
|
663 |
/** |
664 |
* Finds the processor where a molecule resides |
665 |
* @return the id of the processor which contains the molecule |
666 |
* @param globalIndex global Index of the molecule |
667 |
*/ |
668 |
int getMolToProc(int globalIndex) { |
669 |
//assert(globalIndex < molToProcMap_.size()); |
670 |
return molToProcMap_[globalIndex]; |
671 |
} |
672 |
|
673 |
/** |
674 |
* Set MolToProcMap array |
675 |
* @see #SimCreator::divideMolecules |
676 |
*/ |
677 |
void setMolToProcMap(const vector<int>& molToProcMap) { |
678 |
molToProcMap_ = molToProcMap; |
679 |
} |
680 |
|
681 |
private: |
682 |
|
683 |
/** |
684 |
* The size of molToProcMap_ is equal to total number of molecules |
685 |
* in the system. It maps a molecule to the processor on which it |
686 |
* resides. it is filled by SimCreator once and only once. |
687 |
*/ |
688 |
vector<int> molToProcMap_; |
689 |
|
690 |
}; |
691 |
|
692 |
} //namespace OpenMD |
693 |
#endif //BRAINS_SIMMODEL_HPP |
694 |
|