| 1 | < | /* | 
| 1 | > | /* | 
| 2 |  | * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. | 
| 3 |  | * | 
| 4 |  | * The University of Notre Dame grants you ("Licensee") a | 
| 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 |  | /** | 
| 54 |  | #include <utility> | 
| 55 |  | #include <vector> | 
| 56 |  |  | 
| 57 | < | #include "brains/Exclude.hpp" | 
| 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 |  |  | 
| 66 |  | //another nonsense macro declaration | 
| 67 | < | #define __C | 
| 67 | > | #define __OPENMD_C | 
| 68 |  | #include "brains/fSimulation.h" | 
| 69 |  |  | 
| 70 | < | namespace oopse{ | 
| 70 | > | namespace OpenMD{ | 
| 71 |  |  | 
| 72 | < | //forward decalration | 
| 73 | < | class SnapshotManager; | 
| 74 | < | class Molecule; | 
| 75 | < | class SelectionManager; | 
| 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. | 
| 85 | < | */ | 
| 86 | < | class SimInfo { | 
| 87 | < | public: | 
| 88 | < | typedef std::map<int, Molecule*>::iterator  MoleculeIterator; | 
| 72 | > | //forward decalration | 
| 73 | > | class SnapshotManager; | 
| 74 | > | class Molecule; | 
| 75 | > | class SelectionManager; | 
| 76 | > | class StuntDouble; | 
| 77 | > | /** | 
| 78 | > | * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" | 
| 79 | > | * @brief One of the heavy weight classes of OpenMD, SimInfo maintains a list of molecules. | 
| 80 | > | * The Molecule class maintains all of the concrete objects | 
| 81 | > | * (atoms, bond, bend, torsions, inversions, rigid bodies, cutoff groups, | 
| 82 | > | * constraints). In both the single and parallel versions, atoms and | 
| 83 | > | * rigid bodies have both global and local indices.  The local index is | 
| 84 | > | * not relevant to molecules or cutoff groups. | 
| 85 | > | */ | 
| 86 | > | class SimInfo { | 
| 87 | > | public: | 
| 88 | > | typedef std::map<int, Molecule*>::iterator  MoleculeIterator; | 
| 89 |  |  | 
| 90 | < | /** | 
| 91 | < | * Constructor of SimInfo | 
| 92 | < | * @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the | 
| 93 | < | * second element is the total number of molecules with the same molecule stamp in the system | 
| 94 | < | * @param ff pointer of a concrete ForceField instance | 
| 95 | < | * @param simParams | 
| 96 | < | * @note | 
| 97 | < | */ | 
| 98 | < | SimInfo(std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, ForceField* ff, Globals* simParams); | 
| 99 | < | virtual ~SimInfo(); | 
| 90 | > | /** | 
| 91 | > | * Constructor of SimInfo | 
| 92 | > | * @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the | 
| 93 | > | * second element is the total number of molecules with the same molecule stamp in the system | 
| 94 | > | * @param ff pointer of a concrete ForceField instance | 
| 95 | > | * @param simParams | 
| 96 | > | * @note | 
| 97 | > | */ | 
| 98 | > | SimInfo(ForceField* ff, Globals* simParams); | 
| 99 | > | virtual ~SimInfo(); | 
| 100 |  |  | 
| 101 | < | /** | 
| 102 | < | * Adds a molecule | 
| 103 | < | * @return return true if adding successfully, return false if the molecule is already in SimInfo | 
| 104 | < | * @param mol molecule to be added | 
| 105 | < | */ | 
| 106 | < | bool addMolecule(Molecule* mol); | 
| 101 | > | /** | 
| 102 | > | * Adds a molecule | 
| 103 | > | * @return return true if adding successfully, return false if the molecule is already in SimInfo | 
| 104 | > | * @param mol molecule to be added | 
| 105 | > | */ | 
| 106 | > | bool addMolecule(Molecule* mol); | 
| 107 |  |  | 
| 108 | < | /** | 
| 109 | < | * Removes a molecule from SimInfo | 
| 110 | < | * @return true if removing successfully, return false if molecule is not in this SimInfo | 
| 111 | < | */ | 
| 112 | < | bool removeMolecule(Molecule* mol); | 
| 108 | > | /** | 
| 109 | > | * Removes a molecule from SimInfo | 
| 110 | > | * @return true if removing successfully, return false if molecule is not in this SimInfo | 
| 111 | > | */ | 
| 112 | > | bool removeMolecule(Molecule* mol); | 
| 113 |  |  | 
| 114 | < | /** Returns the total number of molecules in the system. */ | 
| 115 | < | int getNGlobalMolecules() { | 
| 116 | < | return nGlobalMols_; | 
| 117 | < | } | 
| 114 | > | /** Returns the total number of molecules in the system. */ | 
| 115 | > | int getNGlobalMolecules() { | 
| 116 | > | return nGlobalMols_; | 
| 117 | > | } | 
| 118 |  |  | 
| 119 | < | /** Returns the total number of atoms in the system. */ | 
| 120 | < | int getNGlobalAtoms() { | 
| 121 | < | return nGlobalAtoms_; | 
| 122 | < | } | 
| 119 | > | /** Returns the total number of atoms in the system. */ | 
| 120 | > | int getNGlobalAtoms() { | 
| 121 | > | return nGlobalAtoms_; | 
| 122 | > | } | 
| 123 |  |  | 
| 124 | < | /** Returns the total number of cutoff groups in the system. */ | 
| 125 | < | int getNGlobalCutoffGroups() { | 
| 126 | < | return nGlobalCutoffGroups_; | 
| 127 | < | } | 
| 124 | > | /** Returns the total number of cutoff groups in the system. */ | 
| 125 | > | int getNGlobalCutoffGroups() { | 
| 126 | > | return nGlobalCutoffGroups_; | 
| 127 | > | } | 
| 128 |  |  | 
| 129 | < | /** | 
| 130 | < | * Returns the total number of integrable objects (total number of rigid bodies plus the total number | 
| 131 | < | * of atoms which do not belong to the rigid bodies) in the system | 
| 132 | < | */ | 
| 133 | < | int getNGlobalIntegrableObjects() { | 
| 134 | < | return nGlobalIntegrableObjects_; | 
| 135 | < | } | 
| 129 | > | /** | 
| 130 | > | * Returns the total number of integrable objects (total number of rigid bodies plus the total number | 
| 131 | > | * of atoms which do not belong to the rigid bodies) in the system | 
| 132 | > | */ | 
| 133 | > | int getNGlobalIntegrableObjects() { | 
| 134 | > | return nGlobalIntegrableObjects_; | 
| 135 | > | } | 
| 136 |  |  | 
| 137 | < | /** | 
| 138 | < | * Returns the total number of integrable objects (total number of rigid bodies plus the total number | 
| 139 | < | * of atoms which do not belong to the rigid bodies) in the system | 
| 140 | < | */ | 
| 141 | < | int getNGlobalRigidBodies() { | 
| 142 | < | return nGlobalRigidBodies_; | 
| 143 | < | } | 
| 137 | > | /** | 
| 138 | > | * Returns the total number of integrable objects (total number of rigid bodies plus the total number | 
| 139 | > | * of atoms which do not belong to the rigid bodies) in the system | 
| 140 | > | */ | 
| 141 | > | int getNGlobalRigidBodies() { | 
| 142 | > | return nGlobalRigidBodies_; | 
| 143 | > | } | 
| 144 |  |  | 
| 145 | < | int getNGlobalConstraints(); | 
| 146 | < | /** | 
| 147 | < | * Returns the number of local molecules. | 
| 148 | < | * @return the number of local molecules | 
| 149 | < | */ | 
| 150 | < | int getNMolecules() { | 
| 151 | < | return molecules_.size(); | 
| 152 | < | } | 
| 145 | > | int getNGlobalConstraints(); | 
| 146 | > | /** | 
| 147 | > | * Returns the number of local molecules. | 
| 148 | > | * @return the number of local molecules | 
| 149 | > | */ | 
| 150 | > | int getNMolecules() { | 
| 151 | > | return molecules_.size(); | 
| 152 | > | } | 
| 153 |  |  | 
| 154 | < | /** Returns the number of local atoms */ | 
| 155 | < | unsigned int getNAtoms() { | 
| 156 | < | return nAtoms_; | 
| 157 | < | } | 
| 154 | > | /** Returns the number of local atoms */ | 
| 155 | > | unsigned int getNAtoms() { | 
| 156 | > | return nAtoms_; | 
| 157 | > | } | 
| 158 |  |  | 
| 159 | < | /** Returns the number of local bonds */ | 
| 160 | < | unsigned int getNBonds(){ | 
| 161 | < | return nBonds_; | 
| 162 | < | } | 
| 159 | > | /** Returns the number of local bonds */ | 
| 160 | > | unsigned int getNBonds(){ | 
| 161 | > | return nBonds_; | 
| 162 | > | } | 
| 163 |  |  | 
| 164 | < | /** Returns the number of local bends */ | 
| 165 | < | unsigned int getNBends() { | 
| 166 | < | return nBends_; | 
| 167 | < | } | 
| 164 | > | /** Returns the number of local bends */ | 
| 165 | > | unsigned int getNBends() { | 
| 166 | > | return nBends_; | 
| 167 | > | } | 
| 168 |  |  | 
| 169 | < | /** Returns the number of local torsions */ | 
| 170 | < | unsigned int getNTorsions() { | 
| 171 | < | return nTorsions_; | 
| 172 | < | } | 
| 169 | > | /** Returns the number of local torsions */ | 
| 170 | > | unsigned int getNTorsions() { | 
| 171 | > | return nTorsions_; | 
| 172 | > | } | 
| 173 |  |  | 
| 174 | < | /** Returns the number of local rigid bodies */ | 
| 175 | < | unsigned int getNRigidBodies() { | 
| 176 | < | return nRigidBodies_; | 
| 177 | < | } | 
| 174 | > | /** Returns the number of local torsions */ | 
| 175 | > | unsigned int getNInversions() { | 
| 176 | > | return nInversions_; | 
| 177 | > | } | 
| 178 | > | /** Returns the number of local rigid bodies */ | 
| 179 | > | unsigned int getNRigidBodies() { | 
| 180 | > | return nRigidBodies_; | 
| 181 | > | } | 
| 182 |  |  | 
| 183 | < | /** Returns the number of local integrable objects */ | 
| 184 | < | unsigned int getNIntegrableObjects() { | 
| 185 | < | return nIntegrableObjects_; | 
| 186 | < | } | 
| 183 | > | /** Returns the number of local integrable objects */ | 
| 184 | > | unsigned int getNIntegrableObjects() { | 
| 185 | > | return nIntegrableObjects_; | 
| 186 | > | } | 
| 187 |  |  | 
| 188 | < | /** Returns the number of local cutoff groups */ | 
| 189 | < | unsigned int getNCutoffGroups() { | 
| 190 | < | return nCutoffGroups_; | 
| 191 | < | } | 
| 188 | > | /** Returns the number of local cutoff groups */ | 
| 189 | > | unsigned int getNCutoffGroups() { | 
| 190 | > | return nCutoffGroups_; | 
| 191 | > | } | 
| 192 |  |  | 
| 193 | < | /** Returns the total number of constraints in this SimInfo */ | 
| 194 | < | unsigned int getNConstraints() { | 
| 195 | < | return nConstraints_; | 
| 196 | < | } | 
| 193 | > | /** Returns the total number of constraints in this SimInfo */ | 
| 194 | > | unsigned int getNConstraints() { | 
| 195 | > | return nConstraints_; | 
| 196 | > | } | 
| 197 |  |  | 
| 198 | < | /** | 
| 199 | < | * Returns the first molecule in this SimInfo and intialize the iterator. | 
| 200 | < | * @return the first molecule, return NULL if there is not molecule in this SimInfo | 
| 201 | < | * @param i the iterator of molecule array (user shouldn't change it) | 
| 202 | < | */ | 
| 203 | < | Molecule* beginMolecule(MoleculeIterator& i); | 
| 198 | > | /** | 
| 199 | > | * Returns the first molecule in this SimInfo and intialize the iterator. | 
| 200 | > | * @return the first molecule, return NULL if there is not molecule in this SimInfo | 
| 201 | > | * @param i the iterator of molecule array (user shouldn't change it) | 
| 202 | > | */ | 
| 203 | > | Molecule* beginMolecule(MoleculeIterator& i); | 
| 204 |  |  | 
| 205 | < | /** | 
| 206 | < | * Returns the next avaliable Molecule based on the iterator. | 
| 207 | < | * @return the next avaliable molecule, return NULL if reaching the end of the array | 
| 208 | < | * @param i the iterator of molecule array | 
| 209 | < | */ | 
| 210 | < | Molecule* nextMolecule(MoleculeIterator& i); | 
| 206 | < |  | 
| 207 | < | /** Returns the number of degrees of freedom */ | 
| 208 | < | int getNdf() { | 
| 209 | < | return ndf_; | 
| 210 | < | } | 
| 205 | > | /** | 
| 206 | > | * Returns the next avaliable Molecule based on the iterator. | 
| 207 | > | * @return the next avaliable molecule, return NULL if reaching the end of the array | 
| 208 | > | * @param i the iterator of molecule array | 
| 209 | > | */ | 
| 210 | > | Molecule* nextMolecule(MoleculeIterator& i); | 
| 211 |  |  | 
| 212 | < | /** Returns the number of raw degrees of freedom */ | 
| 213 | < | int getNdfRaw() { | 
| 214 | < | return ndfRaw_; | 
| 215 | < | } | 
| 212 | > | /** Returns the number of degrees of freedom */ | 
| 213 | > | int getNdf() { | 
| 214 | > | return ndf_ - getFdf(); | 
| 215 | > | } | 
| 216 |  |  | 
| 217 | < | /** Returns the number of translational degrees of freedom */ | 
| 218 | < | int getNdfTrans() { | 
| 219 | < | return ndfTrans_; | 
| 220 | < | } | 
| 217 | > | /** Returns the number of raw degrees of freedom */ | 
| 218 | > | int getNdfRaw() { | 
| 219 | > | return ndfRaw_; | 
| 220 | > | } | 
| 221 |  |  | 
| 222 | < | //getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying | 
| 222 | > | /** Returns the number of translational degrees of freedom */ | 
| 223 | > | int getNdfTrans() { | 
| 224 | > | return ndfTrans_; | 
| 225 | > | } | 
| 226 | > |  | 
| 227 | > | /** sets the current number of frozen degrees of freedom */ | 
| 228 | > | void setFdf(int fdf) { | 
| 229 | > | fdf_local = fdf; | 
| 230 | > | } | 
| 231 | > |  | 
| 232 | > | int getFdf(); | 
| 233 | > |  | 
| 234 | > | //getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying | 
| 235 |  |  | 
| 236 | < | /** Returns the total number of z-constraint molecules in the system */ | 
| 237 | < | int getNZconstraint() { | 
| 238 | < | return nZconstraint_; | 
| 239 | < | } | 
| 236 | > | /** Returns the total number of z-constraint molecules in the system */ | 
| 237 | > | int getNZconstraint() { | 
| 238 | > | return nZconstraint_; | 
| 239 | > | } | 
| 240 |  |  | 
| 241 | < | /** | 
| 242 | < | * Sets the number of z-constraint molecules in the system. | 
| 243 | < | */ | 
| 244 | < | void setNZconstraint(int nZconstraint) { | 
| 245 | < | nZconstraint_ = nZconstraint; | 
| 246 | < | } | 
| 241 | > | /** | 
| 242 | > | * Sets the number of z-constraint molecules in the system. | 
| 243 | > | */ | 
| 244 | > | void setNZconstraint(int nZconstraint) { | 
| 245 | > | nZconstraint_ = nZconstraint; | 
| 246 | > | } | 
| 247 |  |  | 
| 248 | < | /** Returns the snapshot manager. */ | 
| 249 | < | SnapshotManager* getSnapshotManager() { | 
| 250 | < | return sman_; | 
| 251 | < | } | 
| 248 | > | /** Returns the snapshot manager. */ | 
| 249 | > | SnapshotManager* getSnapshotManager() { | 
| 250 | > | return sman_; | 
| 251 | > | } | 
| 252 |  |  | 
| 253 | < | /** Sets the snapshot manager. */ | 
| 254 | < | void setSnapshotManager(SnapshotManager* sman); | 
| 253 | > | /** Sets the snapshot manager. */ | 
| 254 | > | void setSnapshotManager(SnapshotManager* sman); | 
| 255 |  |  | 
| 256 | < | /** Returns the force field */ | 
| 257 | < | ForceField* getForceField() { | 
| 258 | < | return forceField_; | 
| 259 | < | } | 
| 256 | > | /** Returns the force field */ | 
| 257 | > | ForceField* getForceField() { | 
| 258 | > | return forceField_; | 
| 259 | > | } | 
| 260 |  |  | 
| 261 | < | Globals* getSimParams() { | 
| 262 | < | return simParams_; | 
| 263 | < | } | 
| 261 | > | Globals* getSimParams() { | 
| 262 | > | return simParams_; | 
| 263 | > | } | 
| 264 |  |  | 
| 265 | < | /** Returns the velocity of center of mass of the whole system.*/ | 
| 266 | < | Vector3d getComVel(); | 
| 265 | > | /** Returns the velocity of center of mass of the whole system.*/ | 
| 266 | > | Vector3d getComVel(); | 
| 267 |  |  | 
| 268 | < | /** Returns the center of the mass of the whole system.*/ | 
| 269 | < | Vector3d getCom(); | 
| 268 | > | /** Returns the center of the mass of the whole system.*/ | 
| 269 | > | Vector3d getCom(); | 
| 270 | > | /** Returns the center of the mass and Center of Mass velocity of the whole system.*/ | 
| 271 | > | void getComAll(Vector3d& com,Vector3d& comVel); | 
| 272 |  |  | 
| 273 | < | /** main driver function to interact with fortran during the initialization and molecule migration */ | 
| 274 | < | void update(); | 
| 273 | > | /** Returns intertia tensor for the entire system and system Angular Momentum.*/ | 
| 274 | > | void getInertiaTensor(Mat3x3d &intertiaTensor,Vector3d &angularMomentum); | 
| 275 | > |  | 
| 276 | > | /** Returns system angular momentum */ | 
| 277 | > | Vector3d getAngularMomentum(); | 
| 278 |  |  | 
| 279 | < | /** Returns the local index manager */ | 
| 280 | < | LocalIndexManager* getLocalIndexManager() { | 
| 281 | < | return &localIndexMan_; | 
| 282 | < | } | 
| 279 | > | /** Returns volume of system as estimated by an ellipsoid defined by the radii of gyration*/ | 
| 280 | > | void getGyrationalVolume(RealType &vol); | 
| 281 | > | /** Overloaded version of gyrational volume that also returns det(I) so dV/dr can be calculated*/ | 
| 282 | > | void getGyrationalVolume(RealType &vol, RealType &detI); | 
| 283 | > | /** main driver function to interact with fortran during the initialization and molecule migration */ | 
| 284 | > | void update(); | 
| 285 |  |  | 
| 286 | < | int getMoleculeStampId(int globalIndex) { | 
| 287 | < | //assert(globalIndex < molStampIds_.size()) | 
| 288 | < | return molStampIds_[globalIndex]; | 
| 289 | < | } | 
| 286 | > | /** Returns the local index manager */ | 
| 287 | > | LocalIndexManager* getLocalIndexManager() { | 
| 288 | > | return &localIndexMan_; | 
| 289 | > | } | 
| 290 |  |  | 
| 291 | < | /** Returns the molecule stamp */ | 
| 292 | < | MoleculeStamp* getMoleculeStamp(int id) { | 
| 293 | < | return moleculeStamps_[id]; | 
| 294 | < | } | 
| 291 | > | int getMoleculeStampId(int globalIndex) { | 
| 292 | > | //assert(globalIndex < molStampIds_.size()) | 
| 293 | > | return molStampIds_[globalIndex]; | 
| 294 | > | } | 
| 295 |  |  | 
| 296 | < | /** Return the total number of the molecule stamps */ | 
| 297 | < | int getNMoleculeStamp() { | 
| 298 | < | return moleculeStamps_.size(); | 
| 299 | < | } | 
| 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); | 
| 296 | > | /** Returns the molecule stamp */ | 
| 297 | > | MoleculeStamp* getMoleculeStamp(int id) { | 
| 298 | > | return moleculeStamps_[id]; | 
| 299 | > | } | 
| 300 |  |  | 
| 301 | < | return i != molecules_.end() ? i->second : NULL; | 
| 302 | < | } | 
| 301 | > | /** Return the total number of the molecule stamps */ | 
| 302 | > | int getNMoleculeStamp() { | 
| 303 | > | return moleculeStamps_.size(); | 
| 304 | > | } | 
| 305 | > | /** | 
| 306 | > | * Finds a molecule with a specified global index | 
| 307 | > | * @return a pointer point to found molecule | 
| 308 | > | * @param index | 
| 309 | > | */ | 
| 310 | > | Molecule* getMoleculeByGlobalIndex(int index) { | 
| 311 | > | MoleculeIterator i; | 
| 312 | > | i = molecules_.find(index); | 
| 313 |  |  | 
| 314 | < | /** Calculate the maximum cutoff radius based on the atom types */ | 
| 315 | < | double calcMaxCutoffRadius(); | 
| 314 | > | return i != molecules_.end() ? i->second : NULL; | 
| 315 | > | } | 
| 316 |  |  | 
| 317 | < | double getRcut() { | 
| 318 | < | return rcut_; | 
| 319 | < | } | 
| 317 | > | int getGlobalMolMembership(int id){ | 
| 318 | > | return globalMolMembership_[id]; | 
| 319 | > | } | 
| 320 |  |  | 
| 321 | < | double getRsw() { | 
| 322 | < | return rsw_; | 
| 323 | < | } | 
| 303 | < |  | 
| 304 | < | std::string getFinalConfigFileName() { | 
| 305 | < | return finalConfigFileName_; | 
| 306 | < | } | 
| 307 | < |  | 
| 308 | < | void setFinalConfigFileName(const std::string& fileName) { | 
| 309 | < | finalConfigFileName_ = fileName; | 
| 310 | < | } | 
| 321 | > | RealType getRcut() { | 
| 322 | > | return rcut_; | 
| 323 | > | } | 
| 324 |  |  | 
| 325 | < | std::string getDumpFileName() { | 
| 326 | < | return dumpFileName_; | 
| 327 | < | } | 
| 315 | < |  | 
| 316 | < | void setDumpFileName(const std::string& fileName) { | 
| 317 | < | dumpFileName_ = fileName; | 
| 318 | < | } | 
| 325 | > | RealType getRsw() { | 
| 326 | > | return rsw_; | 
| 327 | > | } | 
| 328 |  |  | 
| 329 | < | std::string getStatFileName() { | 
| 330 | < | return statFileName_; | 
| 331 | < | } | 
| 329 | > | RealType getList() { | 
| 330 | > | return rlist_; | 
| 331 | > | } | 
| 332 |  |  | 
| 333 | < | void setStatFileName(const std::string& fileName) { | 
| 334 | < | statFileName_ = fileName; | 
| 335 | < | } | 
| 333 | > | std::string getFinalConfigFileName() { | 
| 334 | > | return finalConfigFileName_; | 
| 335 | > | } | 
| 336 |  |  | 
| 337 | < | /** | 
| 338 | < | * Sets GlobalGroupMembership | 
| 339 | < | * @see #SimCreator::setGlobalIndex | 
| 331 | < | */ | 
| 332 | < | void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) { | 
| 333 | < | assert(globalGroupMembership.size() == nGlobalAtoms_); | 
| 334 | < | globalGroupMembership_ = globalGroupMembership; | 
| 335 | < | } | 
| 337 | > | void setFinalConfigFileName(const std::string& fileName) { | 
| 338 | > | finalConfigFileName_ = fileName; | 
| 339 | > | } | 
| 340 |  |  | 
| 341 | < | /** | 
| 342 | < | * Sets GlobalMolMembership | 
| 343 | < | * @see #SimCreator::setGlobalIndex | 
| 344 | < | */ | 
| 345 | < | void setGlobalMolMembership(const std::vector<int>& globalMolMembership) { | 
| 346 | < | assert(globalMolMembership.size() == nGlobalAtoms_); | 
| 347 | < | globalMolMembership_ = globalMolMembership; | 
| 348 | < | } | 
| 341 | > | std::string getRawMetaData() { | 
| 342 | > | return rawMetaData_; | 
| 343 | > | } | 
| 344 | > | void setRawMetaData(const std::string& rawMetaData) { | 
| 345 | > | rawMetaData_ = rawMetaData; | 
| 346 | > | } | 
| 347 | > |  | 
| 348 | > | std::string getDumpFileName() { | 
| 349 | > | return dumpFileName_; | 
| 350 | > | } | 
| 351 | > |  | 
| 352 | > | void setDumpFileName(const std::string& fileName) { | 
| 353 | > | dumpFileName_ = fileName; | 
| 354 | > | } | 
| 355 |  |  | 
| 356 | + | std::string getStatFileName() { | 
| 357 | + | return statFileName_; | 
| 358 | + | } | 
| 359 | + |  | 
| 360 | + | void setStatFileName(const std::string& fileName) { | 
| 361 | + | statFileName_ = fileName; | 
| 362 | + | } | 
| 363 | + |  | 
| 364 | + | std::string getRestFileName() { | 
| 365 | + | return restFileName_; | 
| 366 | + | } | 
| 367 | + |  | 
| 368 | + | void setRestFileName(const std::string& fileName) { | 
| 369 | + | restFileName_ = fileName; | 
| 370 | + | } | 
| 371 |  |  | 
| 372 | < | bool isFortranInitialized() { | 
| 373 | < | return fortranInitialized_; | 
| 374 | < | } | 
| 372 | > | /** | 
| 373 | > | * Sets GlobalGroupMembership | 
| 374 | > | * @see #SimCreator::setGlobalIndex | 
| 375 | > | */ | 
| 376 | > | void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) { | 
| 377 | > | assert(globalGroupMembership.size() == static_cast<size_t>(nGlobalAtoms_)); | 
| 378 | > | globalGroupMembership_ = globalGroupMembership; | 
| 379 | > | } | 
| 380 | > |  | 
| 381 | > | /** | 
| 382 | > | * Sets GlobalMolMembership | 
| 383 | > | * @see #SimCreator::setGlobalIndex | 
| 384 | > | */ | 
| 385 | > | void setGlobalMolMembership(const std::vector<int>& globalMolMembership) { | 
| 386 | > | assert(globalMolMembership.size() == static_cast<size_t>(nGlobalAtoms_)); | 
| 387 | > | globalMolMembership_ = globalMolMembership; | 
| 388 | > | } | 
| 389 | > |  | 
| 390 | > |  | 
| 391 | > | bool isFortranInitialized() { | 
| 392 | > | return fortranInitialized_; | 
| 393 | > | } | 
| 394 |  |  | 
| 395 | < | //below functions are just forward functions | 
| 396 | < | //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the | 
| 397 | < | //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); | 
| 395 | > | bool getCalcBoxDipole() { | 
| 396 | > | return calcBoxDipole_; | 
| 397 | > | } | 
| 398 |  |  | 
| 399 | < | /** | 
| 400 | < | * Removes property from PropertyMap by name | 
| 401 | < | * @param propName the name of property to be removed | 
| 363 | < | */ | 
| 364 | < | void removeProperty(const std::string& propName); | 
| 399 | > | bool getUseAtomicVirial() { | 
| 400 | > | return useAtomicVirial_; | 
| 401 | > | } | 
| 402 |  |  | 
| 403 | < | /** | 
| 404 | < | * clear all of the properties | 
| 405 | < | */ | 
| 406 | < | void clearProperties(); | 
| 403 | > | //below functions are just forward functions | 
| 404 | > | //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the | 
| 405 | > | //the other hand, has-a relation need composing. | 
| 406 | > | /** | 
| 407 | > | * Adds property into property map | 
| 408 | > | * @param genData GenericData to be added into PropertyMap | 
| 409 | > | */ | 
| 410 | > | void addProperty(GenericData* genData); | 
| 411 |  |  | 
| 412 | < | /** | 
| 413 | < | * Returns all names of properties | 
| 414 | < | * @return all names of properties | 
| 415 | < | */ | 
| 416 | < | std::vector<std::string> getPropertyNames(); | 
| 412 | > | /** | 
| 413 | > | * Removes property from PropertyMap by name | 
| 414 | > | * @param propName the name of property to be removed | 
| 415 | > | */ | 
| 416 | > | void removeProperty(const std::string& propName); | 
| 417 |  |  | 
| 418 | < | /** | 
| 419 | < | * Returns all of the properties in PropertyMap | 
| 420 | < | * @return all of the properties in PropertyMap | 
| 421 | < | */ | 
| 381 | < | std::vector<GenericData*> getProperties(); | 
| 418 | > | /** | 
| 419 | > | * clear all of the properties | 
| 420 | > | */ | 
| 421 | > | void clearProperties(); | 
| 422 |  |  | 
| 423 | < | /** | 
| 424 | < | * Returns property | 
| 425 | < | * @param propName name of property | 
| 426 | < | * @return a pointer point to property with propName. If no property named propName | 
| 427 | < | * exists, return NULL | 
| 388 | < | */ | 
| 389 | < | GenericData* getPropertyByName(const std::string& propName); | 
| 423 | > | /** | 
| 424 | > | * Returns all names of properties | 
| 425 | > | * @return all names of properties | 
| 426 | > | */ | 
| 427 | > | std::vector<std::string> getPropertyNames(); | 
| 428 |  |  | 
| 429 | < | /** | 
| 430 | < | * add all exclude pairs of a molecule into exclude list. | 
| 431 | < | */ | 
| 432 | < | void addExcludePairs(Molecule* mol); | 
| 429 | > | /** | 
| 430 | > | * Returns all of the properties in PropertyMap | 
| 431 | > | * @return all of the properties in PropertyMap | 
| 432 | > | */ | 
| 433 | > | std::vector<GenericData*> getProperties(); | 
| 434 |  |  | 
| 435 | < | /** | 
| 436 | < | * remove all exclude pairs which belong to a molecule from exclude list | 
| 437 | < | */ | 
| 435 | > | /** | 
| 436 | > | * Returns property | 
| 437 | > | * @param propName name of property | 
| 438 | > | * @return a pointer point to property with propName. If no property named propName | 
| 439 | > | * exists, return NULL | 
| 440 | > | */ | 
| 441 | > | GenericData* getPropertyByName(const std::string& propName); | 
| 442 |  |  | 
| 443 | < | void removeExcludePairs(Molecule* mol); | 
| 443 | > | /** | 
| 444 | > | * add all special interaction pairs (including excluded | 
| 445 | > | * interactions) in a molecule into the appropriate lists. | 
| 446 | > | */ | 
| 447 | > | void addInteractionPairs(Molecule* mol); | 
| 448 |  |  | 
| 449 | + | /** | 
| 450 | + | * remove all special interaction pairs which belong to a molecule | 
| 451 | + | * from the appropriate lists. | 
| 452 | + | */ | 
| 453 | + | void removeInteractionPairs(Molecule* mol); | 
| 454 |  |  | 
| 403 | – | SelectionManager* getSelectionManager() { | 
| 404 | – | return selectMan_; | 
| 405 | – | } | 
| 455 |  |  | 
| 456 | < | /** Returns the unique atom types of local processor in an array */ | 
| 457 | < | std::set<AtomType*> getUniqueAtomTypes(); | 
| 456 | > | /** Returns the unique atom types of local processor in an array */ | 
| 457 | > | std::set<AtomType*> getUniqueAtomTypes(); | 
| 458 |  |  | 
| 459 | < | friend std::ostream& operator <<(std::ostream& o, SimInfo& info); | 
| 459 | > | friend std::ostream& operator <<(std::ostream& o, SimInfo& info); | 
| 460 |  |  | 
| 461 | < | void getCutoff(double& rcut, double& rsw); | 
| 461 | > | void getCutoff(RealType& rcut, RealType& rsw); | 
| 462 |  |  | 
| 463 | < | private: | 
| 463 | > | private: | 
| 464 |  |  | 
| 465 | < | /** fill up the simtype struct*/ | 
| 466 | < | void setupSimType(); | 
| 465 | > | /** fill up the simtype struct*/ | 
| 466 | > | void setupSimType(); | 
| 467 |  |  | 
| 468 | < | /** | 
| 469 | < | * Setup Fortran Simulation | 
| 470 | < | * @see #setupFortranParallel | 
| 471 | < | */ | 
| 472 | < | void setupFortranSim(); | 
| 468 | > | /** | 
| 469 | > | * Setup Fortran Simulation | 
| 470 | > | * @see #setupFortranParallel | 
| 471 | > | */ | 
| 472 | > | void setupFortranSim(); | 
| 473 |  |  | 
| 474 | < | /** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ | 
| 475 | < | void setupCutoff(); | 
| 474 | > | /** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ | 
| 475 | > | void setupCutoff(); | 
| 476 |  |  | 
| 477 | < | /** Calculates the number of degress of freedom in the whole system */ | 
| 478 | < | void calcNdf(); | 
| 430 | < | void calcNdfRaw(); | 
| 431 | < | void calcNdfTrans(); | 
| 477 | > | /** Figure out which coulombic correction method to use and pass to fortran */ | 
| 478 | > | void setupElectrostaticSummationMethod( int isError ); | 
| 479 |  |  | 
| 480 | < | /** | 
| 481 | < | * 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); | 
| 480 | > | /** Figure out which polynomial type to use for the switching function */ | 
| 481 | > | void setupSwitchingFunction(); | 
| 482 |  |  | 
| 483 | < | ForceField* forceField_; | 
| 484 | < | Globals* simParams_; | 
| 483 | > | /** Determine if we need to accumulate the simulation box dipole */ | 
| 484 | > | void setupAccumulateBoxDipole(); | 
| 485 |  |  | 
| 486 | < | std::map<int, Molecule*>  molecules_; /**< Molecule array */ | 
| 486 | > | /** Calculates the number of degress of freedom in the whole system */ | 
| 487 | > | void calcNdf(); | 
| 488 | > | void calcNdfRaw(); | 
| 489 | > | void calcNdfTrans(); | 
| 490 | > |  | 
| 491 | > | ForceField* forceField_; | 
| 492 | > | Globals* simParams_; | 
| 493 | > |  | 
| 494 | > | std::map<int, Molecule*>  molecules_; /**< Molecule array */ | 
| 495 | > |  | 
| 496 | > | /** | 
| 497 | > | * Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole | 
| 498 | > | * system. | 
| 499 | > | */ | 
| 500 | > | void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); | 
| 501 |  |  | 
| 502 | < | //degress of freedom | 
| 503 | < | int ndf_;           /**< number of degress of freedom (excludes constraints),  ndf_ is local */ | 
| 504 | < | int ndfRaw_;    /**< number of degress of freedom (includes constraints),  ndfRaw_ is local */ | 
| 505 | < | int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ | 
| 506 | < | int nZconstraint_; /** number of  z-constraint molecules, nZconstraint_ is global */ | 
| 502 | > | //degress of freedom | 
| 503 | > | int ndf_;           /**< number of degress of freedom (excludes constraints),  ndf_ is local */ | 
| 504 | > | int fdf_local;       /**< number of frozen degrees of freedom */ | 
| 505 | > | int fdf_;            /**< number of frozen degrees of freedom */ | 
| 506 | > | int ndfRaw_;    /**< number of degress of freedom (includes constraints),  ndfRaw_ is local */ | 
| 507 | > | int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ | 
| 508 | > | int nZconstraint_; /** number of  z-constraint molecules, nZconstraint_ is global */ | 
| 509 |  |  | 
| 510 | < | //number of global objects | 
| 511 | < | int nGlobalMols_;       /**< number of molecules in the system */ | 
| 512 | < | int nGlobalAtoms_;   /**< number of atoms in the system */ | 
| 513 | < | int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */ | 
| 514 | < | int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ | 
| 515 | < | int nGlobalRigidBodies_; /**< number of rigid bodies in this system */ | 
| 516 | < | /** | 
| 517 | < | * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the | 
| 518 | < | * corresponding content is the global index of cutoff group this atom belong to. | 
| 519 | < | * It is filled by SimCreator once and only once, since it never changed during the simulation. | 
| 520 | < | */ | 
| 521 | < | std::vector<int> globalGroupMembership_; | 
| 510 | > | //number of global objects | 
| 511 | > | int nGlobalMols_;       /**< number of molecules in the system */ | 
| 512 | > | int nGlobalAtoms_;   /**< number of atoms in the system */ | 
| 513 | > | int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */ | 
| 514 | > | int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ | 
| 515 | > | int nGlobalRigidBodies_; /**< number of rigid bodies in this system */ | 
| 516 | > | /** | 
| 517 | > | * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the | 
| 518 | > | * corresponding content is the global index of cutoff group this atom belong to. | 
| 519 | > | * It is filled by SimCreator once and only once, since it never changed during the simulation. | 
| 520 | > | */ | 
| 521 | > | std::vector<int> globalGroupMembership_; | 
| 522 |  |  | 
| 523 | < | /** | 
| 524 | < | * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the | 
| 525 | < | * corresponding content is the global index of molecule this atom belong to. | 
| 526 | < | * It is filled by SimCreator once and only once, since it is never changed during the simulation. | 
| 527 | < | */ | 
| 528 | < | std::vector<int> globalMolMembership_; | 
| 523 | > | /** | 
| 524 | > | * the size of globalMolMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the | 
| 525 | > | * corresponding content is the global index of molecule this atom belong to. | 
| 526 | > | * It is filled by SimCreator once and only once, since it is never changed during the simulation. | 
| 527 | > | */ | 
| 528 | > | std::vector<int> globalMolMembership_; | 
| 529 |  |  | 
| 530 |  |  | 
| 531 | < | std::vector<int> molStampIds_;                                /**< stamp id array of all molecules in the system */ | 
| 532 | < | std::vector<MoleculeStamp*> moleculeStamps_;      /**< molecule stamps array */ | 
| 531 | > | std::vector<int> molStampIds_;                                /**< stamp id array of all molecules in the system */ | 
| 532 | > | std::vector<MoleculeStamp*> moleculeStamps_;      /**< molecule stamps array */ | 
| 533 |  |  | 
| 534 | < | //number of local objects | 
| 535 | < | int nAtoms_;                        /**< number of atoms in local processor */ | 
| 536 | < | int nBonds_;                        /**< number of bonds in local processor */ | 
| 537 | < | int nBends_;                        /**< number of bends in local processor */ | 
| 538 | < | int nTorsions_;                    /**< number of torsions in local processor */ | 
| 539 | < | int nRigidBodies_;              /**< number of rigid bodies in local processor */ | 
| 540 | < | int nIntegrableObjects_;    /**< number of integrable objects in local processor */ | 
| 541 | < | int nCutoffGroups_;             /**< number of cutoff groups in local processor */ | 
| 542 | < | int nConstraints_;              /**< number of constraints in local processors */ | 
| 534 | > | //number of local objects | 
| 535 | > | int nAtoms_;              /**< number of atoms in local processor */ | 
| 536 | > | int nBonds_;              /**< number of bonds in local processor */ | 
| 537 | > | int nBends_;              /**< number of bends in local processor */ | 
| 538 | > | int nTorsions_;           /**< number of torsions in local processor */ | 
| 539 | > | int nInversions_;         /**< number of inversions in local processor */ | 
| 540 | > | int nRigidBodies_;        /**< number of rigid bodies in local processor */ | 
| 541 | > | int nIntegrableObjects_;  /**< number of integrable objects in local processor */ | 
| 542 | > | int nCutoffGroups_;       /**< number of cutoff groups in local processor */ | 
| 543 | > | int nConstraints_;        /**< number of constraints in local processors */ | 
| 544 |  |  | 
| 545 | < | simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/ | 
| 546 | < | Exclude exclude_; | 
| 547 | < | PropertyMap properties_;                  /**< Generic Property */ | 
| 548 | < | SnapshotManager* sman_;               /**< SnapshotManager */ | 
| 545 | > | simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/ | 
| 546 | > | PairList excludedInteractions_; | 
| 547 | > | PairList oneTwoInteractions_; | 
| 548 | > | PairList oneThreeInteractions_; | 
| 549 | > | PairList oneFourInteractions_; | 
| 550 | > | PropertyMap properties_;                  /**< Generic Property */ | 
| 551 | > | SnapshotManager* sman_;               /**< SnapshotManager */ | 
| 552 |  |  | 
| 553 | < | /** | 
| 554 | < | * The reason to have a local index manager is that when molecule is migrating to other processors, | 
| 555 | < | * the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the | 
| 556 | < | * information of molecule migrating to current processor, Migrator class can query  the LocalIndexManager | 
| 557 | < | * to make a efficient data moving plan. | 
| 558 | < | */ | 
| 559 | < | LocalIndexManager localIndexMan_; | 
| 553 | > | /** | 
| 554 | > | * The reason to have a local index manager is that when molecule is migrating to other processors, | 
| 555 | > | * the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the | 
| 556 | > | * information of molecule migrating to current processor, Migrator class can query  the LocalIndexManager | 
| 557 | > | * to make a efficient data moving plan. | 
| 558 | > | */ | 
| 559 | > | LocalIndexManager localIndexMan_; | 
| 560 |  |  | 
| 561 | < | //file names | 
| 562 | < | std::string finalConfigFileName_; | 
| 499 | < | std::string dumpFileName_; | 
| 500 | < | std::string statFileName_; | 
| 561 | > | // unparsed MetaData block for storing in Dump and EOR files: | 
| 562 | > | std::string rawMetaData_; | 
| 563 |  |  | 
| 564 | < | double rcut_;       /**< cutoff radius*/ | 
| 565 | < | double rsw_;        /**< radius of switching function*/ | 
| 564 | > | //file names | 
| 565 | > | std::string finalConfigFileName_; | 
| 566 | > | std::string dumpFileName_; | 
| 567 | > | std::string statFileName_; | 
| 568 | > | std::string restFileName_; | 
| 569 | > |  | 
| 570 | > | RealType rcut_;       /**< cutoff radius*/ | 
| 571 | > | RealType rsw_;        /**< radius of switching function*/ | 
| 572 | > | RealType rlist_;      /**< neighbor list radius */ | 
| 573 |  |  | 
| 574 | < | bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */ | 
| 574 | > | int ljsp_; /**< use shifted potential for LJ*/ | 
| 575 | > | int ljsf_; /**< use shifted force for LJ*/ | 
| 576 |  |  | 
| 577 | < | SelectionManager* selectMan_; | 
| 578 | < | #ifdef IS_MPI | 
| 579 | < | //in Parallel version, we need MolToProc | 
| 577 | > | bool fortranInitialized_; /**< flag indicate whether fortran side | 
| 578 | > | is initialized */ | 
| 579 | > |  | 
| 580 | > | bool calcBoxDipole_; /**< flag to indicate whether or not we calculate | 
| 581 | > | the simulation box dipole moment */ | 
| 582 | > |  | 
| 583 | > | bool useAtomicVirial_; /**< flag to indicate whether or not we use | 
| 584 | > | Atomic Virials to calculate the pressure */ | 
| 585 | > |  | 
| 586 |  | public: | 
| 587 | + | /** | 
| 588 | + | * return an integral objects by its global index. In MPI version, if the StuntDouble with specified | 
| 589 | + | * global index does not belong to local processor, a NULL will be return. | 
| 590 | + | */ | 
| 591 | + | StuntDouble* getIOIndexToIntegrableObject(int index); | 
| 592 | + | void setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v); | 
| 593 | + | private: | 
| 594 | + | std::vector<StuntDouble*> IOIndexToIntegrableObject; | 
| 595 | + | //public: | 
| 596 | + | //void setStuntDoubleFromGlobalIndex(std::vector<StuntDouble*> v); | 
| 597 | + | /** | 
| 598 | + | * return a StuntDouble by its global index. In MPI version, if the StuntDouble with specified | 
| 599 | + | * global index does not belong to local processor, a NULL will be return. | 
| 600 | + | */ | 
| 601 | + | //StuntDouble* getStuntDoubleFromGlobalIndex(int index); | 
| 602 | + | //private: | 
| 603 | + | //std::vector<StuntDouble*> sdByGlobalIndex_; | 
| 604 | + |  | 
| 605 | + | //in Parallel version, we need MolToProc | 
| 606 | + | public: | 
| 607 |  |  | 
| 608 | < | /** | 
| 609 | < | * Finds the processor where a molecule resides | 
| 610 | < | * @return the id of the processor which contains the molecule | 
| 611 | < | * @param globalIndex global Index of the molecule | 
| 612 | < | */ | 
| 613 | < | int getMolToProc(int globalIndex) { | 
| 614 | < | //assert(globalIndex < molToProcMap_.size()); | 
| 615 | < | return molToProcMap_[globalIndex]; | 
| 616 | < | } | 
| 608 | > | /** | 
| 609 | > | * Finds the processor where a molecule resides | 
| 610 | > | * @return the id of the processor which contains the molecule | 
| 611 | > | * @param globalIndex global Index of the molecule | 
| 612 | > | */ | 
| 613 | > | int getMolToProc(int globalIndex) { | 
| 614 | > | //assert(globalIndex < molToProcMap_.size()); | 
| 615 | > | return molToProcMap_[globalIndex]; | 
| 616 | > | } | 
| 617 |  |  | 
| 618 | < | /** | 
| 619 | < | * Set MolToProcMap array | 
| 620 | < | * @see #SimCreator::divideMolecules | 
| 621 | < | */ | 
| 622 | < | void setMolToProcMap(const std::vector<int>& molToProcMap) { | 
| 623 | < | molToProcMap_ = molToProcMap; | 
| 624 | < | } | 
| 618 | > | /** | 
| 619 | > | * Set MolToProcMap array | 
| 620 | > | * @see #SimCreator::divideMolecules | 
| 621 | > | */ | 
| 622 | > | void setMolToProcMap(const std::vector<int>& molToProcMap) { | 
| 623 | > | molToProcMap_ = molToProcMap; | 
| 624 | > | } | 
| 625 |  |  | 
| 626 | < | private: | 
| 626 | > | private: | 
| 627 |  |  | 
| 628 | < | void setupFortranParallel(); | 
| 628 | > | void setupFortranParallel(); | 
| 629 |  |  | 
| 630 | < | /** | 
| 631 | < | * The size of molToProcMap_ is equal to total number of molecules in the system. | 
| 632 | < | *  It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only | 
| 633 | < | * once. | 
| 634 | < | */ | 
| 635 | < | std::vector<int> molToProcMap_; | 
| 630 | > | /** | 
| 631 | > | * The size of molToProcMap_ is equal to total number of molecules | 
| 632 | > | * in the system.  It maps a molecule to the processor on which it | 
| 633 | > | * resides. it is filled by SimCreator once and only once. | 
| 634 | > | */ | 
| 635 | > | std::vector<int> molToProcMap_; | 
| 636 |  |  | 
| 541 | – | #endif | 
| 637 |  |  | 
| 638 | < | }; | 
| 638 | > | }; | 
| 639 |  |  | 
| 640 | < | } //namespace oopse | 
| 640 | > | } //namespace OpenMD | 
| 641 |  | #endif //BRAINS_SIMMODEL_HPP | 
| 642 |  |  |