| 1 | < | #ifndef __SIMINFO_H__ | 
| 2 | < | #define __SIMINFO_H__ | 
| 1 | > | /* | 
| 2 | > | * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. | 
| 3 | > | * | 
| 4 | > | * The University of Notre Dame grants you ("Licensee") a | 
| 5 | > | * non-exclusive, royalty free, license to use, modify and | 
| 6 | > | * redistribute this software in source and binary code form, provided | 
| 7 | > | * that the following conditions are met: | 
| 8 | > | * | 
| 9 | > | * 1. Redistributions of source code must retain the above copyright | 
| 10 | > | *    notice, this list of conditions and the following disclaimer. | 
| 11 | > | * | 
| 12 | > | * 2. Redistributions in binary form must reproduce the above copyright | 
| 13 | > | *    notice, this list of conditions and the following disclaimer in the | 
| 14 | > | *    documentation and/or other materials provided with the | 
| 15 | > | *    distribution. | 
| 16 | > | * | 
| 17 | > | * This software is provided "AS IS," without a warranty of any | 
| 18 | > | * kind. All express or implied conditions, representations and | 
| 19 | > | * warranties, including any implied warranty of merchantability, | 
| 20 | > | * fitness for a particular purpose or non-infringement, are hereby | 
| 21 | > | * excluded.  The University of Notre Dame and its licensors shall not | 
| 22 | > | * be liable for any damages suffered by licensee as a result of | 
| 23 | > | * using, modifying or distributing the software or its | 
| 24 | > | * derivatives. In no event will the University of Notre Dame or its | 
| 25 | > | * licensors be liable for any lost revenue, profit or data, or for | 
| 26 | > | * direct, indirect, special, consequential, incidental or punitive | 
| 27 | > | * damages, however caused and regardless of the theory of liability, | 
| 28 | > | * arising out of the use of or inability to use software, even if the | 
| 29 | > | * University of Notre Dame has been advised of the possibility of | 
| 30 | > | * such damages. | 
| 31 | > | * | 
| 32 | > | * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your | 
| 33 | > | * research, please cite the appropriate papers when you publish your | 
| 34 | > | * work.  Good starting points are: | 
| 35 | > | * | 
| 36 | > | * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). | 
| 37 | > | * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). | 
| 38 | > | * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 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 | > | /** | 
| 44 | > | * @file SimInfo.hpp | 
| 45 | > | * @author    tlin | 
| 46 | > | * @date  11/02/2004 | 
| 47 | > | * @version 1.0 | 
| 48 | > | */ | 
| 49 |  |  | 
| 50 | < | #include <map> | 
| 51 | < | #include <string> | 
| 50 | > | #ifndef BRAINS_SIMMODEL_HPP | 
| 51 | > | #define BRAINS_SIMMODEL_HPP | 
| 52 | > |  | 
| 53 | > | #include <iostream> | 
| 54 | > | #include <set> | 
| 55 | > | #include <utility> | 
| 56 |  | #include <vector> | 
| 57 |  |  | 
| 58 | < | #include "primitives/Atom.hpp" | 
| 59 | < | #include "primitives/RigidBody.hpp" | 
| 60 | < | #include "primitives/Molecule.hpp" | 
| 61 | < | #include "brains/Exclude.hpp" | 
| 62 | < | #include "brains/SkipList.hpp" | 
| 63 | < | #include "primitives/AbstractClasses.hpp" | 
| 64 | < | #include "types/MakeStamps.hpp" | 
| 65 | < | #include "brains/SimState.hpp" | 
| 66 | < | #include "restraints/Restraints.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 "brains/ForceField.hpp" | 
| 64 | > | #include "utils/PropertyMap.hpp" | 
| 65 | > | #include "utils/LocalIndexManager.hpp" | 
| 66 | > | #include "nonbonded/SwitchingFunction.hpp" | 
| 67 |  |  | 
| 68 | < | #define __C | 
| 69 | < | #include "brains/fSimulation.h" | 
| 70 | < | #include "UseTheForce/fortranWrapDefines.hpp" | 
| 71 | < | #include "utils/GenericData.hpp" | 
| 68 | > | using namespace std; | 
| 69 | > | namespace OpenMD{ | 
| 70 | > | //forward declaration | 
| 71 | > | class SnapshotManager; | 
| 72 | > | class Molecule; | 
| 73 | > | class SelectionManager; | 
| 74 | > | class StuntDouble; | 
| 75 |  |  | 
| 76 | + | /** | 
| 77 | + | * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" | 
| 78 | + | * | 
| 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 | < | //#include "Minimizer.hpp" | 
| 102 | < | //#include "minimizers/OOPSEMinimizer.hpp" | 
| 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 | + | * 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 | < | double roundMe( double x ); | 
| 120 | < | class OOPSEMinimizer; | 
| 121 | < | class SimInfo{ | 
| 119 | > | /** Returns the total number of molecules in the system. */ | 
| 120 | > | int getNGlobalMolecules() { | 
| 121 | > | return nGlobalMols_; | 
| 122 | > | } | 
| 123 |  |  | 
| 124 | < | public: | 
| 124 | > | /** Returns the total number of atoms in the system. */ | 
| 125 | > | int getNGlobalAtoms() { | 
| 126 | > | return nGlobalAtoms_; | 
| 127 | > | } | 
| 128 |  |  | 
| 129 | < | SimInfo(); | 
| 130 | < | ~SimInfo(); | 
| 129 | > | /** Returns the total number of cutoff groups in the system. */ | 
| 130 | > | int getNGlobalCutoffGroups() { | 
| 131 | > | return nGlobalCutoffGroups_; | 
| 132 | > | } | 
| 133 |  |  | 
| 134 | < | int n_atoms; // the number of atoms | 
| 135 | < | Atom **atoms; // the array of atom objects | 
| 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 | < | vector<RigidBody*> rigidBodies;  // A vector of rigid bodies | 
| 144 | < | vector<StuntDouble*> integrableObjects; | 
| 145 | < |  | 
| 146 | < | double tau[9]; // the stress tensor | 
| 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 | < | int n_bonds;    // number of bends | 
| 153 | < | int n_bends;    // number of bends | 
| 154 | < | int n_torsions; // number of torsions | 
| 155 | < | int n_oriented; // number of of atoms with orientation | 
| 49 | < | int ndf;        // number of actual degrees of freedom | 
| 50 | < | int ndfRaw;     // number of settable degrees of freedom | 
| 51 | < | int ndfTrans;   // number of translational degrees of freedom | 
| 52 | < | int nZconstraints; // the number of zConstraints | 
| 152 | > | /** Returns the number of global bonds */ | 
| 153 | > | unsigned int getNGlobalBonds(){ | 
| 154 | > | return nGlobalBonds_; | 
| 155 | > | } | 
| 156 |  |  | 
| 157 | < | int setTemp;   // boolean to set the temperature at each sampleTime | 
| 158 | < | int resetIntegrator; // boolean to reset the integrator | 
| 157 | > | /** Returns the number of global bends */ | 
| 158 | > | unsigned int getNGlobalBends() { | 
| 159 | > | return nGlobalBends_; | 
| 160 | > | } | 
| 161 |  |  | 
| 162 | < | int n_dipoles; // number of dipoles | 
| 162 | > | /** Returns the number of global torsions */ | 
| 163 | > | unsigned int getNGlobalTorsions() { | 
| 164 | > | return nGlobalTorsions_; | 
| 165 | > | } | 
| 166 |  |  | 
| 167 | < | int n_exclude; | 
| 168 | < | Exclude* excludes;  // the exclude list for ignoring pairs in fortran | 
| 169 | < | int nGlobalExcludes; | 
| 170 | < | int* globalExcludes; // same as above, but these guys participate in | 
| 63 | < | // no long range forces. | 
| 167 | > | /** Returns the number of global inversions */ | 
| 168 | > | unsigned int getNGlobalInversions() { | 
| 169 | > | return nGlobalInversions_; | 
| 170 | > | } | 
| 171 |  |  | 
| 172 | < | int* identArray;     // array of unique identifiers for the atoms | 
| 173 | < | int* molMembershipArray;  // map of atom numbers onto molecule numbers | 
| 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 | < | int n_constraints; // the number of constraints on the system | 
| 184 | > | /** Returns the number of local atoms */ | 
| 185 | > | unsigned int getNAtoms() { | 
| 186 | > | return nAtoms_; | 
| 187 | > | } | 
| 188 |  |  | 
| 189 | < | int n_SRI;   // the number of short range interactions | 
| 189 | > | /** Returns the number of effective cutoff groups on local processor */ | 
| 190 | > | unsigned int getNLocalCutoffGroups(); | 
| 191 |  |  | 
| 192 | < | double lrPot; // the potential energy from the long range calculations. | 
| 192 | > | /** Returns the number of local bonds */ | 
| 193 | > | unsigned int getNBonds(){ | 
| 194 | > | return nBonds_; | 
| 195 | > | } | 
| 196 |  |  | 
| 197 | < | double Hmat[3][3];  // the periodic boundry conditions. The Hmat is the | 
| 198 | < | // column vectors of the x, y, and z box vectors. | 
| 199 | < | //   h1  h2  h3 | 
| 200 | < | // [ Xx  Yx  Zx ] | 
| 78 | < | // [ Xy  Yy  Zy ] | 
| 79 | < | // [ Xz  Yz  Zz ] | 
| 80 | < | // | 
| 81 | < | double HmatInv[3][3]; | 
| 197 | > | /** Returns the number of local bends */ | 
| 198 | > | unsigned int getNBends() { | 
| 199 | > | return nBends_; | 
| 200 | > | } | 
| 201 |  |  | 
| 202 | < | double boxL[3]; // The Lengths of the 3 column vectors of Hmat | 
| 203 | < | double boxVol; | 
| 204 | < | int orthoRhombic; | 
| 205 | < |  | 
| 202 | > | /** Returns the number of local torsions */ | 
| 203 | > | unsigned int getNTorsions() { | 
| 204 | > | return nTorsions_; | 
| 205 | > | } | 
| 206 |  |  | 
| 207 | < | double dielectric;      // the dielectric of the medium for reaction field | 
| 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 | < | int usePBC; // whether we use periodic boundry conditions. | 
| 218 | < | int useLJ; | 
| 219 | < | int useSticky; | 
| 94 | < | int useCharges; | 
| 95 | < | int useDipoles; | 
| 96 | < | int useReactionField; | 
| 97 | < | int useGB; | 
| 98 | < | int useEAM; | 
| 99 | < | bool haveCutoffGroups; | 
| 100 | < | bool useInitXSstate; | 
| 101 | < | double orthoTolerance; | 
| 216 | > | /** Returns the number of local integrable objects */ | 
| 217 | > | unsigned int getNIntegrableObjects() { | 
| 218 | > | return nIntegrableObjects_; | 
| 219 | > | } | 
| 220 |  |  | 
| 221 | < | double dt, run_time;           // the time step and total time | 
| 222 | < | double sampleTime, statusTime; // the position and energy dump frequencies | 
| 223 | < | double target_temp;            // the target temperature of the system | 
| 224 | < | double thermalTime;            // the temp kick interval | 
| 107 | < | double currentTime;            // Used primarily for correlation Functions | 
| 108 | < | double resetTime;              // Use to reset the integrator periodically | 
| 109 | < | short int have_target_temp; | 
| 221 | > | /** Returns the number of local cutoff groups */ | 
| 222 | > | unsigned int getNCutoffGroups() { | 
| 223 | > | return nCutoffGroups_; | 
| 224 | > | } | 
| 225 |  |  | 
| 226 | < | int n_mol;           // n_molecules; | 
| 227 | < | Molecule* molecules; // the array of molecules | 
| 228 | < |  | 
| 229 | < | int nComponents;           // the number of components in the system | 
| 230 | < | int* componentsNmol;       // the number of molecules of each component | 
| 231 | < | MoleculeStamp** compStamps;// the stamps matching the components | 
| 232 | < | LinkedMolStamp* headStamp; // list of stamps used in the simulation | 
| 233 | < |  | 
| 234 | < |  | 
| 235 | < | char ensemble[100]; // the enesemble of the simulation (NVT, NVE, etc. ) | 
| 236 | < | char mixingRule[100]; // the mixing rules for Lennard jones/van der walls | 
| 122 | < | BaseIntegrator *the_integrator; // the integrator of the simulation | 
| 226 | > | /** Returns the total number of constraints in this SimInfo */ | 
| 227 | > | unsigned int getNConstraints() { | 
| 228 | > | return nConstraints_; | 
| 229 | > | } | 
| 230 | > |  | 
| 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 | < | OOPSEMinimizer* the_minimizer; // the energy minimizer | 
| 239 | < | Restraints* restraint; | 
| 240 | < | bool has_minimizer; | 
| 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 | < | string finalName;  // the name of the eor file to be written | 
| 246 | < | string sampleName; // the name of the dump file to be written | 
| 247 | < | string statusName; // the name of the stat file to be written | 
| 245 | > | /** Returns the total number of fluctuating charges that are present */ | 
| 246 | > | int getNFluctuatingCharges() { | 
| 247 | > | return nGlobalFluctuatingCharges_; | 
| 248 | > | } | 
| 249 |  |  | 
| 250 | < | int seed;                    //seed for random number generator | 
| 250 | > | /** Returns the number of degrees of freedom */ | 
| 251 | > | int getNdf() { | 
| 252 | > | return ndf_ - getFdf(); | 
| 253 | > | } | 
| 254 |  |  | 
| 255 | < | int useSolidThermInt;  // is solid-state thermodynamic integration being used | 
| 256 | < | int useLiquidThermInt; // is liquid thermodynamic integration being used | 
| 257 | < | double thermIntLambda; // lambda for TI | 
| 258 | < | double thermIntK;      // power of lambda for TI | 
| 138 | < | double vRaw;           // unperturbed potential for TI | 
| 139 | < | double vHarm;          // harmonic potential for TI | 
| 140 | < | int i;                 // just an int | 
| 255 | > | /** Returns the number of degrees of freedom (LOCAL) */ | 
| 256 | > | int getNdfLocal() { | 
| 257 | > | return ndfLocal_; | 
| 258 | > | } | 
| 259 |  |  | 
| 260 | < | vector<double> mfact; | 
| 261 | < | vector<int> FglobalGroupMembership; | 
| 262 | < | int ngroup; | 
| 263 | < | int* globalGroupMembership; | 
| 260 | > | /** Returns the number of raw degrees of freedom */ | 
| 261 | > | int getNdfRaw() { | 
| 262 | > | return ndfRaw_; | 
| 263 | > | } | 
| 264 |  |  | 
| 265 | < | // refreshes the sim if things get changed (load balanceing, volume | 
| 266 | < | // adjustment, etc.) | 
| 265 | > | /** Returns the number of translational degrees of freedom */ | 
| 266 | > | int getNdfTrans() { | 
| 267 | > | return ndfTrans_; | 
| 268 | > | } | 
| 269 |  |  | 
| 270 | < | void refreshSim( void ); | 
| 271 | < |  | 
| 270 | > | /** sets the current number of frozen degrees of freedom */ | 
| 271 | > | void setFdf(int fdf) { | 
| 272 | > | fdf_local = fdf; | 
| 273 | > | } | 
| 274 |  |  | 
| 275 | < | // sets the internal function pointer to fortran. | 
| 275 | > | int getFdf(); | 
| 276 | > |  | 
| 277 | > | //getNZconstraint and setNZconstraint ruin the coherence of | 
| 278 | > | //SimInfo class, need refactoring | 
| 279 | > |  | 
| 280 | > | /** Returns the total number of z-constraint molecules in the system */ | 
| 281 | > | int getNZconstraint() { | 
| 282 | > | return nZconstraint_; | 
| 283 | > | } | 
| 284 |  |  | 
| 285 | < | void setInternal( setFortranSim_TD fSetup, | 
| 286 | < | setFortranBox_TD fBox, | 
| 287 | < | notifyFortranCutOff_TD fCut){ | 
| 288 | < | setFsimulation = fSetup; | 
| 289 | < | setFortranBoxSize = fBox; | 
| 290 | < | notifyFortranCutOffs = fCut; | 
| 291 | < | } | 
| 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 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 | < | int getNDF(); | 
| 314 | < | int getNDFraw(); | 
| 315 | < | int getNDFtranslational(); | 
| 166 | < | int getTotIntegrableObjects(); | 
| 167 | < | void setBox( double newBox[3] ); | 
| 168 | < | void setBoxM( double newBox[3][3] ); | 
| 169 | < | void getBoxM( double theBox[3][3] ); | 
| 170 | < | void scaleBox( double scale ); | 
| 171 | < |  | 
| 172 | < | void setDefaultRcut( double theRcut ); | 
| 173 | < | void setDefaultRcut( double theRcut, double theRsw ); | 
| 174 | < | void checkCutOffs( void ); | 
| 313 | > | Globals* getSimParams() { | 
| 314 | > | return simParams_; | 
| 315 | > | } | 
| 316 |  |  | 
| 317 | < | double getRcut( void )  { return rCut; } | 
| 318 | < | double getRlist( void ) { return rList; } | 
| 319 | < | double getRsw( void )   { return rSw; } | 
| 320 | < | double getMaxCutoff( void ) { return maxCutoff; } | 
| 321 | < |  | 
| 181 | < | void setTime( double theTime ) { currentTime = theTime; } | 
| 182 | < | void incrTime( double the_dt ) { currentTime += the_dt; } | 
| 183 | < | void decrTime( double the_dt ) { currentTime -= the_dt; } | 
| 184 | < | double getTime( void ) { return currentTime; } | 
| 317 | > | void update(); | 
| 318 | > | /** | 
| 319 | > | * Do final bookkeeping before Force managers need their data. | 
| 320 | > | */ | 
| 321 | > | void prepareTopology(); | 
| 322 |  |  | 
| 186 | – | void wrapVector( double thePos[3] ); | 
| 323 |  |  | 
| 324 | < | SimState* getConfiguration( void ) { return myConfiguration; } | 
| 325 | < |  | 
| 326 | < | void addProperty(GenericData* prop); | 
| 327 | < | GenericData* getProperty(const string& propName); | 
| 192 | < | //vector<GenericData*>& getProperties()  {return properties;} | 
| 193 | < |  | 
| 194 | < | int getSeed(void) {  return seed; } | 
| 195 | < | void setSeed(int theSeed) {  seed = theSeed;} | 
| 196 | < |  | 
| 197 | < | private: | 
| 324 | > | /** Returns the local index manager */ | 
| 325 | > | LocalIndexManager* getLocalIndexManager() { | 
| 326 | > | return &localIndexMan_; | 
| 327 | > | } | 
| 328 |  |  | 
| 329 | < | SimState* myConfiguration; | 
| 329 | > | int getMoleculeStampId(int globalIndex) { | 
| 330 | > | //assert(globalIndex < molStampIds_.size()) | 
| 331 | > | return molStampIds_[globalIndex]; | 
| 332 | > | } | 
| 333 |  |  | 
| 334 | < | int boxIsInit, haveRcut, haveRsw; | 
| 334 | > | /** Returns the molecule stamp */ | 
| 335 | > | MoleculeStamp* getMoleculeStamp(int id) { | 
| 336 | > | return moleculeStamps_[id]; | 
| 337 | > | } | 
| 338 |  |  | 
| 339 | < | double rList, rCut; // variables for the neighborlist | 
| 340 | < | double rSw;         // the switching radius | 
| 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 | < | double maxCutoff; | 
| 352 | > | return i != molecules_.end() ? i->second : NULL; | 
| 353 | > | } | 
| 354 |  |  | 
| 355 | < | double distXY; | 
| 356 | < | double distYZ; | 
| 357 | < | double distZX; | 
| 211 | < |  | 
| 212 | < | void calcHmatInv( void ); | 
| 213 | < | void calcBoxL(); | 
| 214 | < | double calcMaxCutOff(); | 
| 355 | > | int getGlobalMolMembership(int id){ | 
| 356 | > | return globalMolMembership_[id]; | 
| 357 | > | } | 
| 358 |  |  | 
| 359 | < | // private function to initialize the fortran side of the simulation | 
| 360 | < | setFortranSim_TD setFsimulation; | 
| 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 | < | setFortranBox_TD setFortranBoxSize; | 
| 367 | < |  | 
| 368 | < | notifyFortranCutOff_TD notifyFortranCutOffs; | 
| 369 | < |  | 
| 370 | < | //Addtional Properties of SimInfo | 
| 371 | < | map<string, GenericData*> properties; | 
| 225 | < | void getFortranGroupArrays(SimInfo* info, | 
| 226 | < | vector<int>& FglobalGroupMembership, | 
| 227 | < | vector<double>& mfact); | 
| 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 |  |  | 
| 373 | + |  | 
| 374 | + | string getFinalConfigFileName() { | 
| 375 | + | return finalConfigFileName_; | 
| 376 | + | } | 
| 377 |  |  | 
| 378 | < | }; | 
| 378 | > | void setFinalConfigFileName(const string& fileName) { | 
| 379 | > | finalConfigFileName_ = fileName; | 
| 380 | > | } | 
| 381 |  |  | 
| 382 | + | string getRawMetaData() { | 
| 383 | + | return rawMetaData_; | 
| 384 | + | } | 
| 385 | + | void setRawMetaData(const string& rawMetaData) { | 
| 386 | + | rawMetaData_ = rawMetaData; | 
| 387 | + | } | 
| 388 | + |  | 
| 389 | + | string getDumpFileName() { | 
| 390 | + | return dumpFileName_; | 
| 391 | + | } | 
| 392 | + |  | 
| 393 | + | void setDumpFileName(const string& fileName) { | 
| 394 | + | dumpFileName_ = fileName; | 
| 395 | + | } | 
| 396 |  |  | 
| 397 | < | #endif | 
| 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 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 | > |  | 
| 431 | > | bool isTopologyDone() { | 
| 432 | > | return topologyDone_; | 
| 433 | > | } | 
| 434 | > |  | 
| 435 | > | bool getCalcBoxDipole() { | 
| 436 | > | return calcBoxDipole_; | 
| 437 | > | } | 
| 438 | > | bool getCalcBoxQuadrupole() { | 
| 439 | > | return calcBoxQuadrupole_; | 
| 440 | > | } | 
| 441 | > |  | 
| 442 | > | bool getUseAtomicVirial() { | 
| 443 | > | return useAtomicVirial_; | 
| 444 | > | } | 
| 445 | > |  | 
| 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 | > | * 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 | > | * clear all of the properties | 
| 460 | > | */ | 
| 461 | > | void clearProperties(); | 
| 462 | > |  | 
| 463 | > | /** | 
| 464 | > | * Returns all names of properties | 
| 465 | > | * @return all names of properties | 
| 466 | > | */ | 
| 467 | > | vector<string> getPropertyNames(); | 
| 468 | > |  | 
| 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 | > | * 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 | > | /** | 
| 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 | > | /** Returns the set of atom types present in this simulation */ | 
| 496 | > | set<AtomType*> getSimulatedAtomTypes(); | 
| 497 | > |  | 
| 498 | > | /** Returns the global count of atoms of a particular type */ | 
| 499 | > | int getGlobalCountOfType(AtomType* atype); | 
| 500 | > |  | 
| 501 | > | friend ostream& operator <<(ostream& o, SimInfo& info); | 
| 502 | > |  | 
| 503 | > | void getCutoff(RealType& rcut, RealType& rsw); | 
| 504 | > |  | 
| 505 | > | private: | 
| 506 | > |  | 
| 507 | > | /** fill up the simtype struct and other simulation-related variables */ | 
| 508 | > | void setupSimVariables(); | 
| 509 | > |  | 
| 510 | > |  | 
| 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 | > | /** | 
| 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 | > | // 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 | > | ///  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 | > | /// 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 | > | /// 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 | > | 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 | > | private: | 
| 583 | > | /// Data structures holding primary simulation objects | 
| 584 | > | map<int, Molecule*>  molecules_;  /**< map holding pointers to LOCAL molecules */ | 
| 585 | > |  | 
| 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 | > | /** | 
| 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 | > | /** | 
| 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 | > | /** | 
| 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 | > | /** | 
| 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 | > | PairList* getExcludedInteractions() { return &excludedInteractions_; } | 
| 642 | > | PairList* getOneTwoInteractions() { return &oneTwoInteractions_; } | 
| 643 | > | PairList* getOneThreeInteractions() { return &oneThreeInteractions_; } | 
| 644 | > | PairList* getOneFourInteractions() { return &oneFourInteractions_; } | 
| 645 | > |  | 
| 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 | > | 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 | > | /** | 
| 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 | > | // 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 | > |  |