| 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, 234107 (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" | 
| 62 |  | #include "types/MoleculeStamp.hpp" | 
| 63 | < | #include "UseTheForce/ForceField.hpp" | 
| 63 | > | #include "brains/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" | 
| 68 | > | using namespace std; | 
| 69 | > | namespace OpenMD{ | 
| 70 | > | //forward declaration | 
| 71 | > | class SnapshotManager; | 
| 72 | > | class Molecule; | 
| 73 | > | class SelectionManager; | 
| 74 | > | class StuntDouble; | 
| 75 |  |  | 
| 76 | < | namespace oopse{ | 
| 76 | > | /** | 
| 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 map<int, Molecule*>::iterator  MoleculeIterator; | 
| 90 | > |  | 
| 91 | > | /** | 
| 92 | > | * Constructor of SimInfo | 
| 93 | > | * | 
| 94 | > | * @param ff pointer to a concrete ForceField instance | 
| 95 | > | * | 
| 96 | > | * @param simParams pointer to the simulation parameters in a Globals object | 
| 97 | > | */ | 
| 98 | > | SimInfo(ForceField* ff, Globals* simParams); | 
| 99 | > | virtual ~SimInfo(); | 
| 100 |  |  | 
| 101 | < | //forward decalration | 
| 102 | < | class SnapshotManager; | 
| 103 | < | class Molecule; | 
| 104 | < | class SelectionManager; | 
| 105 | < | /** | 
| 106 | < | * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" | 
| 107 | < | * @brief As one of the heavy weight class of OOPSE, SimInfo | 
| 108 | < | * One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules. | 
| 109 | < | * And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies, | 
| 80 | < | * cutoff groups, constrains). | 
| 81 | < | * Another major change is the index. No matter single version or parallel version,  atoms and | 
| 82 | < | * rigid bodies have both global index and local index. Local index is not important to molecule as well as | 
| 83 | < | * cutoff group. | 
| 84 | < | */ | 
| 85 | < | class SimInfo { | 
| 86 | < | public: | 
| 87 | < | typedef std::map<int, Molecule*>::iterator  MoleculeIterator; | 
| 101 | > | /** | 
| 102 | > | * Adds a molecule | 
| 103 | > | * | 
| 104 | > | * @return return true if adding successfully, return false if the | 
| 105 | > | * molecule is already in SimInfo | 
| 106 | > | * | 
| 107 | > | * @param mol Molecule to be added | 
| 108 | > | */ | 
| 109 | > | bool addMolecule(Molecule* mol); | 
| 110 |  |  | 
| 111 | < | /** | 
| 112 | < | * Constructor of SimInfo | 
| 113 | < | * @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the | 
| 114 | < | * second element is the total number of molecules with the same molecule stamp in the system | 
| 115 | < | * @param ff pointer of a concrete ForceField instance | 
| 116 | < | * @param simParams | 
| 117 | < | * @note | 
| 96 | < | */ | 
| 97 | < | SimInfo(std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, ForceField* ff, Globals* simParams); | 
| 98 | < | virtual ~SimInfo(); | 
| 111 | > | /** | 
| 112 | > | * Removes a molecule from SimInfo | 
| 113 | > | * | 
| 114 | > | * @return true if removing successfully, return false if molecule | 
| 115 | > | * is not in this SimInfo | 
| 116 | > | */ | 
| 117 | > | bool removeMolecule(Molecule* mol); | 
| 118 |  |  | 
| 119 | < | /** | 
| 120 | < | * Adds a molecule | 
| 121 | < | * @return return true if adding successfully, return false if the molecule is already in SimInfo | 
| 122 | < | * @param mol molecule to be added | 
| 104 | < | */ | 
| 105 | < | bool addMolecule(Molecule* mol); | 
| 119 | > | /** Returns the total number of molecules in the system. */ | 
| 120 | > | int getNGlobalMolecules() { | 
| 121 | > | return nGlobalMols_; | 
| 122 | > | } | 
| 123 |  |  | 
| 124 | < | /** | 
| 125 | < | * Removes a molecule from SimInfo | 
| 126 | < | * @return true if removing successfully, return false if molecule is not in this SimInfo | 
| 127 | < | */ | 
| 111 | < | bool removeMolecule(Molecule* mol); | 
| 124 | > | /** Returns the total number of atoms in the system. */ | 
| 125 | > | int getNGlobalAtoms() { | 
| 126 | > | return nGlobalAtoms_; | 
| 127 | > | } | 
| 128 |  |  | 
| 129 | < | /** Returns the total number of molecules in the system. */ | 
| 130 | < | int getNGlobalMolecules() { | 
| 131 | < | return nGlobalMols_; | 
| 132 | < | } | 
| 129 | > | /** Returns the total number of cutoff groups in the system. */ | 
| 130 | > | int getNGlobalCutoffGroups() { | 
| 131 | > | return nGlobalCutoffGroups_; | 
| 132 | > | } | 
| 133 |  |  | 
| 134 | < | /** Returns the total number of atoms in the system. */ | 
| 135 | < | int getNGlobalAtoms() { | 
| 136 | < | return nGlobalAtoms_; | 
| 137 | < | } | 
| 134 | > | /** | 
| 135 | > | * Returns the total number of integrable objects (total number of | 
| 136 | > | * rigid bodies plus the total number of atoms which do not belong | 
| 137 | > | * to the rigid bodies) in the system | 
| 138 | > | */ | 
| 139 | > | int getNGlobalIntegrableObjects() { | 
| 140 | > | return nGlobalIntegrableObjects_; | 
| 141 | > | } | 
| 142 |  |  | 
| 143 | < | /** Returns the total number of cutoff groups in the system. */ | 
| 144 | < | int getNGlobalCutoffGroups() { | 
| 145 | < | return nGlobalCutoffGroups_; | 
| 146 | < | } | 
| 143 | > | /** | 
| 144 | > | * Returns the total number of integrable objects (total number of | 
| 145 | > | * rigid bodies plus the total number of atoms which do not belong | 
| 146 | > | * to the rigid bodies) in the system | 
| 147 | > | */ | 
| 148 | > | int getNGlobalRigidBodies() { | 
| 149 | > | return nGlobalRigidBodies_; | 
| 150 | > | } | 
| 151 |  |  | 
| 152 | < | /** | 
| 153 | < | * Returns the total number of integrable objects (total number of rigid bodies plus the total number | 
| 154 | < | * of atoms which do not belong to the rigid bodies) in the system | 
| 155 | < | */ | 
| 132 | < | int getNGlobalIntegrableObjects() { | 
| 133 | < | return nGlobalIntegrableObjects_; | 
| 134 | < | } | 
| 152 | > | /** Returns the number of global bonds */ | 
| 153 | > | unsigned int getNGlobalBonds(){ | 
| 154 | > | return nGlobalBonds_; | 
| 155 | > | } | 
| 156 |  |  | 
| 157 | < | /** | 
| 158 | < | * Returns the total number of integrable objects (total number of rigid bodies plus the total number | 
| 159 | < | * of atoms which do not belong to the rigid bodies) in the system | 
| 160 | < | */ | 
| 140 | < | int getNGlobalRigidBodies() { | 
| 141 | < | return nGlobalRigidBodies_; | 
| 142 | < | } | 
| 157 | > | /** Returns the number of global bends */ | 
| 158 | > | unsigned int getNGlobalBends() { | 
| 159 | > | return nGlobalBends_; | 
| 160 | > | } | 
| 161 |  |  | 
| 162 | < | int getNGlobalConstraints(); | 
| 163 | < | /** | 
| 164 | < | * Returns the number of local molecules. | 
| 165 | < | * @return the number of local molecules | 
| 148 | < | */ | 
| 149 | < | int getNMolecules() { | 
| 150 | < | return molecules_.size(); | 
| 151 | < | } | 
| 162 | > | /** Returns the number of global torsions */ | 
| 163 | > | unsigned int getNGlobalTorsions() { | 
| 164 | > | return nGlobalTorsions_; | 
| 165 | > | } | 
| 166 |  |  | 
| 167 | < | /** Returns the number of local atoms */ | 
| 168 | < | unsigned int getNAtoms() { | 
| 169 | < | return nAtoms_; | 
| 170 | < | } | 
| 167 | > | /** Returns the number of global inversions */ | 
| 168 | > | unsigned int getNGlobalInversions() { | 
| 169 | > | return nGlobalInversions_; | 
| 170 | > | } | 
| 171 |  |  | 
| 172 | < | /** Returns the number of local bonds */ | 
| 173 | < | unsigned int getNBonds(){ | 
| 174 | < | return nBonds_; | 
| 175 | < | } | 
| 172 | > | unsigned int getNGlobalConstraints() { | 
| 173 | > | if (!hasNGlobalConstraints_) calcNConstraints(); | 
| 174 | > | return nGlobalConstraints_; | 
| 175 | > | } | 
| 176 | > | /** | 
| 177 | > | * Returns the number of local molecules. | 
| 178 | > | * @return the number of local molecules | 
| 179 | > | */ | 
| 180 | > | int getNMolecules() { | 
| 181 | > | return molecules_.size(); | 
| 182 | > | } | 
| 183 |  |  | 
| 184 | < | /** Returns the number of local bends */ | 
| 185 | < | unsigned int getNBends() { | 
| 186 | < | return nBends_; | 
| 187 | < | } | 
| 184 | > | /** Returns the number of local atoms */ | 
| 185 | > | unsigned int getNAtoms() { | 
| 186 | > | return nAtoms_; | 
| 187 | > | } | 
| 188 |  |  | 
| 189 | < | /** Returns the number of local torsions */ | 
| 190 | < | unsigned int getNTorsions() { | 
| 170 | < | return nTorsions_; | 
| 171 | < | } | 
| 189 | > | /** Returns the number of effective cutoff groups on local processor */ | 
| 190 | > | unsigned int getNLocalCutoffGroups(); | 
| 191 |  |  | 
| 192 | < | /** Returns the number of local rigid bodies */ | 
| 193 | < | unsigned int getNRigidBodies() { | 
| 194 | < | return nRigidBodies_; | 
| 195 | < | } | 
| 192 | > | /** Returns the number of local bonds */ | 
| 193 | > | unsigned int getNBonds(){ | 
| 194 | > | return nBonds_; | 
| 195 | > | } | 
| 196 |  |  | 
| 197 | < | /** Returns the number of local integrable objects */ | 
| 198 | < | unsigned int getNIntegrableObjects() { | 
| 199 | < | return nIntegrableObjects_; | 
| 200 | < | } | 
| 197 | > | /** Returns the number of local bends */ | 
| 198 | > | unsigned int getNBends() { | 
| 199 | > | return nBends_; | 
| 200 | > | } | 
| 201 |  |  | 
| 202 | < | /** Returns the number of local cutoff groups */ | 
| 203 | < | unsigned int getNCutoffGroups() { | 
| 204 | < | return nCutoffGroups_; | 
| 205 | < | } | 
| 202 | > | /** Returns the number of local torsions */ | 
| 203 | > | unsigned int getNTorsions() { | 
| 204 | > | return nTorsions_; | 
| 205 | > | } | 
| 206 |  |  | 
| 207 | < | /** Returns the total number of constraints in this SimInfo */ | 
| 208 | < | unsigned int getNConstraints() { | 
| 209 | < | return nConstraints_; | 
| 210 | < | } | 
| 211 | < |  | 
| 212 | < | /** | 
| 213 | < | * Returns the first molecule in this SimInfo and intialize the iterator. | 
| 214 | < | * @return the first molecule, return NULL if there is not molecule in this SimInfo | 
| 196 | < | * @param i the iterator of molecule array (user shouldn't change it) | 
| 197 | < | */ | 
| 198 | < | Molecule* beginMolecule(MoleculeIterator& i); | 
| 207 | > | /** Returns the number of local inversions */ | 
| 208 | > | unsigned int getNInversions() { | 
| 209 | > | return nInversions_; | 
| 210 | > | } | 
| 211 | > | /** Returns the number of local rigid bodies */ | 
| 212 | > | unsigned int getNRigidBodies() { | 
| 213 | > | return nRigidBodies_; | 
| 214 | > | } | 
| 215 |  |  | 
| 216 | < | /** | 
| 217 | < | * Returns the next avaliable Molecule based on the iterator. | 
| 218 | < | * @return the next avaliable molecule, return NULL if reaching the end of the array | 
| 219 | < | * @param i the iterator of molecule array | 
| 204 | < | */ | 
| 205 | < | Molecule* nextMolecule(MoleculeIterator& i); | 
| 216 | > | /** Returns the number of local integrable objects */ | 
| 217 | > | unsigned int getNIntegrableObjects() { | 
| 218 | > | return nIntegrableObjects_; | 
| 219 | > | } | 
| 220 |  |  | 
| 221 | < | /** Returns the number of degrees of freedom */ | 
| 222 | < | int getNdf() { | 
| 223 | < | return ndf_; | 
| 224 | < | } | 
| 211 | < |  | 
| 212 | < | /** Returns the number of raw degrees of freedom */ | 
| 213 | < | int getNdfRaw() { | 
| 214 | < | return ndfRaw_; | 
| 215 | < | } | 
| 221 | > | /** Returns the number of local cutoff groups */ | 
| 222 | > | unsigned int getNCutoffGroups() { | 
| 223 | > | return nCutoffGroups_; | 
| 224 | > | } | 
| 225 |  |  | 
| 226 | < | /** Returns the number of translational degrees of freedom */ | 
| 227 | < | int getNdfTrans() { | 
| 228 | < | return ndfTrans_; | 
| 229 | < | } | 
| 221 | < |  | 
| 222 | < | //getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying | 
| 226 | > | /** Returns the total number of constraints in this SimInfo */ | 
| 227 | > | unsigned int getNConstraints() { | 
| 228 | > | return nConstraints_; | 
| 229 | > | } | 
| 230 |  |  | 
| 231 | < | /** Returns the total number of z-constraint molecules in the system */ | 
| 232 | < | int getNZconstraint() { | 
| 233 | < | return nZconstraint_; | 
| 234 | < | } | 
| 231 | > | /** | 
| 232 | > | * Returns the first molecule in this SimInfo and intialize the iterator. | 
| 233 | > | * @return the first molecule, return NULL if there is not molecule in this SimInfo | 
| 234 | > | * @param i the iterator of molecule array (user shouldn't change it) | 
| 235 | > | */ | 
| 236 | > | Molecule* beginMolecule(MoleculeIterator& i); | 
| 237 |  |  | 
| 238 | < | /** | 
| 239 | < | * Sets the number of z-constraint molecules in the system. | 
| 240 | < | */ | 
| 241 | < | void setNZconstraint(int nZconstraint) { | 
| 242 | < | nZconstraint_ = nZconstraint; | 
| 243 | < | } | 
| 238 | > | /** | 
| 239 | > | * Returns the next avaliable Molecule based on the iterator. | 
| 240 | > | * @return the next avaliable molecule, return NULL if reaching the end of the array | 
| 241 | > | * @param i the iterator of molecule array | 
| 242 | > | */ | 
| 243 | > | Molecule* nextMolecule(MoleculeIterator& i); | 
| 244 | > |  | 
| 245 | > | /** Returns the total number of fluctuating charges that are present */ | 
| 246 | > | int getNFluctuatingCharges() { | 
| 247 | > | return nGlobalFluctuatingCharges_; | 
| 248 | > | } | 
| 249 | > |  | 
| 250 | > | /** Returns the number of degrees of freedom */ | 
| 251 | > | int getNdf() { | 
| 252 | > | return ndf_ - getFdf(); | 
| 253 | > | } | 
| 254 | > |  | 
| 255 | > | /** Returns the number of degrees of freedom (LOCAL) */ | 
| 256 | > | int getNdfLocal() { | 
| 257 | > | return ndfLocal_; | 
| 258 | > | } | 
| 259 | > |  | 
| 260 | > | /** Returns the number of raw degrees of freedom */ | 
| 261 | > | int getNdfRaw() { | 
| 262 | > | return ndfRaw_; | 
| 263 | > | } | 
| 264 | > |  | 
| 265 | > | /** Returns the number of translational degrees of freedom */ | 
| 266 | > | int getNdfTrans() { | 
| 267 | > | return ndfTrans_; | 
| 268 | > | } | 
| 269 | > |  | 
| 270 | > | /** sets the current number of frozen degrees of freedom */ | 
| 271 | > | void setFdf(int fdf) { | 
| 272 | > | fdf_local = fdf; | 
| 273 | > | } | 
| 274 | > |  | 
| 275 | > | int getFdf(); | 
| 276 | > |  | 
| 277 | > | //getNZconstraint and setNZconstraint ruin the coherence of | 
| 278 | > | //SimInfo class, need refactoring | 
| 279 |  |  | 
| 280 | < | /** Returns the snapshot manager. */ | 
| 281 | < | SnapshotManager* getSnapshotManager() { | 
| 282 | < | return sman_; | 
| 283 | < | } | 
| 280 | > | /** Returns the total number of z-constraint molecules in the system */ | 
| 281 | > | int getNZconstraint() { | 
| 282 | > | return nZconstraint_; | 
| 283 | > | } | 
| 284 |  |  | 
| 285 | < | /** Sets the snapshot manager. */ | 
| 286 | < | void setSnapshotManager(SnapshotManager* sman); | 
| 285 | > | /** | 
| 286 | > | * Sets the number of z-constraint molecules in the system. | 
| 287 | > | */ | 
| 288 | > | void setNZconstraint(int nZconstraint) { | 
| 289 | > | nZconstraint_ = nZconstraint; | 
| 290 | > | } | 
| 291 |  |  | 
| 292 | < | /** Returns the force field */ | 
| 293 | < | ForceField* getForceField() { | 
| 294 | < | return forceField_; | 
| 295 | < | } | 
| 292 | > | /** Returns the snapshot manager. */ | 
| 293 | > | SnapshotManager* getSnapshotManager() { | 
| 294 | > | return sman_; | 
| 295 | > | } | 
| 296 | > | /** Returns the storage layout (computed by SimCreator) */ | 
| 297 | > | int getStorageLayout() { | 
| 298 | > | return storageLayout_; | 
| 299 | > | } | 
| 300 | > | /** Sets the storage layout (computed by SimCreator) */ | 
| 301 | > | void setStorageLayout(int sl) { | 
| 302 | > | storageLayout_ = sl; | 
| 303 | > | } | 
| 304 | > |  | 
| 305 | > | /** Sets the snapshot manager. */ | 
| 306 | > | void setSnapshotManager(SnapshotManager* sman); | 
| 307 | > |  | 
| 308 | > | /** Returns the force field */ | 
| 309 | > | ForceField* getForceField() { | 
| 310 | > | return forceField_; | 
| 311 | > | } | 
| 312 |  |  | 
| 313 | < | Globals* getSimParams() { | 
| 314 | < | return simParams_; | 
| 315 | < | } | 
| 313 | > | Globals* getSimParams() { | 
| 314 | > | return simParams_; | 
| 315 | > | } | 
| 316 |  |  | 
| 317 | < | /** Returns the velocity of center of mass of the whole system.*/ | 
| 318 | < | Vector3d getComVel(); | 
| 317 | > | void update(); | 
| 318 | > | /** | 
| 319 | > | * Do final bookkeeping before Force managers need their data. | 
| 320 | > | */ | 
| 321 | > | void prepareTopology(); | 
| 322 |  |  | 
| 256 | – | /** Returns the center of the mass of the whole system.*/ | 
| 257 | – | Vector3d getCom(); | 
| 323 |  |  | 
| 324 | < | /** main driver function to interact with fortran during the initialization and molecule migration */ | 
| 325 | < | void update(); | 
| 324 | > | /** Returns the local index manager */ | 
| 325 | > | LocalIndexManager* getLocalIndexManager() { | 
| 326 | > | return &localIndexMan_; | 
| 327 | > | } | 
| 328 |  |  | 
| 329 | < | /** Returns the local index manager */ | 
| 330 | < | LocalIndexManager* getLocalIndexManager() { | 
| 331 | < | return &localIndexMan_; | 
| 332 | < | } | 
| 329 | > | int getMoleculeStampId(int globalIndex) { | 
| 330 | > | //assert(globalIndex < molStampIds_.size()) | 
| 331 | > | return molStampIds_[globalIndex]; | 
| 332 | > | } | 
| 333 |  |  | 
| 334 | < | int getMoleculeStampId(int globalIndex) { | 
| 335 | < | //assert(globalIndex < molStampIds_.size()) | 
| 336 | < | return molStampIds_[globalIndex]; | 
| 337 | < | } | 
| 334 | > | /** Returns the molecule stamp */ | 
| 335 | > | MoleculeStamp* getMoleculeStamp(int id) { | 
| 336 | > | return moleculeStamps_[id]; | 
| 337 | > | } | 
| 338 |  |  | 
| 339 | < | /** Returns the molecule stamp */ | 
| 340 | < | MoleculeStamp* getMoleculeStamp(int id) { | 
| 341 | < | return moleculeStamps_[id]; | 
| 342 | < | } | 
| 339 | > | /** Return the total number of the molecule stamps */ | 
| 340 | > | int getNMoleculeStamp() { | 
| 341 | > | return moleculeStamps_.size(); | 
| 342 | > | } | 
| 343 | > | /** | 
| 344 | > | * Finds a molecule with a specified global index | 
| 345 | > | * @return a pointer point to found molecule | 
| 346 | > | * @param index | 
| 347 | > | */ | 
| 348 | > | Molecule* getMoleculeByGlobalIndex(int index) { | 
| 349 | > | MoleculeIterator i; | 
| 350 | > | i = molecules_.find(index); | 
| 351 |  |  | 
| 352 | < | /** Return the total number of the molecule stamps */ | 
| 353 | < | int getNMoleculeStamp() { | 
| 279 | < | return moleculeStamps_.size(); | 
| 280 | < | } | 
| 281 | < | /** | 
| 282 | < | * Finds a molecule with a specified global index | 
| 283 | < | * @return a pointer point to found molecule | 
| 284 | < | * @param index | 
| 285 | < | */ | 
| 286 | < | Molecule* getMoleculeByGlobalIndex(int index) { | 
| 287 | < | MoleculeIterator i; | 
| 288 | < | i = molecules_.find(index); | 
| 352 | > | return i != molecules_.end() ? i->second : NULL; | 
| 353 | > | } | 
| 354 |  |  | 
| 355 | < | return i != molecules_.end() ? i->second : NULL; | 
| 356 | < | } | 
| 355 | > | int getGlobalMolMembership(int id){ | 
| 356 | > | return globalMolMembership_[id]; | 
| 357 | > | } | 
| 358 |  |  | 
| 359 | < | /** Calculate the maximum cutoff radius based on the atom types */ | 
| 360 | < | double calcMaxCutoffRadius(); | 
| 359 | > | /** | 
| 360 | > | * returns a vector which maps the local atom index on this | 
| 361 | > | * processor to the global atom index.  With only one processor, | 
| 362 | > | * these should be identical. | 
| 363 | > | */ | 
| 364 | > | vector<int> getGlobalAtomIndices(); | 
| 365 |  |  | 
| 366 | < | double getRcut() { | 
| 367 | < | return rcut_; | 
| 368 | < | } | 
| 366 | > | /** | 
| 367 | > | * returns a vector which maps the local cutoff group index on | 
| 368 | > | * this processor to the global cutoff group index.  With only one | 
| 369 | > | * processor, these should be identical. | 
| 370 | > | */ | 
| 371 | > | vector<int> getGlobalGroupIndices(); | 
| 372 |  |  | 
| 300 | – | double getRsw() { | 
| 301 | – | return rsw_; | 
| 302 | – | } | 
| 373 |  |  | 
| 374 | < | std::string getFinalConfigFileName() { | 
| 375 | < | return finalConfigFileName_; | 
| 376 | < | } | 
| 307 | < |  | 
| 308 | < | void setFinalConfigFileName(const std::string& fileName) { | 
| 309 | < | finalConfigFileName_ = fileName; | 
| 310 | < | } | 
| 374 | > | string getFinalConfigFileName() { | 
| 375 | > | return finalConfigFileName_; | 
| 376 | > | } | 
| 377 |  |  | 
| 378 | < | std::string getDumpFileName() { | 
| 379 | < | return dumpFileName_; | 
| 380 | < | } | 
| 315 | < |  | 
| 316 | < | void setDumpFileName(const std::string& fileName) { | 
| 317 | < | dumpFileName_ = fileName; | 
| 318 | < | } | 
| 378 | > | void setFinalConfigFileName(const string& fileName) { | 
| 379 | > | finalConfigFileName_ = fileName; | 
| 380 | > | } | 
| 381 |  |  | 
| 382 | < | std::string getStatFileName() { | 
| 383 | < | return statFileName_; | 
| 384 | < | } | 
| 382 | > | string getRawMetaData() { | 
| 383 | > | return rawMetaData_; | 
| 384 | > | } | 
| 385 | > | void setRawMetaData(const string& rawMetaData) { | 
| 386 | > | rawMetaData_ = rawMetaData; | 
| 387 | > | } | 
| 388 |  |  | 
| 389 | < | void setStatFileName(const std::string& fileName) { | 
| 390 | < | statFileName_ = fileName; | 
| 391 | < | } | 
| 389 | > | string getDumpFileName() { | 
| 390 | > | return dumpFileName_; | 
| 391 | > | } | 
| 392 | > |  | 
| 393 | > | void setDumpFileName(const string& fileName) { | 
| 394 | > | dumpFileName_ = fileName; | 
| 395 | > | } | 
| 396 |  |  | 
| 397 | < | /** | 
| 398 | < | * Sets GlobalGroupMembership | 
| 399 | < | * @see #SimCreator::setGlobalIndex | 
| 400 | < | */ | 
| 401 | < | void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) { | 
| 402 | < | assert(globalGroupMembership.size() == nGlobalAtoms_); | 
| 403 | < | globalGroupMembership_ = globalGroupMembership; | 
| 404 | < | } | 
| 397 | > | string getStatFileName() { | 
| 398 | > | return statFileName_; | 
| 399 | > | } | 
| 400 | > |  | 
| 401 | > | void setStatFileName(const string& fileName) { | 
| 402 | > | statFileName_ = fileName; | 
| 403 | > | } | 
| 404 | > |  | 
| 405 | > | string getRestFileName() { | 
| 406 | > | return restFileName_; | 
| 407 | > | } | 
| 408 | > |  | 
| 409 | > | void setRestFileName(const string& fileName) { | 
| 410 | > | restFileName_ = fileName; | 
| 411 | > | } | 
| 412 |  |  | 
| 413 | < | /** | 
| 414 | < | * Sets GlobalMolMembership | 
| 415 | < | * @see #SimCreator::setGlobalIndex | 
| 416 | < | */ | 
| 417 | < | void setGlobalMolMembership(const std::vector<int>& globalMolMembership) { | 
| 418 | < | assert(globalMolMembership.size() == nGlobalAtoms_); | 
| 419 | < | globalMolMembership_ = globalMolMembership; | 
| 344 | < | } | 
| 413 | > | /** | 
| 414 | > | * Sets GlobalGroupMembership | 
| 415 | > | */ | 
| 416 | > | void setGlobalGroupMembership(const vector<int>& ggm) { | 
| 417 | > | assert(ggm.size() == static_cast<size_t>(nGlobalAtoms_)); | 
| 418 | > | globalGroupMembership_ = ggm; | 
| 419 | > | } | 
| 420 |  |  | 
| 421 | + | /** | 
| 422 | + | * Sets GlobalMolMembership | 
| 423 | + | */ | 
| 424 | + | void setGlobalMolMembership(const vector<int>& gmm) { | 
| 425 | + | assert(gmm.size() == (static_cast<size_t>(nGlobalAtoms_ + | 
| 426 | + | nGlobalRigidBodies_))); | 
| 427 | + | globalMolMembership_ = gmm; | 
| 428 | + | } | 
| 429 |  |  | 
| 430 | < | bool isFortranInitialized() { | 
| 431 | < | return fortranInitialized_; | 
| 432 | < | } | 
| 430 | > |  | 
| 431 | > | bool isTopologyDone() { | 
| 432 | > | return topologyDone_; | 
| 433 | > | } | 
| 434 |  |  | 
| 435 | < | //below functions are just forward functions | 
| 436 | < | //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the | 
| 437 | < | //the other hand, has-a relation need composing. | 
| 438 | < | /** | 
| 439 | < | * Adds property into property map | 
| 440 | < | * @param genData GenericData to be added into PropertyMap | 
| 357 | < | */ | 
| 358 | < | void addProperty(GenericData* genData); | 
| 435 | > | bool getCalcBoxDipole() { | 
| 436 | > | return calcBoxDipole_; | 
| 437 | > | } | 
| 438 | > | bool getCalcBoxQuadrupole() { | 
| 439 | > | return calcBoxQuadrupole_; | 
| 440 | > | } | 
| 441 |  |  | 
| 442 | < | /** | 
| 443 | < | * Removes property from PropertyMap by name | 
| 444 | < | * @param propName the name of property to be removed | 
| 363 | < | */ | 
| 364 | < | void removeProperty(const std::string& propName); | 
| 442 | > | bool getUseAtomicVirial() { | 
| 443 | > | return useAtomicVirial_; | 
| 444 | > | } | 
| 445 |  |  | 
| 446 | < | /** | 
| 447 | < | * clear all of the properties | 
| 448 | < | */ | 
| 449 | < | void clearProperties(); | 
| 446 | > | /** | 
| 447 | > | * Adds property into property map | 
| 448 | > | * @param genData GenericData to be added into PropertyMap | 
| 449 | > | */ | 
| 450 | > | void addProperty(GenericData* genData); | 
| 451 |  |  | 
| 452 | < | /** | 
| 453 | < | * Returns all names of properties | 
| 454 | < | * @return all names of properties | 
| 455 | < | */ | 
| 456 | < | std::vector<std::string> getPropertyNames(); | 
| 452 | > | /** | 
| 453 | > | * Removes property from PropertyMap by name | 
| 454 | > | * @param propName the name of property to be removed | 
| 455 | > | */ | 
| 456 | > | void removeProperty(const string& propName); | 
| 457 |  |  | 
| 458 | < | /** | 
| 459 | < | * Returns all of the properties in PropertyMap | 
| 460 | < | * @return all of the properties in PropertyMap | 
| 461 | < | */ | 
| 381 | < | std::vector<GenericData*> getProperties(); | 
| 458 | > | /** | 
| 459 | > | * clear all of the properties | 
| 460 | > | */ | 
| 461 | > | void clearProperties(); | 
| 462 |  |  | 
| 463 | < | /** | 
| 464 | < | * Returns property | 
| 465 | < | * @param propName name of property | 
| 466 | < | * @return a pointer point to property with propName. If no property named propName | 
| 467 | < | * exists, return NULL | 
| 388 | < | */ | 
| 389 | < | GenericData* getPropertyByName(const std::string& propName); | 
| 463 | > | /** | 
| 464 | > | * Returns all names of properties | 
| 465 | > | * @return all names of properties | 
| 466 | > | */ | 
| 467 | > | vector<string> getPropertyNames(); | 
| 468 |  |  | 
| 469 | < | /** | 
| 470 | < | * add all exclude pairs of a molecule into exclude list. | 
| 471 | < | */ | 
| 472 | < | void addExcludePairs(Molecule* mol); | 
| 469 | > | /** | 
| 470 | > | * Returns all of the properties in PropertyMap | 
| 471 | > | * @return all of the properties in PropertyMap | 
| 472 | > | */ | 
| 473 | > | vector<GenericData*> getProperties(); | 
| 474 |  |  | 
| 475 | < | /** | 
| 476 | < | * remove all exclude pairs which belong to a molecule from exclude list | 
| 477 | < | */ | 
| 475 | > | /** | 
| 476 | > | * Returns property | 
| 477 | > | * @param propName name of property | 
| 478 | > | * @return a pointer point to property with propName. If no property named propName | 
| 479 | > | * exists, return NULL | 
| 480 | > | */ | 
| 481 | > | GenericData* getPropertyByName(const string& propName); | 
| 482 |  |  | 
| 483 | < | void removeExcludePairs(Molecule* mol); | 
| 483 | > | /** | 
| 484 | > | * add all special interaction pairs (including excluded | 
| 485 | > | * interactions) in a molecule into the appropriate lists. | 
| 486 | > | */ | 
| 487 | > | void addInteractionPairs(Molecule* mol); | 
| 488 |  |  | 
| 489 | + | /** | 
| 490 | + | * remove all special interaction pairs which belong to a molecule | 
| 491 | + | * from the appropriate lists. | 
| 492 | + | */ | 
| 493 | + | void removeInteractionPairs(Molecule* mol); | 
| 494 |  |  | 
| 495 | < | SelectionManager* getSelectionManager() { | 
| 496 | < | return selectMan_; | 
| 405 | < | } | 
| 495 | > | /** Returns the set of atom types present in this simulation */ | 
| 496 | > | set<AtomType*> getSimulatedAtomTypes(); | 
| 497 |  |  | 
| 498 | < | /** Returns the unique atom types of local processor in an array */ | 
| 499 | < | std::set<AtomType*> getUniqueAtomTypes(); | 
| 498 | > | /** Returns the global count of atoms of a particular type */ | 
| 499 | > | int getGlobalCountOfType(AtomType* atype); | 
| 500 |  |  | 
| 501 | < | friend std::ostream& operator <<(std::ostream& o, SimInfo& info); | 
| 501 | > | friend ostream& operator <<(ostream& o, SimInfo& info); | 
| 502 |  |  | 
| 503 | < | void getCutoff(double& rcut, double& rsw); | 
| 503 | > | void getCutoff(RealType& rcut, RealType& rsw); | 
| 504 |  |  | 
| 505 | < | private: | 
| 505 | > | private: | 
| 506 |  |  | 
| 507 | < | /** fill up the simtype struct*/ | 
| 508 | < | void setupSimType(); | 
| 507 | > | /** fill up the simtype struct and other simulation-related variables */ | 
| 508 | > | void setupSimVariables(); | 
| 509 |  |  | 
| 419 | – | /** | 
| 420 | – | * Setup Fortran Simulation | 
| 421 | – | * @see #setupFortranParallel | 
| 422 | – | */ | 
| 423 | – | void setupFortranSim(); | 
| 510 |  |  | 
| 511 | < | /** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ | 
| 512 | < | void setupCutoff(); | 
| 511 | > | /** Calculates the number of degress of freedom in the whole system */ | 
| 512 | > | void calcNdf(); | 
| 513 | > | void calcNdfRaw(); | 
| 514 | > | void calcNdfTrans(); | 
| 515 | > | void calcNConstraints(); | 
| 516 |  |  | 
| 517 | < | /** Calculates the number of degress of freedom in the whole system */ | 
| 518 | < | void calcNdf(); | 
| 519 | < | void calcNdfRaw(); | 
| 520 | < | void calcNdfTrans(); | 
| 517 | > | /** | 
| 518 | > | * Adds molecule stamp and the total number of the molecule with | 
| 519 | > | * same molecule stamp in the whole system. | 
| 520 | > | */ | 
| 521 | > | void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); | 
| 522 |  |  | 
| 523 | < | /** | 
| 524 | < | * Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole | 
| 525 | < | * system. | 
| 436 | < | */ | 
| 437 | < | void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); | 
| 523 | > | // Other classes holdingn important information | 
| 524 | > | ForceField* forceField_; /**< provides access to defined atom types, bond types, etc. */ | 
| 525 | > | Globals* simParams_;     /**< provides access to simulation parameters set by user */ | 
| 526 |  |  | 
| 527 | < | ForceField* forceField_; | 
| 528 | < | Globals* simParams_; | 
| 529 | < |  | 
| 530 | < | std::map<int, Molecule*>  molecules_; /**< Molecule array */ | 
| 527 | > | ///  Counts of local objects | 
| 528 | > | int nAtoms_;              /**< number of atoms in local processor */ | 
| 529 | > | int nBonds_;              /**< number of bonds in local processor */ | 
| 530 | > | int nBends_;              /**< number of bends in local processor */ | 
| 531 | > | int nTorsions_;           /**< number of torsions in local processor */ | 
| 532 | > | int nInversions_;         /**< number of inversions in local processor */ | 
| 533 | > | int nRigidBodies_;        /**< number of rigid bodies in local processor */ | 
| 534 | > | int nIntegrableObjects_;  /**< number of integrable objects in local processor */ | 
| 535 | > | int nCutoffGroups_;       /**< number of cutoff groups in local processor */ | 
| 536 | > | int nConstraints_;        /**< number of constraints in local processors */ | 
| 537 | > | int nFluctuatingCharges_; /**< number of fluctuating charges in local processor */ | 
| 538 |  |  | 
| 539 | < | //degress of freedom | 
| 540 | < | int ndf_;           /**< number of degress of freedom (excludes constraints),  ndf_ is local */ | 
| 541 | < | int ndfRaw_;    /**< number of degress of freedom (includes constraints),  ndfRaw_ is local */ | 
| 542 | < | int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ | 
| 543 | < | int nZconstraint_; /** number of  z-constraint molecules, nZconstraint_ is global */ | 
| 544 | < |  | 
| 545 | < | //number of global objects | 
| 546 | < | int nGlobalMols_;       /**< number of molecules in the system */ | 
| 547 | < | int nGlobalAtoms_;   /**< number of atoms in the system */ | 
| 548 | < | int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */ | 
| 549 | < | int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ | 
| 550 | < | int nGlobalRigidBodies_; /**< number of rigid bodies in this system */ | 
| 551 | < | /** | 
| 457 | < | * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the | 
| 458 | < | * corresponding content is the global index of cutoff group this atom belong to. | 
| 459 | < | * It is filled by SimCreator once and only once, since it never changed during the simulation. | 
| 460 | < | */ | 
| 461 | < | std::vector<int> globalGroupMembership_; | 
| 539 | > | /// Counts of global objects | 
| 540 | > | int nGlobalMols_;              /**< number of molecules in the system (GLOBAL) */ | 
| 541 | > | int nGlobalAtoms_;             /**< number of atoms in the system (GLOBAL) */ | 
| 542 | > | int nGlobalCutoffGroups_;      /**< number of cutoff groups in this system (GLOBAL) */ | 
| 543 | > | int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ | 
| 544 | > | int nGlobalRigidBodies_;       /**< number of rigid bodies in this system (GLOBAL) */ | 
| 545 | > | int nGlobalFluctuatingCharges_;/**< number of fluctuating charges in this system (GLOBAL) */ | 
| 546 | > | int nGlobalBonds_;              /**< number of bonds in the system */ | 
| 547 | > | int nGlobalBends_;              /**< number of bends in the system */ | 
| 548 | > | int nGlobalTorsions_;           /**< number of torsions in the system */ | 
| 549 | > | int nGlobalInversions_;         /**< number of inversions in the system */ | 
| 550 | > | int nGlobalConstraints_;        /**< number of constraints in the system */ | 
| 551 | > | bool hasNGlobalConstraints_; | 
| 552 |  |  | 
| 553 | < | /** | 
| 554 | < | * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the | 
| 555 | < | * corresponding content is the global index of molecule this atom belong to. | 
| 556 | < | * It is filled by SimCreator once and only once, since it is never changed during the simulation. | 
| 557 | < | */ | 
| 558 | < | std::vector<int> globalMolMembership_; | 
| 553 | > | /// Degress of freedom | 
| 554 | > | int ndf_;          /**< number of degress of freedom (excludes constraints) (LOCAL) */ | 
| 555 | > | int ndfLocal_;     /**< number of degrees of freedom (LOCAL, excludes constraints) */ | 
| 556 | > | int fdf_local;     /**< number of frozen degrees of freedom (LOCAL) */ | 
| 557 | > | int fdf_;          /**< number of frozen degrees of freedom (GLOBAL) */ | 
| 558 | > | int ndfRaw_;       /**< number of degress of freedom (includes constraints),  (LOCAL) */ | 
| 559 | > | int ndfTrans_;     /**< number of translation degress of freedom, (LOCAL) */ | 
| 560 | > | int nZconstraint_; /**< number of  z-constraint molecules (GLOBAL) */ | 
| 561 | > |  | 
| 562 | > | /// logicals | 
| 563 | > | bool usesPeriodicBoundaries_; /**< use periodic boundary conditions? */ | 
| 564 | > | bool usesDirectionalAtoms_;   /**< are there atoms with position AND orientation? */ | 
| 565 | > | bool usesMetallicAtoms_;      /**< are there transition metal atoms? */ | 
| 566 | > | bool usesElectrostaticAtoms_; /**< are there electrostatic atoms? */ | 
| 567 | > | bool usesFluctuatingCharges_; /**< are there fluctuating charges? */ | 
| 568 | > | bool usesAtomicVirial_;       /**< are we computing atomic virials? */ | 
| 569 | > | bool requiresPrepair_;        /**< does this simulation require a pre-pair loop? */ | 
| 570 | > | bool requiresSkipCorrection_; /**< does this simulation require a skip-correction? */ | 
| 571 | > | bool requiresSelfCorrection_; /**< does this simulation require a self-correction? */ | 
| 572 |  |  | 
| 573 | < |  | 
| 574 | < | std::vector<int> molStampIds_;                                /**< stamp id array of all molecules in the system */ | 
| 575 | < | std::vector<MoleculeStamp*> moleculeStamps_;      /**< molecule stamps array */ | 
| 576 | < |  | 
| 577 | < | //number of local objects | 
| 578 | < | int nAtoms_;                        /**< number of atoms in local processor */ | 
| 579 | < | int nBonds_;                        /**< number of bonds in local processor */ | 
| 580 | < | int nBends_;                        /**< number of bends in local processor */ | 
| 478 | < | int nTorsions_;                    /**< number of torsions in local processor */ | 
| 479 | < | int nRigidBodies_;              /**< number of rigid bodies in local processor */ | 
| 480 | < | int nIntegrableObjects_;    /**< number of integrable objects in local processor */ | 
| 481 | < | int nCutoffGroups_;             /**< number of cutoff groups in local processor */ | 
| 482 | < | int nConstraints_;              /**< number of constraints in local processors */ | 
| 573 | > | public: | 
| 574 | > | bool usesElectrostaticAtoms() { return usesElectrostaticAtoms_; } | 
| 575 | > | bool usesDirectionalAtoms() { return usesDirectionalAtoms_; } | 
| 576 | > | bool usesFluctuatingCharges() { return usesFluctuatingCharges_; } | 
| 577 | > | bool usesAtomicVirial() { return usesAtomicVirial_; } | 
| 578 | > | bool requiresPrepair() { return requiresPrepair_; } | 
| 579 | > | bool requiresSkipCorrection() { return requiresSkipCorrection_;} | 
| 580 | > | bool requiresSelfCorrection() { return requiresSelfCorrection_;} | 
| 581 |  |  | 
| 582 | < | simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/ | 
| 583 | < | Exclude exclude_; | 
| 584 | < | PropertyMap properties_;                  /**< Generic Property */ | 
| 487 | < | SnapshotManager* sman_;               /**< SnapshotManager */ | 
| 582 | > | private: | 
| 583 | > | /// Data structures holding primary simulation objects | 
| 584 | > | map<int, Molecule*>  molecules_;  /**< map holding pointers to LOCAL molecules */ | 
| 585 |  |  | 
| 586 | < | /** | 
| 587 | < | * The reason to have a local index manager is that when molecule is migrating to other processors, | 
| 588 | < | * the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the | 
| 589 | < | * information of molecule migrating to current processor, Migrator class can query  the LocalIndexManager | 
| 590 | < | * to make a efficient data moving plan. | 
| 591 | < | */ | 
| 592 | < | LocalIndexManager localIndexMan_; | 
| 586 | > | /// Stamps are templates for objects that are then used to create | 
| 587 | > | /// groups of objects.  For example, a molecule stamp contains | 
| 588 | > | /// information on how to build that molecule (i.e. the topology, | 
| 589 | > | /// the atoms, the bonds, etc.)  Once the system is built, the | 
| 590 | > | /// stamps are no longer useful. | 
| 591 | > | vector<int> molStampIds_;                /**< stamp id for molecules in the system */ | 
| 592 | > | vector<MoleculeStamp*> moleculeStamps_;  /**< molecule stamps array */ | 
| 593 |  |  | 
| 594 | < | //file names | 
| 595 | < | std::string finalConfigFileName_; | 
| 596 | < | std::string dumpFileName_; | 
| 597 | < | std::string statFileName_; | 
| 594 | > | /** | 
| 595 | > | * A vector that maps between the global index of an atom, and the | 
| 596 | > | * global index of cutoff group the atom belong to.  It is filled | 
| 597 | > | * by SimCreator once and only once, since it never changed during | 
| 598 | > | * the simulation.  It should be nGlobalAtoms_ in size. | 
| 599 | > | */ | 
| 600 | > | vector<int> globalGroupMembership_; | 
| 601 | > | public: | 
| 602 | > | vector<int> getGlobalGroupMembership() { return globalGroupMembership_; } | 
| 603 | > | private: | 
| 604 |  |  | 
| 605 | < | double rcut_;       /**< cutoff radius*/ | 
| 606 | < | double rsw_;        /**< radius of switching function*/ | 
| 605 | > | /** | 
| 606 | > | * A vector that maps between the global index of an atom and the | 
| 607 | > | * global index of the molecule the atom belongs to.  It is filled | 
| 608 | > | * by SimCreator once and only once, since it is never changed | 
| 609 | > | * during the simulation. It shoudl be nGlobalAtoms_ in size. | 
| 610 | > | */ | 
| 611 | > | vector<int> globalMolMembership_; | 
| 612 |  |  | 
| 613 | < | bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */ | 
| 613 | > | /** | 
| 614 | > | * A vector that maps between the local index of an atom and the | 
| 615 | > | * index of the AtomType. | 
| 616 | > | */ | 
| 617 | > | vector<int> identArray_; | 
| 618 | > | public: | 
| 619 | > | vector<int> getIdentArray() { return identArray_; } | 
| 620 |  |  | 
| 621 | < | SelectionManager* selectMan_; | 
| 622 | < | #ifdef IS_MPI | 
| 623 | < | //in Parallel version, we need MolToProc | 
| 624 | < | public: | 
| 625 | < |  | 
| 626 | < | /** | 
| 627 | < | * Finds the processor where a molecule resides | 
| 628 | < | * @return the id of the processor which contains the molecule | 
| 629 | < | * @param globalIndex global Index of the molecule | 
| 630 | < | */ | 
| 631 | < | int getMolToProc(int globalIndex) { | 
| 632 | < | //assert(globalIndex < molToProcMap_.size()); | 
| 633 | < | return molToProcMap_[globalIndex]; | 
| 634 | < | } | 
| 621 | > | /** | 
| 622 | > | * A vector that contains information about the local region of an | 
| 623 | > | * atom (used for fluctuating charges, etc.) | 
| 624 | > | */ | 
| 625 | > | private: | 
| 626 | > | vector<int> regions_; | 
| 627 | > | public: | 
| 628 | > | vector<int> getRegions() { return regions_; } | 
| 629 | > | private: | 
| 630 | > | /** | 
| 631 | > | * A vector which contains the fractional contribution of an | 
| 632 | > | * atom's mass to the total mass of the cutoffGroup that atom | 
| 633 | > | * belongs to.  In the case of single atom cutoff groups, the mass | 
| 634 | > | * factor for that atom is 1.  For massless atoms, the factor is | 
| 635 | > | * also 1. | 
| 636 | > | */ | 
| 637 | > | vector<RealType> massFactors_; | 
| 638 | > | public: | 
| 639 | > | vector<RealType> getMassFactors() { return massFactors_; } | 
| 640 |  |  | 
| 641 | < | /** | 
| 642 | < | * Set MolToProcMap array | 
| 643 | < | * @see #SimCreator::divideMolecules | 
| 644 | < | */ | 
| 526 | < | void setMolToProcMap(const std::vector<int>& molToProcMap) { | 
| 527 | < | molToProcMap_ = molToProcMap; | 
| 528 | < | } | 
| 529 | < |  | 
| 530 | < | private: | 
| 641 | > | PairList* getExcludedInteractions() { return &excludedInteractions_; } | 
| 642 | > | PairList* getOneTwoInteractions() { return &oneTwoInteractions_; } | 
| 643 | > | PairList* getOneThreeInteractions() { return &oneThreeInteractions_; } | 
| 644 | > | PairList* getOneFourInteractions() { return &oneFourInteractions_; } | 
| 645 |  |  | 
| 646 | < | void setupFortranParallel(); | 
| 647 | < |  | 
| 648 | < | /** | 
| 649 | < | * The size of molToProcMap_ is equal to total number of molecules in the system. | 
| 650 | < | *  It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only | 
| 651 | < | * once. | 
| 652 | < | */ | 
| 539 | < | std::vector<int> molToProcMap_; | 
| 646 | > | private: | 
| 647 | > |  | 
| 648 | > | /// lists to handle atoms needing special treatment in the non-bonded interactions | 
| 649 | > | PairList excludedInteractions_;  /**< atoms excluded from interacting with each other */ | 
| 650 | > | PairList oneTwoInteractions_;    /**< atoms that are directly Bonded */ | 
| 651 | > | PairList oneThreeInteractions_;  /**< atoms sharing a Bend */ | 
| 652 | > | PairList oneFourInteractions_;   /**< atoms sharing a Torsion */ | 
| 653 |  |  | 
| 654 | < | #endif | 
| 654 | > | PropertyMap properties_;       /**< Generic Properties can be added */ | 
| 655 | > | SnapshotManager* sman_;        /**< SnapshotManager (handles particle positions, etc.) */ | 
| 656 | > | int storageLayout_;            /**< Bits to tell how much data to store on each object */ | 
| 657 |  |  | 
| 658 | < | }; | 
| 658 | > | /** | 
| 659 | > | * The reason to have a local index manager is that when molecule | 
| 660 | > | * is migrating to other processors, the atoms and the | 
| 661 | > | * rigid-bodies will release their local indices to | 
| 662 | > | * LocalIndexManager. Combining the information of molecule | 
| 663 | > | * migrating to current processor, Migrator class can query the | 
| 664 | > | * LocalIndexManager to make a efficient data moving plan. | 
| 665 | > | */ | 
| 666 | > | LocalIndexManager localIndexMan_; | 
| 667 |  |  | 
| 668 | < | } //namespace oopse | 
| 668 | > | // unparsed MetaData block for storing in Dump and EOR files: | 
| 669 | > | string rawMetaData_; | 
| 670 | > |  | 
| 671 | > | // file names | 
| 672 | > | string finalConfigFileName_; | 
| 673 | > | string dumpFileName_; | 
| 674 | > | string statFileName_; | 
| 675 | > | string restFileName_; | 
| 676 | > |  | 
| 677 | > | bool topologyDone_;  /** flag to indicate whether the topology has | 
| 678 | > | been scanned and all the relevant | 
| 679 | > | bookkeeping has been done*/ | 
| 680 | > |  | 
| 681 | > | bool calcBoxDipole_; /**< flag to indicate whether or not we calculate | 
| 682 | > | the simulation box dipole moment */ | 
| 683 | > | bool calcBoxQuadrupole_; /**< flag to indicate whether or not we calculate | 
| 684 | > | the simulation box quadrupole moment */ | 
| 685 | > |  | 
| 686 | > | bool useAtomicVirial_; /**< flag to indicate whether or not we use | 
| 687 | > | Atomic Virials to calculate the pressure */ | 
| 688 | > |  | 
| 689 | > | public: | 
| 690 | > | /** | 
| 691 | > | * return an integral objects by its global index. In MPI | 
| 692 | > | * version, if the StuntDouble with specified global index does | 
| 693 | > | * not belong to local processor, a NULL will be return. | 
| 694 | > | */ | 
| 695 | > | StuntDouble* getIOIndexToIntegrableObject(int index); | 
| 696 | > | void setIOIndexToIntegrableObject(const vector<StuntDouble*>& v); | 
| 697 | > |  | 
| 698 | > | private: | 
| 699 | > | vector<StuntDouble*> IOIndexToIntegrableObject; | 
| 700 | > |  | 
| 701 | > | public: | 
| 702 | > |  | 
| 703 | > | /** | 
| 704 | > | * Finds the processor where a molecule resides | 
| 705 | > | * @return the id of the processor which contains the molecule | 
| 706 | > | * @param globalIndex global Index of the molecule | 
| 707 | > | */ | 
| 708 | > | int getMolToProc(int globalIndex) { | 
| 709 | > | //assert(globalIndex < molToProcMap_.size()); | 
| 710 | > | return molToProcMap_[globalIndex]; | 
| 711 | > | } | 
| 712 | > |  | 
| 713 | > | /** | 
| 714 | > | * Set MolToProcMap array | 
| 715 | > | */ | 
| 716 | > | void setMolToProcMap(const vector<int>& molToProcMap) { | 
| 717 | > | molToProcMap_ = molToProcMap; | 
| 718 | > | } | 
| 719 | > |  | 
| 720 | > | private: | 
| 721 | > |  | 
| 722 | > | /** | 
| 723 | > | * The size of molToProcMap_ is equal to total number of molecules | 
| 724 | > | * in the system.  It maps a molecule to the processor on which it | 
| 725 | > | * resides. it is filled by SimCreator once and only once. | 
| 726 | > | */ | 
| 727 | > | vector<int> molToProcMap_; | 
| 728 | > |  | 
| 729 | > | }; | 
| 730 | > |  | 
| 731 | > | } //namespace OpenMD | 
| 732 |  | #endif //BRAINS_SIMMODEL_HPP | 
| 733 |  |  |