| 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] Vardeman & Gezelter, in progress (2009). |
| 40 |
|
*/ |
| 41 |
|
|
| 42 |
|
/** |
| 62 |
|
#include "UseTheForce/ForceField.hpp" |
| 63 |
|
#include "utils/PropertyMap.hpp" |
| 64 |
|
#include "utils/LocalIndexManager.hpp" |
| 65 |
+ |
#include "nonbonded/SwitchingFunction.hpp" |
| 66 |
|
|
| 67 |
|
//another nonsense macro declaration |
| 68 |
< |
#define __C |
| 68 |
> |
#define __OPENMD_C |
| 69 |
|
#include "brains/fSimulation.h" |
| 70 |
|
|
| 71 |
< |
namespace oopse{ |
| 72 |
< |
|
| 71 |
> |
using namespace std; |
| 72 |
> |
namespace OpenMD{ |
| 73 |
|
//forward decalration |
| 74 |
|
class SnapshotManager; |
| 75 |
|
class Molecule; |
| 76 |
|
class SelectionManager; |
| 77 |
|
class StuntDouble; |
| 78 |
+ |
|
| 79 |
|
/** |
| 80 |
< |
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
| 81 |
< |
* @brief One of the heavy weight classes of OOPSE, SimInfo maintains a list of molecules. |
| 82 |
< |
* The Molecule class maintains all of the concrete objects |
| 83 |
< |
* (atoms, bond, bend, torsions, inversions, rigid bodies, cutoff groups, |
| 84 |
< |
* constraints). In both the single and parallel versions, atoms and |
| 85 |
< |
* rigid bodies have both global and local indices. The local index is |
| 86 |
< |
* not relevant to molecules or cutoff groups. |
| 87 |
< |
*/ |
| 80 |
> |
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
| 81 |
> |
* |
| 82 |
> |
* @brief One of the heavy-weight classes of OpenMD, SimInfo |
| 83 |
> |
* maintains objects and variables relating to the current |
| 84 |
> |
* simulation. This includes the master list of Molecules. The |
| 85 |
> |
* Molecule class maintains all of the concrete objects (Atoms, |
| 86 |
> |
* Bond, Bend, Torsions, Inversions, RigidBodies, CutoffGroups, |
| 87 |
> |
* Constraints). In both the single and parallel versions, Atoms and |
| 88 |
> |
* RigidBodies have both global and local indices. |
| 89 |
> |
*/ |
| 90 |
|
class SimInfo { |
| 91 |
|
public: |
| 92 |
< |
typedef std::map<int, Molecule*>::iterator MoleculeIterator; |
| 93 |
< |
|
| 92 |
> |
typedef map<int, Molecule*>::iterator MoleculeIterator; |
| 93 |
> |
|
| 94 |
|
/** |
| 95 |
|
* Constructor of SimInfo |
| 96 |
< |
* @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the |
| 97 |
< |
* second element is the total number of molecules with the same molecule stamp in the system |
| 96 |
> |
* |
| 97 |
> |
* @param molStampPairs MoleculeStamp Array. The first element of |
| 98 |
> |
* the pair is molecule stamp, the second element is the total |
| 99 |
> |
* number of molecules with the same molecule stamp in the system |
| 100 |
> |
* |
| 101 |
|
* @param ff pointer of a concrete ForceField instance |
| 102 |
+ |
* |
| 103 |
|
* @param simParams |
| 96 |
– |
* @note |
| 104 |
|
*/ |
| 105 |
|
SimInfo(ForceField* ff, Globals* simParams); |
| 106 |
|
virtual ~SimInfo(); |
| 107 |
|
|
| 108 |
|
/** |
| 109 |
|
* Adds a molecule |
| 110 |
< |
* @return return true if adding successfully, return false if the molecule is already in SimInfo |
| 110 |
> |
* |
| 111 |
> |
* @return return true if adding successfully, return false if the |
| 112 |
> |
* molecule is already in SimInfo |
| 113 |
> |
* |
| 114 |
|
* @param mol molecule to be added |
| 115 |
|
*/ |
| 116 |
|
bool addMolecule(Molecule* mol); |
| 117 |
|
|
| 118 |
|
/** |
| 119 |
|
* Removes a molecule from SimInfo |
| 120 |
< |
* @return true if removing successfully, return false if molecule is not in this SimInfo |
| 120 |
> |
* |
| 121 |
> |
* @return true if removing successfully, return false if molecule |
| 122 |
> |
* is not in this SimInfo |
| 123 |
|
*/ |
| 124 |
|
bool removeMolecule(Molecule* mol); |
| 125 |
|
|
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
/** |
| 142 |
< |
* Returns the total number of integrable objects (total number of rigid bodies plus the total number |
| 143 |
< |
* of atoms which do not belong to the rigid bodies) in the system |
| 142 |
> |
* Returns the total number of integrable objects (total number of |
| 143 |
> |
* rigid bodies plus the total number of atoms which do not belong |
| 144 |
> |
* to the rigid bodies) in the system |
| 145 |
|
*/ |
| 146 |
|
int getNGlobalIntegrableObjects() { |
| 147 |
|
return nGlobalIntegrableObjects_; |
| 148 |
|
} |
| 149 |
|
|
| 150 |
|
/** |
| 151 |
< |
* Returns the total number of integrable objects (total number of rigid bodies plus the total number |
| 152 |
< |
* of atoms which do not belong to the rigid bodies) in the system |
| 151 |
> |
* Returns the total number of integrable objects (total number of |
| 152 |
> |
* rigid bodies plus the total number of atoms which do not belong |
| 153 |
> |
* to the rigid bodies) in the system |
| 154 |
|
*/ |
| 155 |
|
int getNGlobalRigidBodies() { |
| 156 |
|
return nGlobalRigidBodies_; |
| 245 |
|
|
| 246 |
|
int getFdf(); |
| 247 |
|
|
| 248 |
< |
//getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying |
| 248 |
> |
//getNZconstraint and setNZconstraint ruin the coherence of |
| 249 |
> |
//SimInfo class, need refactoring |
| 250 |
|
|
| 251 |
|
/** Returns the total number of z-constraint molecules in the system */ |
| 252 |
|
int getNZconstraint() { |
| 282 |
|
|
| 283 |
|
/** Returns the center of the mass of the whole system.*/ |
| 284 |
|
Vector3d getCom(); |
| 285 |
< |
/** Returns the center of the mass and Center of Mass velocity of the whole system.*/ |
| 285 |
> |
/** Returns the center of the mass and Center of Mass velocity of |
| 286 |
> |
the whole system.*/ |
| 287 |
|
void getComAll(Vector3d& com,Vector3d& comVel); |
| 288 |
|
|
| 289 |
< |
/** Returns intertia tensor for the entire system and system Angular Momentum.*/ |
| 289 |
> |
/** Returns intertia tensor for the entire system and system |
| 290 |
> |
Angular Momentum.*/ |
| 291 |
|
void getInertiaTensor(Mat3x3d &intertiaTensor,Vector3d &angularMomentum); |
| 292 |
|
|
| 293 |
|
/** Returns system angular momentum */ |
| 294 |
|
Vector3d getAngularMomentum(); |
| 295 |
|
|
| 296 |
< |
/** Returns volume of system as estimated by an ellipsoid defined by the radii of gyration*/ |
| 296 |
> |
/** Returns volume of system as estimated by an ellipsoid defined |
| 297 |
> |
by the radii of gyration*/ |
| 298 |
|
void getGyrationalVolume(RealType &vol); |
| 299 |
< |
/** Overloaded version of gyrational volume that also returns det(I) so dV/dr can be calculated*/ |
| 299 |
> |
/** Overloaded version of gyrational volume that also returns |
| 300 |
> |
det(I) so dV/dr can be calculated*/ |
| 301 |
|
void getGyrationalVolume(RealType &vol, RealType &detI); |
| 302 |
< |
/** main driver function to interact with fortran during the initialization and molecule migration */ |
| 302 |
> |
|
| 303 |
|
void update(); |
| 304 |
+ |
/** |
| 305 |
+ |
* Setup Fortran Simulation |
| 306 |
+ |
*/ |
| 307 |
+ |
void setupFortran(); |
| 308 |
|
|
| 309 |
+ |
|
| 310 |
|
/** Returns the local index manager */ |
| 311 |
|
LocalIndexManager* getLocalIndexManager() { |
| 312 |
|
return &localIndexMan_; |
| 338 |
|
return i != molecules_.end() ? i->second : NULL; |
| 339 |
|
} |
| 340 |
|
|
| 341 |
< |
RealType getRcut() { |
| 342 |
< |
return rcut_; |
| 341 |
> |
int getGlobalMolMembership(int id){ |
| 342 |
> |
return globalMolMembership_[id]; |
| 343 |
|
} |
| 320 |
– |
|
| 321 |
– |
RealType getRsw() { |
| 322 |
– |
return rsw_; |
| 323 |
– |
} |
| 324 |
– |
|
| 325 |
– |
RealType getList() { |
| 326 |
– |
return rlist_; |
| 327 |
– |
} |
| 344 |
|
|
| 345 |
< |
std::string getFinalConfigFileName() { |
| 345 |
> |
string getFinalConfigFileName() { |
| 346 |
|
return finalConfigFileName_; |
| 347 |
|
} |
| 348 |
|
|
| 349 |
< |
void setFinalConfigFileName(const std::string& fileName) { |
| 349 |
> |
void setFinalConfigFileName(const string& fileName) { |
| 350 |
|
finalConfigFileName_ = fileName; |
| 351 |
|
} |
| 352 |
|
|
| 353 |
< |
std::string getRawMetaData() { |
| 353 |
> |
string getRawMetaData() { |
| 354 |
|
return rawMetaData_; |
| 355 |
|
} |
| 356 |
< |
void setRawMetaData(const std::string& rawMetaData) { |
| 356 |
> |
void setRawMetaData(const string& rawMetaData) { |
| 357 |
|
rawMetaData_ = rawMetaData; |
| 358 |
|
} |
| 359 |
|
|
| 360 |
< |
std::string getDumpFileName() { |
| 360 |
> |
string getDumpFileName() { |
| 361 |
|
return dumpFileName_; |
| 362 |
|
} |
| 363 |
|
|
| 364 |
< |
void setDumpFileName(const std::string& fileName) { |
| 364 |
> |
void setDumpFileName(const string& fileName) { |
| 365 |
|
dumpFileName_ = fileName; |
| 366 |
|
} |
| 367 |
|
|
| 368 |
< |
std::string getStatFileName() { |
| 368 |
> |
string getStatFileName() { |
| 369 |
|
return statFileName_; |
| 370 |
|
} |
| 371 |
|
|
| 372 |
< |
void setStatFileName(const std::string& fileName) { |
| 372 |
> |
void setStatFileName(const string& fileName) { |
| 373 |
|
statFileName_ = fileName; |
| 374 |
|
} |
| 375 |
|
|
| 376 |
< |
std::string getRestFileName() { |
| 376 |
> |
string getRestFileName() { |
| 377 |
|
return restFileName_; |
| 378 |
|
} |
| 379 |
|
|
| 380 |
< |
void setRestFileName(const std::string& fileName) { |
| 380 |
> |
void setRestFileName(const string& fileName) { |
| 381 |
|
restFileName_ = fileName; |
| 382 |
|
} |
| 383 |
|
|
| 385 |
|
* Sets GlobalGroupMembership |
| 386 |
|
* @see #SimCreator::setGlobalIndex |
| 387 |
|
*/ |
| 388 |
< |
void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) { |
| 388 |
> |
void setGlobalGroupMembership(const vector<int>& globalGroupMembership) { |
| 389 |
|
assert(globalGroupMembership.size() == static_cast<size_t>(nGlobalAtoms_)); |
| 390 |
|
globalGroupMembership_ = globalGroupMembership; |
| 391 |
|
} |
| 394 |
|
* Sets GlobalMolMembership |
| 395 |
|
* @see #SimCreator::setGlobalIndex |
| 396 |
|
*/ |
| 397 |
< |
void setGlobalMolMembership(const std::vector<int>& globalMolMembership) { |
| 397 |
> |
void setGlobalMolMembership(const vector<int>& globalMolMembership) { |
| 398 |
|
assert(globalMolMembership.size() == static_cast<size_t>(nGlobalAtoms_)); |
| 399 |
|
globalMolMembership_ = globalMolMembership; |
| 400 |
|
} |
| 412 |
|
return useAtomicVirial_; |
| 413 |
|
} |
| 414 |
|
|
| 399 |
– |
//below functions are just forward functions |
| 400 |
– |
//To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the |
| 401 |
– |
//the other hand, has-a relation need composing. |
| 415 |
|
/** |
| 416 |
|
* Adds property into property map |
| 417 |
|
* @param genData GenericData to be added into PropertyMap |
| 422 |
|
* Removes property from PropertyMap by name |
| 423 |
|
* @param propName the name of property to be removed |
| 424 |
|
*/ |
| 425 |
< |
void removeProperty(const std::string& propName); |
| 425 |
> |
void removeProperty(const string& propName); |
| 426 |
|
|
| 427 |
|
/** |
| 428 |
|
* clear all of the properties |
| 433 |
|
* Returns all names of properties |
| 434 |
|
* @return all names of properties |
| 435 |
|
*/ |
| 436 |
< |
std::vector<std::string> getPropertyNames(); |
| 436 |
> |
vector<string> getPropertyNames(); |
| 437 |
|
|
| 438 |
|
/** |
| 439 |
|
* Returns all of the properties in PropertyMap |
| 440 |
|
* @return all of the properties in PropertyMap |
| 441 |
|
*/ |
| 442 |
< |
std::vector<GenericData*> getProperties(); |
| 442 |
> |
vector<GenericData*> getProperties(); |
| 443 |
|
|
| 444 |
|
/** |
| 445 |
|
* Returns property |
| 447 |
|
* @return a pointer point to property with propName. If no property named propName |
| 448 |
|
* exists, return NULL |
| 449 |
|
*/ |
| 450 |
< |
GenericData* getPropertyByName(const std::string& propName); |
| 450 |
> |
GenericData* getPropertyByName(const string& propName); |
| 451 |
|
|
| 452 |
|
/** |
| 453 |
|
* add all special interaction pairs (including excluded |
| 461 |
|
*/ |
| 462 |
|
void removeInteractionPairs(Molecule* mol); |
| 463 |
|
|
| 464 |
< |
|
| 465 |
< |
/** Returns the unique atom types of local processor in an array */ |
| 453 |
< |
std::set<AtomType*> getUniqueAtomTypes(); |
| 464 |
> |
/** Returns the set of atom types present in this simulation */ |
| 465 |
> |
set<AtomType*> getSimulatedAtomTypes(); |
| 466 |
|
|
| 467 |
< |
friend std::ostream& operator <<(std::ostream& o, SimInfo& info); |
| 467 |
> |
friend ostream& operator <<(ostream& o, SimInfo& info); |
| 468 |
|
|
| 469 |
|
void getCutoff(RealType& rcut, RealType& rsw); |
| 470 |
|
|
| 471 |
|
private: |
| 472 |
|
|
| 473 |
< |
/** fill up the simtype struct*/ |
| 474 |
< |
void setupSimType(); |
| 473 |
> |
/** fill up the simtype struct and other simulation-related variables */ |
| 474 |
> |
void setupSimVariables(); |
| 475 |
|
|
| 464 |
– |
/** |
| 465 |
– |
* Setup Fortran Simulation |
| 466 |
– |
* @see #setupFortranParallel |
| 467 |
– |
*/ |
| 468 |
– |
void setupFortranSim(); |
| 476 |
|
|
| 470 |
– |
/** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ |
| 471 |
– |
void setupCutoff(); |
| 472 |
– |
|
| 473 |
– |
/** Figure out which coulombic correction method to use and pass to fortran */ |
| 474 |
– |
void setupElectrostaticSummationMethod( int isError ); |
| 475 |
– |
|
| 476 |
– |
/** Figure out which polynomial type to use for the switching function */ |
| 477 |
– |
void setupSwitchingFunction(); |
| 478 |
– |
|
| 477 |
|
/** Determine if we need to accumulate the simulation box dipole */ |
| 478 |
|
void setupAccumulateBoxDipole(); |
| 479 |
|
|
| 482 |
|
void calcNdfRaw(); |
| 483 |
|
void calcNdfTrans(); |
| 484 |
|
|
| 487 |
– |
ForceField* forceField_; |
| 488 |
– |
Globals* simParams_; |
| 489 |
– |
|
| 490 |
– |
std::map<int, Molecule*> molecules_; /**< Molecule array */ |
| 491 |
– |
|
| 485 |
|
/** |
| 486 |
< |
* Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole |
| 487 |
< |
* system. |
| 486 |
> |
* Adds molecule stamp and the total number of the molecule with |
| 487 |
> |
* same molecule stamp in the whole system. |
| 488 |
|
*/ |
| 489 |
|
void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); |
| 490 |
< |
|
| 491 |
< |
//degress of freedom |
| 492 |
< |
int ndf_; /**< number of degress of freedom (excludes constraints), ndf_ is local */ |
| 493 |
< |
int fdf_local; /**< number of frozen degrees of freedom */ |
| 501 |
< |
int fdf_; /**< number of frozen degrees of freedom */ |
| 502 |
< |
int ndfRaw_; /**< number of degress of freedom (includes constraints), ndfRaw_ is local */ |
| 503 |
< |
int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ |
| 504 |
< |
int nZconstraint_; /** number of z-constraint molecules, nZconstraint_ is global */ |
| 505 |
< |
|
| 506 |
< |
//number of global objects |
| 507 |
< |
int nGlobalMols_; /**< number of molecules in the system */ |
| 508 |
< |
int nGlobalAtoms_; /**< number of atoms in the system */ |
| 509 |
< |
int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */ |
| 510 |
< |
int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ |
| 511 |
< |
int nGlobalRigidBodies_; /**< number of rigid bodies in this system */ |
| 512 |
< |
/** |
| 513 |
< |
* the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
| 514 |
< |
* corresponding content is the global index of cutoff group this atom belong to. |
| 515 |
< |
* It is filled by SimCreator once and only once, since it never changed during the simulation. |
| 516 |
< |
*/ |
| 517 |
< |
std::vector<int> globalGroupMembership_; |
| 490 |
> |
|
| 491 |
> |
// Other classes holdingn important information |
| 492 |
> |
ForceField* forceField_; /**< provides access to defined atom types, bond types, etc. */ |
| 493 |
> |
Globals* simParams_; /**< provides access to simulation parameters set by user */ |
| 494 |
|
|
| 495 |
< |
/** |
| 520 |
< |
* the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
| 521 |
< |
* corresponding content is the global index of molecule this atom belong to. |
| 522 |
< |
* It is filled by SimCreator once and only once, since it is never changed during the simulation. |
| 523 |
< |
*/ |
| 524 |
< |
std::vector<int> globalMolMembership_; |
| 525 |
< |
|
| 526 |
< |
|
| 527 |
< |
std::vector<int> molStampIds_; /**< stamp id array of all molecules in the system */ |
| 528 |
< |
std::vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
| 529 |
< |
|
| 530 |
< |
//number of local objects |
| 495 |
> |
/// Counts of local objects |
| 496 |
|
int nAtoms_; /**< number of atoms in local processor */ |
| 497 |
|
int nBonds_; /**< number of bonds in local processor */ |
| 498 |
|
int nBends_; /**< number of bends in local processor */ |
| 502 |
|
int nIntegrableObjects_; /**< number of integrable objects in local processor */ |
| 503 |
|
int nCutoffGroups_; /**< number of cutoff groups in local processor */ |
| 504 |
|
int nConstraints_; /**< number of constraints in local processors */ |
| 505 |
+ |
|
| 506 |
+ |
/// Counts of global objects |
| 507 |
+ |
int nGlobalMols_; /**< number of molecules in the system (GLOBAL) */ |
| 508 |
+ |
int nGlobalAtoms_; /**< number of atoms in the system (GLOBAL) */ |
| 509 |
+ |
int nGlobalCutoffGroups_; /**< number of cutoff groups in this system (GLOBAL) */ |
| 510 |
+ |
int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ |
| 511 |
+ |
int nGlobalRigidBodies_; /**< number of rigid bodies in this system (GLOBAL) */ |
| 512 |
+ |
|
| 513 |
+ |
/// Degress of freedom |
| 514 |
+ |
int ndf_; /**< number of degress of freedom (excludes constraints) (LOCAL) */ |
| 515 |
+ |
int fdf_local; /**< number of frozen degrees of freedom (LOCAL) */ |
| 516 |
+ |
int fdf_; /**< number of frozen degrees of freedom (GLOBAL) */ |
| 517 |
+ |
int ndfRaw_; /**< number of degress of freedom (includes constraints), (LOCAL) */ |
| 518 |
+ |
int ndfTrans_; /**< number of translation degress of freedom, (LOCAL) */ |
| 519 |
+ |
int nZconstraint_; /**< number of z-constraint molecules (GLOBAL) */ |
| 520 |
|
|
| 521 |
< |
simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/ |
| 522 |
< |
PairList excludedInteractions_; |
| 523 |
< |
PairList oneTwoInteractions_; |
| 524 |
< |
PairList oneThreeInteractions_; |
| 525 |
< |
PairList oneFourInteractions_; |
| 526 |
< |
PropertyMap properties_; /**< Generic Property */ |
| 527 |
< |
SnapshotManager* sman_; /**< SnapshotManager */ |
| 521 |
> |
/// logicals |
| 522 |
> |
bool usesPeriodicBoundaries_; /**< use periodic boundary conditions? */ |
| 523 |
> |
bool usesDirectionalAtoms_; /**< are there atoms with position AND orientation? */ |
| 524 |
> |
bool usesMetallicAtoms_; /**< are there transition metal atoms? */ |
| 525 |
> |
bool usesElectrostaticAtoms_; /**< are there electrostatic atoms? */ |
| 526 |
> |
bool usesAtomicVirial_; /**< are we computing atomic virials? */ |
| 527 |
> |
bool requiresPrepair_; /**< does this simulation require a pre-pair loop? */ |
| 528 |
> |
bool requiresSkipCorrection_; /**< does this simulation require a skip-correction? */ |
| 529 |
> |
bool requiresSelfCorrection_; /**< does this simulation require a self-correction? */ |
| 530 |
|
|
| 531 |
+ |
public: |
| 532 |
+ |
bool usesElectrostaticAtoms() { return usesElectrostaticAtoms_; } |
| 533 |
+ |
bool usesDirectionalAtoms() { return usesDirectionalAtoms_; } |
| 534 |
+ |
bool usesMetallicAtoms() { return usesMetallicAtoms_; } |
| 535 |
+ |
bool usesAtomicVirial() { return usesAtomicVirial_; } |
| 536 |
+ |
bool requiresPrepair() { return requiresPrepair_; } |
| 537 |
+ |
bool requiresSkipCorrection() { return requiresSkipCorrection_;} |
| 538 |
+ |
bool requiresSelfCorrection() { return requiresSelfCorrection_;} |
| 539 |
+ |
|
| 540 |
+ |
private: |
| 541 |
+ |
/// Data structures holding primary simulation objects |
| 542 |
+ |
map<int, Molecule*> molecules_; /**< map holding pointers to LOCAL molecules */ |
| 543 |
+ |
simtype fInfo_; /**< A dual struct shared by C++ |
| 544 |
+ |
and Fortran to pass |
| 545 |
+ |
information about what types |
| 546 |
+ |
of calculation are |
| 547 |
+ |
required */ |
| 548 |
+ |
|
| 549 |
+ |
/// Stamps are templates for objects that are then used to create |
| 550 |
+ |
/// groups of objects. For example, a molecule stamp contains |
| 551 |
+ |
/// information on how to build that molecule (i.e. the topology, |
| 552 |
+ |
/// the atoms, the bonds, etc.) Once the system is built, the |
| 553 |
+ |
/// stamps are no longer useful. |
| 554 |
+ |
vector<int> molStampIds_; /**< stamp id for molecules in the system */ |
| 555 |
+ |
vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
| 556 |
+ |
|
| 557 |
+ |
/** |
| 558 |
+ |
* A vector that maps between the global index of an atom, and the |
| 559 |
+ |
* global index of cutoff group the atom belong to. It is filled |
| 560 |
+ |
* by SimCreator once and only once, since it never changed during |
| 561 |
+ |
* the simulation. It should be nGlobalAtoms_ in size. |
| 562 |
+ |
*/ |
| 563 |
+ |
vector<int> globalGroupMembership_; |
| 564 |
+ |
|
| 565 |
+ |
/** |
| 566 |
+ |
* A vector that maps between the global index of an atom and the |
| 567 |
+ |
* global index of the molecule the atom belongs to. It is filled |
| 568 |
+ |
* by SimCreator once and only once, since it is never changed |
| 569 |
+ |
* during the simulation. It shoudl be nGlobalAtoms_ in size. |
| 570 |
+ |
*/ |
| 571 |
+ |
vector<int> globalMolMembership_; |
| 572 |
+ |
|
| 573 |
|
/** |
| 574 |
< |
* The reason to have a local index manager is that when molecule is migrating to other processors, |
| 575 |
< |
* the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the |
| 576 |
< |
* information of molecule migrating to current processor, Migrator class can query the LocalIndexManager |
| 577 |
< |
* to make a efficient data moving plan. |
| 574 |
> |
* A vector that maps between the local index of an atom and the |
| 575 |
> |
* index of the AtomType. |
| 576 |
> |
*/ |
| 577 |
> |
vector<int> identArray_; |
| 578 |
> |
public: |
| 579 |
> |
vector<int> getIdentArray() { return identArray_; } |
| 580 |
> |
private: |
| 581 |
> |
|
| 582 |
> |
/// lists to handle atoms needing special treatment in the non-bonded interactions |
| 583 |
> |
PairList excludedInteractions_; /**< atoms excluded from interacting with each other */ |
| 584 |
> |
PairList oneTwoInteractions_; /**< atoms that are directly Bonded */ |
| 585 |
> |
PairList oneThreeInteractions_; /**< atoms sharing a Bend */ |
| 586 |
> |
PairList oneFourInteractions_; /**< atoms sharing a Torsion */ |
| 587 |
> |
|
| 588 |
> |
PropertyMap properties_; /**< Generic Properties can be added */ |
| 589 |
> |
SnapshotManager* sman_; /**< SnapshotManager (handles particle positions, etc.) */ |
| 590 |
> |
|
| 591 |
> |
/** |
| 592 |
> |
* The reason to have a local index manager is that when molecule |
| 593 |
> |
* is migrating to other processors, the atoms and the |
| 594 |
> |
* rigid-bodies will release their local indices to |
| 595 |
> |
* LocalIndexManager. Combining the information of molecule |
| 596 |
> |
* migrating to current processor, Migrator class can query the |
| 597 |
> |
* LocalIndexManager to make a efficient data moving plan. |
| 598 |
|
*/ |
| 599 |
|
LocalIndexManager localIndexMan_; |
| 600 |
|
|
| 601 |
|
// unparsed MetaData block for storing in Dump and EOR files: |
| 602 |
< |
std::string rawMetaData_; |
| 602 |
> |
string rawMetaData_; |
| 603 |
|
|
| 604 |
< |
//file names |
| 605 |
< |
std::string finalConfigFileName_; |
| 606 |
< |
std::string dumpFileName_; |
| 607 |
< |
std::string statFileName_; |
| 608 |
< |
std::string restFileName_; |
| 604 |
> |
// file names |
| 605 |
> |
string finalConfigFileName_; |
| 606 |
> |
string dumpFileName_; |
| 607 |
> |
string statFileName_; |
| 608 |
> |
string restFileName_; |
| 609 |
|
|
| 566 |
– |
RealType rcut_; /**< cutoff radius*/ |
| 567 |
– |
RealType rsw_; /**< radius of switching function*/ |
| 568 |
– |
RealType rlist_; /**< neighbor list radius */ |
| 610 |
|
|
| 611 |
< |
bool ljsp_; /**< use shifted potential for LJ*/ |
| 571 |
< |
bool ljsf_; /**< use shifted force for LJ*/ |
| 572 |
< |
|
| 573 |
< |
bool fortranInitialized_; /**< flag indicate whether fortran side |
| 574 |
< |
is initialized */ |
| 611 |
> |
bool fortranInitialized_; /** flag to indicate whether the fortran side is initialized */ |
| 612 |
|
|
| 613 |
|
bool calcBoxDipole_; /**< flag to indicate whether or not we calculate |
| 614 |
|
the simulation box dipole moment */ |
| 615 |
|
|
| 616 |
|
bool useAtomicVirial_; /**< flag to indicate whether or not we use |
| 617 |
|
Atomic Virials to calculate the pressure */ |
| 618 |
< |
|
| 619 |
< |
public: |
| 583 |
< |
/** |
| 584 |
< |
* return an integral objects by its global index. In MPI version, if the StuntDouble with specified |
| 585 |
< |
* global index does not belong to local processor, a NULL will be return. |
| 586 |
< |
*/ |
| 587 |
< |
StuntDouble* getIOIndexToIntegrableObject(int index); |
| 588 |
< |
void setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v); |
| 589 |
< |
private: |
| 590 |
< |
std::vector<StuntDouble*> IOIndexToIntegrableObject; |
| 591 |
< |
//public: |
| 592 |
< |
//void setStuntDoubleFromGlobalIndex(std::vector<StuntDouble*> v); |
| 618 |
> |
|
| 619 |
> |
public: |
| 620 |
|
/** |
| 621 |
< |
* return a StuntDouble by its global index. In MPI version, if the StuntDouble with specified |
| 622 |
< |
* global index does not belong to local processor, a NULL will be return. |
| 623 |
< |
*/ |
| 624 |
< |
//StuntDouble* getStuntDoubleFromGlobalIndex(int index); |
| 625 |
< |
//private: |
| 626 |
< |
//std::vector<StuntDouble*> sdByGlobalIndex_; |
| 621 |
> |
* return an integral objects by its global index. In MPI |
| 622 |
> |
* version, if the StuntDouble with specified global index does |
| 623 |
> |
* not belong to local processor, a NULL will be return. |
| 624 |
> |
*/ |
| 625 |
> |
StuntDouble* getIOIndexToIntegrableObject(int index); |
| 626 |
> |
void setIOIndexToIntegrableObject(const vector<StuntDouble*>& v); |
| 627 |
|
|
| 628 |
< |
//in Parallel version, we need MolToProc |
| 628 |
> |
private: |
| 629 |
> |
vector<StuntDouble*> IOIndexToIntegrableObject; |
| 630 |
> |
|
| 631 |
|
public: |
| 632 |
|
|
| 633 |
|
/** |
| 639 |
|
//assert(globalIndex < molToProcMap_.size()); |
| 640 |
|
return molToProcMap_[globalIndex]; |
| 641 |
|
} |
| 642 |
< |
|
| 642 |
> |
|
| 643 |
|
/** |
| 644 |
|
* Set MolToProcMap array |
| 645 |
|
* @see #SimCreator::divideMolecules |
| 646 |
|
*/ |
| 647 |
< |
void setMolToProcMap(const std::vector<int>& molToProcMap) { |
| 647 |
> |
void setMolToProcMap(const vector<int>& molToProcMap) { |
| 648 |
|
molToProcMap_ = molToProcMap; |
| 649 |
|
} |
| 650 |
|
|
| 651 |
|
private: |
| 623 |
– |
|
| 624 |
– |
void setupFortranParallel(); |
| 652 |
|
|
| 653 |
|
/** |
| 654 |
|
* The size of molToProcMap_ is equal to total number of molecules |
| 655 |
|
* in the system. It maps a molecule to the processor on which it |
| 656 |
|
* resides. it is filled by SimCreator once and only once. |
| 657 |
|
*/ |
| 658 |
< |
std::vector<int> molToProcMap_; |
| 658 |
> |
vector<int> molToProcMap_; |
| 659 |
|
|
| 633 |
– |
|
| 660 |
|
}; |
| 661 |
|
|
| 662 |
< |
} //namespace oopse |
| 662 |
> |
} //namespace OpenMD |
| 663 |
|
#endif //BRAINS_SIMMODEL_HPP |
| 664 |
|
|