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 |
9 |
> |
* 1. Redistributions of source code must retain the above copyright |
10 |
|
* notice, this list of conditions and the following disclaimer. |
11 |
|
* |
12 |
< |
* 3. Redistributions in binary form must reproduce the above copyright |
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. |
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] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
40 |
+ |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
41 |
|
*/ |
42 |
|
|
43 |
|
/** |
55 |
|
#include <utility> |
56 |
|
#include <vector> |
57 |
|
|
58 |
< |
#include "brains/Exclude.hpp" |
58 |
> |
#include "brains/PairList.hpp" |
59 |
|
#include "io/Globals.hpp" |
60 |
|
#include "math/Vector3.hpp" |
61 |
|
#include "math/SquareMatrix3.hpp" |
63 |
|
#include "UseTheForce/ForceField.hpp" |
64 |
|
#include "utils/PropertyMap.hpp" |
65 |
|
#include "utils/LocalIndexManager.hpp" |
66 |
+ |
#include "nonbonded/SwitchingFunction.hpp" |
67 |
|
|
68 |
< |
//another nonsense macro declaration |
69 |
< |
#define __C |
70 |
< |
#include "brains/fSimulation.h" |
69 |
< |
|
70 |
< |
namespace oopse{ |
71 |
< |
|
72 |
< |
//forward decalration |
68 |
> |
using namespace std; |
69 |
> |
namespace OpenMD{ |
70 |
> |
//forward declaration |
71 |
|
class SnapshotManager; |
72 |
|
class Molecule; |
73 |
|
class SelectionManager; |
74 |
+ |
class StuntDouble; |
75 |
+ |
|
76 |
|
/** |
77 |
< |
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
78 |
< |
* @brief As one of the heavy weight class of OOPSE, SimInfo |
79 |
< |
* One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules. |
80 |
< |
* And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies, |
81 |
< |
* cutoff groups, constrains). |
82 |
< |
* Another major change is the index. No matter single version or parallel version, atoms and |
83 |
< |
* rigid bodies have both global index and local index. Local index is not important to molecule as well as |
84 |
< |
* cutoff group. |
77 |
> |
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
78 |
> |
* |
79 |
> |
* @brief One of the heavy-weight classes of OpenMD, SimInfo |
80 |
> |
* maintains objects and variables relating to the current |
81 |
> |
* simulation. This includes the master list of Molecules. The |
82 |
> |
* Molecule class maintains all of the concrete objects (Atoms, |
83 |
> |
* Bond, Bend, Torsions, Inversions, RigidBodies, CutoffGroups, |
84 |
> |
* Constraints). In both the single and parallel versions, Atoms and |
85 |
> |
* RigidBodies have both global and local indices. |
86 |
|
*/ |
87 |
|
class SimInfo { |
88 |
|
public: |
89 |
< |
typedef std::map<int, Molecule*>::iterator MoleculeIterator; |
90 |
< |
|
89 |
> |
typedef map<int, Molecule*>::iterator MoleculeIterator; |
90 |
> |
|
91 |
|
/** |
92 |
|
* Constructor of SimInfo |
93 |
< |
* @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the |
94 |
< |
* second element is the total number of molecules with the same molecule stamp in the system |
93 |
> |
* |
94 |
> |
* @param molStampPairs MoleculeStamp Array. The first element of |
95 |
> |
* the pair is molecule stamp, the second element is the total |
96 |
> |
* number of molecules with the same molecule stamp in the system |
97 |
> |
* |
98 |
|
* @param ff pointer of a concrete ForceField instance |
99 |
+ |
* |
100 |
|
* @param simParams |
96 |
– |
* @note |
101 |
|
*/ |
102 |
|
SimInfo(ForceField* ff, Globals* simParams); |
103 |
|
virtual ~SimInfo(); |
104 |
|
|
105 |
|
/** |
106 |
|
* Adds a molecule |
107 |
< |
* @return return true if adding successfully, return false if the molecule is already in SimInfo |
107 |
> |
* |
108 |
> |
* @return return true if adding successfully, return false if the |
109 |
> |
* molecule is already in SimInfo |
110 |
> |
* |
111 |
|
* @param mol molecule to be added |
112 |
|
*/ |
113 |
|
bool addMolecule(Molecule* mol); |
114 |
|
|
115 |
|
/** |
116 |
|
* Removes a molecule from SimInfo |
117 |
< |
* @return true if removing successfully, return false if molecule is not in this SimInfo |
117 |
> |
* |
118 |
> |
* @return true if removing successfully, return false if molecule |
119 |
> |
* is not in this SimInfo |
120 |
|
*/ |
121 |
|
bool removeMolecule(Molecule* mol); |
122 |
|
|
136 |
|
} |
137 |
|
|
138 |
|
/** |
139 |
< |
* Returns the total number of integrable objects (total number of rigid bodies plus the total number |
140 |
< |
* of atoms which do not belong to the rigid bodies) in the system |
139 |
> |
* Returns the total number of integrable objects (total number of |
140 |
> |
* rigid bodies plus the total number of atoms which do not belong |
141 |
> |
* to the rigid bodies) in the system |
142 |
|
*/ |
143 |
|
int getNGlobalIntegrableObjects() { |
144 |
|
return nGlobalIntegrableObjects_; |
145 |
|
} |
146 |
|
|
147 |
|
/** |
148 |
< |
* Returns the total number of integrable objects (total number of rigid bodies plus the total number |
149 |
< |
* of atoms which do not belong to the rigid bodies) in the system |
148 |
> |
* Returns the total number of integrable objects (total number of |
149 |
> |
* rigid bodies plus the total number of atoms which do not belong |
150 |
> |
* to the rigid bodies) in the system |
151 |
|
*/ |
152 |
|
int getNGlobalRigidBodies() { |
153 |
|
return nGlobalRigidBodies_; |
167 |
|
return nAtoms_; |
168 |
|
} |
169 |
|
|
170 |
+ |
/** Returns the number of effective cutoff groups on local processor */ |
171 |
+ |
unsigned int getNLocalCutoffGroups(); |
172 |
+ |
|
173 |
|
/** Returns the number of local bonds */ |
174 |
|
unsigned int getNBonds(){ |
175 |
|
return nBonds_; |
185 |
|
return nTorsions_; |
186 |
|
} |
187 |
|
|
188 |
+ |
/** Returns the number of local torsions */ |
189 |
+ |
unsigned int getNInversions() { |
190 |
+ |
return nInversions_; |
191 |
+ |
} |
192 |
|
/** Returns the number of local rigid bodies */ |
193 |
|
unsigned int getNRigidBodies() { |
194 |
|
return nRigidBodies_; |
223 |
|
*/ |
224 |
|
Molecule* nextMolecule(MoleculeIterator& i); |
225 |
|
|
226 |
+ |
/** Returns the total number of fluctuating charges that are present */ |
227 |
+ |
int getNFluctuatingCharges() { |
228 |
+ |
return nGlobalFluctuatingCharges_; |
229 |
+ |
} |
230 |
+ |
|
231 |
|
/** Returns the number of degrees of freedom */ |
232 |
|
int getNdf() { |
233 |
< |
return ndf_; |
233 |
> |
return ndf_ - getFdf(); |
234 |
|
} |
235 |
|
|
236 |
|
/** Returns the number of raw degrees of freedom */ |
243 |
|
return ndfTrans_; |
244 |
|
} |
245 |
|
|
246 |
< |
//getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying |
246 |
> |
/** sets the current number of frozen degrees of freedom */ |
247 |
> |
void setFdf(int fdf) { |
248 |
> |
fdf_local = fdf; |
249 |
> |
} |
250 |
> |
|
251 |
> |
int getFdf(); |
252 |
> |
|
253 |
> |
//getNZconstraint and setNZconstraint ruin the coherence of |
254 |
> |
//SimInfo class, need refactoring |
255 |
|
|
256 |
|
/** Returns the total number of z-constraint molecules in the system */ |
257 |
|
int getNZconstraint() { |
287 |
|
|
288 |
|
/** Returns the center of the mass of the whole system.*/ |
289 |
|
Vector3d getCom(); |
290 |
< |
/** Returns the center of the mass and Center of Mass velocity of the whole system.*/ |
290 |
> |
/** Returns the center of the mass and Center of Mass velocity of |
291 |
> |
the whole system.*/ |
292 |
|
void getComAll(Vector3d& com,Vector3d& comVel); |
293 |
|
|
294 |
< |
/** Returns intertia tensor for the entire system and system Angular Momentum.*/ |
294 |
> |
/** Returns intertia tensor for the entire system and system |
295 |
> |
Angular Momentum.*/ |
296 |
|
void getInertiaTensor(Mat3x3d &intertiaTensor,Vector3d &angularMomentum); |
297 |
|
|
298 |
|
/** Returns system angular momentum */ |
299 |
|
Vector3d getAngularMomentum(); |
300 |
|
|
301 |
< |
/** main driver function to interact with fortran during the initialization and molecule migration */ |
301 |
> |
/** Returns volume of system as estimated by an ellipsoid defined |
302 |
> |
by the radii of gyration*/ |
303 |
> |
void getGyrationalVolume(RealType &vol); |
304 |
> |
/** Overloaded version of gyrational volume that also returns |
305 |
> |
det(I) so dV/dr can be calculated*/ |
306 |
> |
void getGyrationalVolume(RealType &vol, RealType &detI); |
307 |
> |
|
308 |
|
void update(); |
309 |
+ |
/** |
310 |
+ |
* Do final bookkeeping before Force managers need their data. |
311 |
+ |
*/ |
312 |
+ |
void prepareTopology(); |
313 |
|
|
314 |
+ |
|
315 |
|
/** Returns the local index manager */ |
316 |
|
LocalIndexManager* getLocalIndexManager() { |
317 |
|
return &localIndexMan_; |
341 |
|
i = molecules_.find(index); |
342 |
|
|
343 |
|
return i != molecules_.end() ? i->second : NULL; |
300 |
– |
} |
301 |
– |
|
302 |
– |
double getRcut() { |
303 |
– |
return rcut_; |
304 |
– |
} |
305 |
– |
|
306 |
– |
double getRsw() { |
307 |
– |
return rsw_; |
344 |
|
} |
345 |
|
|
346 |
< |
double getList() { |
347 |
< |
return rlist_; |
346 |
> |
int getGlobalMolMembership(int id){ |
347 |
> |
return globalMolMembership_[id]; |
348 |
|
} |
349 |
+ |
|
350 |
+ |
/** |
351 |
+ |
* returns a vector which maps the local atom index on this |
352 |
+ |
* processor to the global atom index. With only one processor, |
353 |
+ |
* these should be identical. |
354 |
+ |
*/ |
355 |
+ |
vector<int> getGlobalAtomIndices(); |
356 |
+ |
|
357 |
+ |
/** |
358 |
+ |
* returns a vector which maps the local cutoff group index on |
359 |
+ |
* this processor to the global cutoff group index. With only one |
360 |
+ |
* processor, these should be identical. |
361 |
+ |
*/ |
362 |
+ |
vector<int> getGlobalGroupIndices(); |
363 |
+ |
|
364 |
|
|
365 |
< |
std::string getFinalConfigFileName() { |
365 |
> |
string getFinalConfigFileName() { |
366 |
|
return finalConfigFileName_; |
367 |
|
} |
368 |
< |
|
369 |
< |
void setFinalConfigFileName(const std::string& fileName) { |
368 |
> |
|
369 |
> |
void setFinalConfigFileName(const string& fileName) { |
370 |
|
finalConfigFileName_ = fileName; |
371 |
|
} |
372 |
|
|
373 |
< |
std::string getDumpFileName() { |
373 |
> |
string getRawMetaData() { |
374 |
> |
return rawMetaData_; |
375 |
> |
} |
376 |
> |
void setRawMetaData(const string& rawMetaData) { |
377 |
> |
rawMetaData_ = rawMetaData; |
378 |
> |
} |
379 |
> |
|
380 |
> |
string getDumpFileName() { |
381 |
|
return dumpFileName_; |
382 |
|
} |
383 |
|
|
384 |
< |
void setDumpFileName(const std::string& fileName) { |
384 |
> |
void setDumpFileName(const string& fileName) { |
385 |
|
dumpFileName_ = fileName; |
386 |
|
} |
387 |
|
|
388 |
< |
std::string getStatFileName() { |
388 |
> |
string getStatFileName() { |
389 |
|
return statFileName_; |
390 |
|
} |
391 |
|
|
392 |
< |
void setStatFileName(const std::string& fileName) { |
392 |
> |
void setStatFileName(const string& fileName) { |
393 |
|
statFileName_ = fileName; |
394 |
|
} |
395 |
|
|
396 |
< |
std::string getRestFileName() { |
396 |
> |
string getRestFileName() { |
397 |
|
return restFileName_; |
398 |
|
} |
399 |
|
|
400 |
< |
void setRestFileName(const std::string& fileName) { |
400 |
> |
void setRestFileName(const string& fileName) { |
401 |
|
restFileName_ = fileName; |
402 |
|
} |
403 |
|
|
405 |
|
* Sets GlobalGroupMembership |
406 |
|
* @see #SimCreator::setGlobalIndex |
407 |
|
*/ |
408 |
< |
void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) { |
409 |
< |
assert(globalGroupMembership.size() == nGlobalAtoms_); |
408 |
> |
void setGlobalGroupMembership(const vector<int>& globalGroupMembership) { |
409 |
> |
assert(globalGroupMembership.size() == static_cast<size_t>(nGlobalAtoms_)); |
410 |
|
globalGroupMembership_ = globalGroupMembership; |
411 |
|
} |
412 |
|
|
414 |
|
* Sets GlobalMolMembership |
415 |
|
* @see #SimCreator::setGlobalIndex |
416 |
|
*/ |
417 |
< |
void setGlobalMolMembership(const std::vector<int>& globalMolMembership) { |
418 |
< |
assert(globalMolMembership.size() == nGlobalAtoms_); |
417 |
> |
void setGlobalMolMembership(const vector<int>& globalMolMembership) { |
418 |
> |
assert(globalMolMembership.size() == static_cast<size_t>(nGlobalAtoms_)); |
419 |
|
globalMolMembership_ = globalMolMembership; |
420 |
|
} |
421 |
|
|
422 |
|
|
423 |
< |
bool isFortranInitialized() { |
424 |
< |
return fortranInitialized_; |
423 |
> |
bool isTopologyDone() { |
424 |
> |
return topologyDone_; |
425 |
|
} |
426 |
|
|
427 |
< |
//below functions are just forward functions |
428 |
< |
//To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the |
429 |
< |
//the other hand, has-a relation need composing. |
427 |
> |
bool getCalcBoxDipole() { |
428 |
> |
return calcBoxDipole_; |
429 |
> |
} |
430 |
> |
|
431 |
> |
bool getUseAtomicVirial() { |
432 |
> |
return useAtomicVirial_; |
433 |
> |
} |
434 |
> |
|
435 |
|
/** |
436 |
|
* Adds property into property map |
437 |
|
* @param genData GenericData to be added into PropertyMap |
442 |
|
* Removes property from PropertyMap by name |
443 |
|
* @param propName the name of property to be removed |
444 |
|
*/ |
445 |
< |
void removeProperty(const std::string& propName); |
445 |
> |
void removeProperty(const string& propName); |
446 |
|
|
447 |
|
/** |
448 |
|
* clear all of the properties |
453 |
|
* Returns all names of properties |
454 |
|
* @return all names of properties |
455 |
|
*/ |
456 |
< |
std::vector<std::string> getPropertyNames(); |
456 |
> |
vector<string> getPropertyNames(); |
457 |
|
|
458 |
|
/** |
459 |
|
* Returns all of the properties in PropertyMap |
460 |
|
* @return all of the properties in PropertyMap |
461 |
|
*/ |
462 |
< |
std::vector<GenericData*> getProperties(); |
462 |
> |
vector<GenericData*> getProperties(); |
463 |
|
|
464 |
|
/** |
465 |
|
* Returns property |
467 |
|
* @return a pointer point to property with propName. If no property named propName |
468 |
|
* exists, return NULL |
469 |
|
*/ |
470 |
< |
GenericData* getPropertyByName(const std::string& propName); |
470 |
> |
GenericData* getPropertyByName(const string& propName); |
471 |
|
|
472 |
|
/** |
473 |
< |
* add all exclude pairs of a molecule into exclude list. |
473 |
> |
* add all special interaction pairs (including excluded |
474 |
> |
* interactions) in a molecule into the appropriate lists. |
475 |
|
*/ |
476 |
< |
void addExcludePairs(Molecule* mol); |
476 |
> |
void addInteractionPairs(Molecule* mol); |
477 |
|
|
478 |
|
/** |
479 |
< |
* remove all exclude pairs which belong to a molecule from exclude list |
479 |
> |
* remove all special interaction pairs which belong to a molecule |
480 |
> |
* from the appropriate lists. |
481 |
|
*/ |
482 |
+ |
void removeInteractionPairs(Molecule* mol); |
483 |
|
|
484 |
< |
void removeExcludePairs(Molecule* mol); |
485 |
< |
|
420 |
< |
|
421 |
< |
/** Returns the unique atom types of local processor in an array */ |
422 |
< |
std::set<AtomType*> getUniqueAtomTypes(); |
484 |
> |
/** Returns the set of atom types present in this simulation */ |
485 |
> |
set<AtomType*> getSimulatedAtomTypes(); |
486 |
|
|
487 |
< |
friend std::ostream& operator <<(std::ostream& o, SimInfo& info); |
487 |
> |
friend ostream& operator <<(ostream& o, SimInfo& info); |
488 |
|
|
489 |
< |
void getCutoff(double& rcut, double& rsw); |
489 |
> |
void getCutoff(RealType& rcut, RealType& rsw); |
490 |
|
|
491 |
|
private: |
492 |
|
|
493 |
< |
/** fill up the simtype struct*/ |
494 |
< |
void setupSimType(); |
493 |
> |
/** fill up the simtype struct and other simulation-related variables */ |
494 |
> |
void setupSimVariables(); |
495 |
|
|
433 |
– |
/** |
434 |
– |
* Setup Fortran Simulation |
435 |
– |
* @see #setupFortranParallel |
436 |
– |
*/ |
437 |
– |
void setupFortranSim(); |
496 |
|
|
497 |
< |
/** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ |
498 |
< |
void setupCutoff(); |
441 |
< |
|
442 |
< |
/** Figure out which coulombic correction method to use and pass to fortran */ |
443 |
< |
void setupElectrostaticSummationMethod( int isError ); |
444 |
< |
|
445 |
< |
/** Figure out which polynomial type to use for the switching function */ |
446 |
< |
void setupSwitchingFunction(); |
497 |
> |
/** Determine if we need to accumulate the simulation box dipole */ |
498 |
> |
void setupAccumulateBoxDipole(); |
499 |
|
|
500 |
|
/** Calculates the number of degress of freedom in the whole system */ |
501 |
|
void calcNdf(); |
502 |
|
void calcNdfRaw(); |
503 |
|
void calcNdfTrans(); |
504 |
|
|
453 |
– |
ForceField* forceField_; |
454 |
– |
Globals* simParams_; |
455 |
– |
|
456 |
– |
std::map<int, Molecule*> molecules_; /**< Molecule array */ |
457 |
– |
|
505 |
|
/** |
506 |
< |
* Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole |
507 |
< |
* system. |
506 |
> |
* Adds molecule stamp and the total number of the molecule with |
507 |
> |
* same molecule stamp in the whole system. |
508 |
|
*/ |
509 |
|
void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); |
510 |
+ |
|
511 |
+ |
// Other classes holdingn important information |
512 |
+ |
ForceField* forceField_; /**< provides access to defined atom types, bond types, etc. */ |
513 |
+ |
Globals* simParams_; /**< provides access to simulation parameters set by user */ |
514 |
+ |
|
515 |
+ |
/// Counts of local objects |
516 |
+ |
int nAtoms_; /**< number of atoms in local processor */ |
517 |
+ |
int nBonds_; /**< number of bonds in local processor */ |
518 |
+ |
int nBends_; /**< number of bends in local processor */ |
519 |
+ |
int nTorsions_; /**< number of torsions in local processor */ |
520 |
+ |
int nInversions_; /**< number of inversions in local processor */ |
521 |
+ |
int nRigidBodies_; /**< number of rigid bodies in local processor */ |
522 |
+ |
int nIntegrableObjects_; /**< number of integrable objects in local processor */ |
523 |
+ |
int nCutoffGroups_; /**< number of cutoff groups in local processor */ |
524 |
+ |
int nConstraints_; /**< number of constraints in local processors */ |
525 |
+ |
int nFluctuatingCharges_; /**< number of fluctuating charges in local processor */ |
526 |
|
|
527 |
< |
//degress of freedom |
528 |
< |
int ndf_; /**< number of degress of freedom (excludes constraints), ndf_ is local */ |
529 |
< |
int ndfRaw_; /**< number of degress of freedom (includes constraints), ndfRaw_ is local */ |
530 |
< |
int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ |
468 |
< |
int nZconstraint_; /** number of z-constraint molecules, nZconstraint_ is global */ |
469 |
< |
|
470 |
< |
//number of global objects |
471 |
< |
int nGlobalMols_; /**< number of molecules in the system */ |
472 |
< |
int nGlobalAtoms_; /**< number of atoms in the system */ |
473 |
< |
int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */ |
527 |
> |
/// Counts of global objects |
528 |
> |
int nGlobalMols_; /**< number of molecules in the system (GLOBAL) */ |
529 |
> |
int nGlobalAtoms_; /**< number of atoms in the system (GLOBAL) */ |
530 |
> |
int nGlobalCutoffGroups_; /**< number of cutoff groups in this system (GLOBAL) */ |
531 |
|
int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ |
532 |
< |
int nGlobalRigidBodies_; /**< number of rigid bodies in this system */ |
532 |
> |
int nGlobalRigidBodies_; /**< number of rigid bodies in this system (GLOBAL) */ |
533 |
> |
int nGlobalFluctuatingCharges_;/**< number of fluctuating charges in this system (GLOBAL) */ |
534 |
> |
|
535 |
> |
|
536 |
> |
/// Degress of freedom |
537 |
> |
int ndf_; /**< number of degress of freedom (excludes constraints) (LOCAL) */ |
538 |
> |
int fdf_local; /**< number of frozen degrees of freedom (LOCAL) */ |
539 |
> |
int fdf_; /**< number of frozen degrees of freedom (GLOBAL) */ |
540 |
> |
int ndfRaw_; /**< number of degress of freedom (includes constraints), (LOCAL) */ |
541 |
> |
int ndfTrans_; /**< number of translation degress of freedom, (LOCAL) */ |
542 |
> |
int nZconstraint_; /**< number of z-constraint molecules (GLOBAL) */ |
543 |
> |
|
544 |
> |
/// logicals |
545 |
> |
bool usesPeriodicBoundaries_; /**< use periodic boundary conditions? */ |
546 |
> |
bool usesDirectionalAtoms_; /**< are there atoms with position AND orientation? */ |
547 |
> |
bool usesMetallicAtoms_; /**< are there transition metal atoms? */ |
548 |
> |
bool usesElectrostaticAtoms_; /**< are there electrostatic atoms? */ |
549 |
> |
bool usesFluctuatingCharges_; /**< are there fluctuating charges? */ |
550 |
> |
bool usesAtomicVirial_; /**< are we computing atomic virials? */ |
551 |
> |
bool requiresPrepair_; /**< does this simulation require a pre-pair loop? */ |
552 |
> |
bool requiresSkipCorrection_; /**< does this simulation require a skip-correction? */ |
553 |
> |
bool requiresSelfCorrection_; /**< does this simulation require a self-correction? */ |
554 |
> |
|
555 |
> |
public: |
556 |
> |
bool usesElectrostaticAtoms() { return usesElectrostaticAtoms_; } |
557 |
> |
bool usesDirectionalAtoms() { return usesDirectionalAtoms_; } |
558 |
> |
bool usesFluctuatingCharges() { return usesFluctuatingCharges_; } |
559 |
> |
bool usesAtomicVirial() { return usesAtomicVirial_; } |
560 |
> |
bool requiresPrepair() { return requiresPrepair_; } |
561 |
> |
bool requiresSkipCorrection() { return requiresSkipCorrection_;} |
562 |
> |
bool requiresSelfCorrection() { return requiresSelfCorrection_;} |
563 |
> |
|
564 |
> |
private: |
565 |
> |
/// Data structures holding primary simulation objects |
566 |
> |
map<int, Molecule*> molecules_; /**< map holding pointers to LOCAL molecules */ |
567 |
> |
|
568 |
> |
/// Stamps are templates for objects that are then used to create |
569 |
> |
/// groups of objects. For example, a molecule stamp contains |
570 |
> |
/// information on how to build that molecule (i.e. the topology, |
571 |
> |
/// the atoms, the bonds, etc.) Once the system is built, the |
572 |
> |
/// stamps are no longer useful. |
573 |
> |
vector<int> molStampIds_; /**< stamp id for molecules in the system */ |
574 |
> |
vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
575 |
> |
|
576 |
|
/** |
577 |
< |
* the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
578 |
< |
* corresponding content is the global index of cutoff group this atom belong to. |
579 |
< |
* It is filled by SimCreator once and only once, since it never changed during the simulation. |
577 |
> |
* A vector that maps between the global index of an atom, and the |
578 |
> |
* global index of cutoff group the atom belong to. It is filled |
579 |
> |
* by SimCreator once and only once, since it never changed during |
580 |
> |
* the simulation. It should be nGlobalAtoms_ in size. |
581 |
|
*/ |
582 |
< |
std::vector<int> globalGroupMembership_; |
582 |
> |
vector<int> globalGroupMembership_; |
583 |
> |
public: |
584 |
> |
vector<int> getGlobalGroupMembership() { return globalGroupMembership_; } |
585 |
> |
private: |
586 |
|
|
587 |
|
/** |
588 |
< |
* the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
589 |
< |
* corresponding content is the global index of molecule this atom belong to. |
590 |
< |
* It is filled by SimCreator once and only once, since it is never changed during the simulation. |
588 |
> |
* A vector that maps between the global index of an atom and the |
589 |
> |
* global index of the molecule the atom belongs to. It is filled |
590 |
> |
* by SimCreator once and only once, since it is never changed |
591 |
> |
* during the simulation. It shoudl be nGlobalAtoms_ in size. |
592 |
|
*/ |
593 |
< |
std::vector<int> globalMolMembership_; |
593 |
> |
vector<int> globalMolMembership_; |
594 |
|
|
595 |
< |
|
596 |
< |
std::vector<int> molStampIds_; /**< stamp id array of all molecules in the system */ |
597 |
< |
std::vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
598 |
< |
|
599 |
< |
//number of local objects |
600 |
< |
int nAtoms_; /**< number of atoms in local processor */ |
601 |
< |
int nBonds_; /**< number of bonds in local processor */ |
602 |
< |
int nBends_; /**< number of bends in local processor */ |
603 |
< |
int nTorsions_; /**< number of torsions in local processor */ |
604 |
< |
int nRigidBodies_; /**< number of rigid bodies in local processor */ |
605 |
< |
int nIntegrableObjects_; /**< number of integrable objects in local processor */ |
606 |
< |
int nCutoffGroups_; /**< number of cutoff groups in local processor */ |
607 |
< |
int nConstraints_; /**< number of constraints in local processors */ |
595 |
> |
/** |
596 |
> |
* A vector that maps between the local index of an atom and the |
597 |
> |
* index of the AtomType. |
598 |
> |
*/ |
599 |
> |
vector<int> identArray_; |
600 |
> |
public: |
601 |
> |
vector<int> getIdentArray() { return identArray_; } |
602 |
> |
private: |
603 |
> |
|
604 |
> |
/** |
605 |
> |
* A vector which contains the fractional contribution of an |
606 |
> |
* atom's mass to the total mass of the cutoffGroup that atom |
607 |
> |
* belongs to. In the case of single atom cutoff groups, the mass |
608 |
> |
* factor for that atom is 1. For massless atoms, the factor is |
609 |
> |
* also 1. |
610 |
> |
*/ |
611 |
> |
vector<RealType> massFactors_; |
612 |
> |
public: |
613 |
> |
vector<RealType> getMassFactors() { return massFactors_; } |
614 |
|
|
615 |
< |
simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/ |
616 |
< |
Exclude exclude_; |
617 |
< |
PropertyMap properties_; /**< Generic Property */ |
618 |
< |
SnapshotManager* sman_; /**< SnapshotManager */ |
615 |
> |
PairList* getExcludedInteractions() { return &excludedInteractions_; } |
616 |
> |
PairList* getOneTwoInteractions() { return &oneTwoInteractions_; } |
617 |
> |
PairList* getOneThreeInteractions() { return &oneThreeInteractions_; } |
618 |
> |
PairList* getOneFourInteractions() { return &oneFourInteractions_; } |
619 |
|
|
620 |
+ |
private: |
621 |
+ |
|
622 |
+ |
/// lists to handle atoms needing special treatment in the non-bonded interactions |
623 |
+ |
PairList excludedInteractions_; /**< atoms excluded from interacting with each other */ |
624 |
+ |
PairList oneTwoInteractions_; /**< atoms that are directly Bonded */ |
625 |
+ |
PairList oneThreeInteractions_; /**< atoms sharing a Bend */ |
626 |
+ |
PairList oneFourInteractions_; /**< atoms sharing a Torsion */ |
627 |
+ |
|
628 |
+ |
PropertyMap properties_; /**< Generic Properties can be added */ |
629 |
+ |
SnapshotManager* sman_; /**< SnapshotManager (handles particle positions, etc.) */ |
630 |
+ |
|
631 |
|
/** |
632 |
< |
* The reason to have a local index manager is that when molecule is migrating to other processors, |
633 |
< |
* the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the |
634 |
< |
* information of molecule migrating to current processor, Migrator class can query the LocalIndexManager |
635 |
< |
* to make a efficient data moving plan. |
632 |
> |
* The reason to have a local index manager is that when molecule |
633 |
> |
* is migrating to other processors, the atoms and the |
634 |
> |
* rigid-bodies will release their local indices to |
635 |
> |
* LocalIndexManager. Combining the information of molecule |
636 |
> |
* migrating to current processor, Migrator class can query the |
637 |
> |
* LocalIndexManager to make a efficient data moving plan. |
638 |
|
*/ |
639 |
|
LocalIndexManager localIndexMan_; |
640 |
|
|
641 |
< |
//file names |
642 |
< |
std::string finalConfigFileName_; |
643 |
< |
std::string dumpFileName_; |
644 |
< |
std::string statFileName_; |
645 |
< |
std::string restFileName_; |
641 |
> |
// unparsed MetaData block for storing in Dump and EOR files: |
642 |
> |
string rawMetaData_; |
643 |
> |
|
644 |
> |
// file names |
645 |
> |
string finalConfigFileName_; |
646 |
> |
string dumpFileName_; |
647 |
> |
string statFileName_; |
648 |
> |
string restFileName_; |
649 |
|
|
523 |
– |
double rcut_; /**< cutoff radius*/ |
524 |
– |
double rsw_; /**< radius of switching function*/ |
525 |
– |
double rlist_; /**< neighbor list radius */ |
650 |
|
|
651 |
< |
bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */ |
652 |
< |
|
653 |
< |
#ifdef IS_MPI |
654 |
< |
//in Parallel version, we need MolToProc |
651 |
> |
bool topologyDone_; /** flag to indicate whether the topology has |
652 |
> |
been scanned and all the relevant |
653 |
> |
bookkeeping has been done*/ |
654 |
> |
|
655 |
> |
bool calcBoxDipole_; /**< flag to indicate whether or not we calculate |
656 |
> |
the simulation box dipole moment */ |
657 |
> |
|
658 |
> |
bool useAtomicVirial_; /**< flag to indicate whether or not we use |
659 |
> |
Atomic Virials to calculate the pressure */ |
660 |
> |
|
661 |
|
public: |
662 |
+ |
/** |
663 |
+ |
* return an integral objects by its global index. In MPI |
664 |
+ |
* version, if the StuntDouble with specified global index does |
665 |
+ |
* not belong to local processor, a NULL will be return. |
666 |
+ |
*/ |
667 |
+ |
StuntDouble* getIOIndexToIntegrableObject(int index); |
668 |
+ |
void setIOIndexToIntegrableObject(const vector<StuntDouble*>& v); |
669 |
+ |
|
670 |
+ |
private: |
671 |
+ |
vector<StuntDouble*> IOIndexToIntegrableObject; |
672 |
+ |
|
673 |
+ |
public: |
674 |
|
|
675 |
|
/** |
676 |
|
* Finds the processor where a molecule resides |
681 |
|
//assert(globalIndex < molToProcMap_.size()); |
682 |
|
return molToProcMap_[globalIndex]; |
683 |
|
} |
684 |
< |
|
684 |
> |
|
685 |
|
/** |
686 |
|
* Set MolToProcMap array |
687 |
|
* @see #SimCreator::divideMolecules |
688 |
|
*/ |
689 |
< |
void setMolToProcMap(const std::vector<int>& molToProcMap) { |
689 |
> |
void setMolToProcMap(const vector<int>& molToProcMap) { |
690 |
|
molToProcMap_ = molToProcMap; |
691 |
|
} |
692 |
|
|
693 |
|
private: |
552 |
– |
|
553 |
– |
void setupFortranParallel(); |
694 |
|
|
695 |
|
/** |
696 |
< |
* The size of molToProcMap_ is equal to total number of molecules in the system. |
697 |
< |
* It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only |
698 |
< |
* once. |
696 |
> |
* The size of molToProcMap_ is equal to total number of molecules |
697 |
> |
* in the system. It maps a molecule to the processor on which it |
698 |
> |
* resides. it is filled by SimCreator once and only once. |
699 |
|
*/ |
700 |
< |
std::vector<int> molToProcMap_; |
700 |
> |
vector<int> molToProcMap_; |
701 |
|
|
562 |
– |
#endif |
563 |
– |
|
702 |
|
}; |
703 |
|
|
704 |
< |
} //namespace oopse |
704 |
> |
} //namespace OpenMD |
705 |
|
#endif //BRAINS_SIMMODEL_HPP |
706 |
|
|