--- trunk/src/brains/SimInfo.hpp 2004/09/24 16:27:58 3 +++ branches/development/src/brains/SimInfo.hpp 2011/05/26 13:55:04 1569 @@ -1,233 +1,688 @@ -#ifndef __SIMINFO_H__ -#define __SIMINFO_H__ +/* + * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. + * + * The University of Notre Dame grants you ("Licensee") a + * non-exclusive, royalty free, license to use, modify and + * redistribute this software in source and binary code form, provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * This software is provided "AS IS," without a warranty of any + * kind. All express or implied conditions, representations and + * warranties, including any implied warranty of merchantability, + * fitness for a particular purpose or non-infringement, are hereby + * excluded. The University of Notre Dame and its licensors shall not + * be liable for any damages suffered by licensee as a result of + * using, modifying or distributing the software or its + * derivatives. In no event will the University of Notre Dame or its + * licensors be liable for any lost revenue, profit or data, or for + * direct, indirect, special, consequential, incidental or punitive + * damages, however caused and regardless of the theory of liability, + * arising out of the use of or inability to use software, even if the + * University of Notre Dame has been advised of the possibility of + * such damages. + * + * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your + * research, please cite the appropriate papers when you publish your + * work. Good starting points are: + * + * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). + * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). + * [4] Vardeman & Gezelter, in progress (2009). + */ + +/** + * @file SimInfo.hpp + * @author tlin + * @date 11/02/2004 + * @version 1.0 + */ -#include -#include +#ifndef BRAINS_SIMMODEL_HPP +#define BRAINS_SIMMODEL_HPP + +#include +#include +#include #include -#include "primitives/Atom.hpp" -#include "primitives/RigidBody.hpp" -#include "primitives/Molecule.hpp" -#include "brains/Exclude.hpp" -#include "brains/SkipList.hpp" -#include "primitives/AbstractClasses.hpp" -#include "types/MakeStamps.hpp" -#include "brains/SimState.hpp" -#include "restraints/Restraints.hpp" +#include "brains/PairList.hpp" +#include "io/Globals.hpp" +#include "math/Vector3.hpp" +#include "math/SquareMatrix3.hpp" +#include "types/MoleculeStamp.hpp" +#include "UseTheForce/ForceField.hpp" +#include "utils/PropertyMap.hpp" +#include "utils/LocalIndexManager.hpp" +#include "nonbonded/SwitchingFunction.hpp" -#define __C -#include "brains/fSimulation.h" -#include "UseTheForce/fortranWrapDefines.hpp" -#include "utils/GenericData.hpp" +using namespace std; +namespace OpenMD{ + //forward declaration + class SnapshotManager; + class Molecule; + class SelectionManager; + class StuntDouble; + /** + * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" + * + * @brief One of the heavy-weight classes of OpenMD, SimInfo + * maintains objects and variables relating to the current + * simulation. This includes the master list of Molecules. The + * Molecule class maintains all of the concrete objects (Atoms, + * Bond, Bend, Torsions, Inversions, RigidBodies, CutoffGroups, + * Constraints). In both the single and parallel versions, Atoms and + * RigidBodies have both global and local indices. + */ + class SimInfo { + public: + typedef map::iterator MoleculeIterator; + + /** + * Constructor of SimInfo + * + * @param molStampPairs MoleculeStamp Array. The first element of + * the pair is molecule stamp, the second element is the total + * number of molecules with the same molecule stamp in the system + * + * @param ff pointer of a concrete ForceField instance + * + * @param simParams + */ + SimInfo(ForceField* ff, Globals* simParams); + virtual ~SimInfo(); -//#include "Minimizer.hpp" -//#include "minimizers/OOPSEMinimizer.hpp" + /** + * Adds a molecule + * + * @return return true if adding successfully, return false if the + * molecule is already in SimInfo + * + * @param mol molecule to be added + */ + bool addMolecule(Molecule* mol); + /** + * Removes a molecule from SimInfo + * + * @return true if removing successfully, return false if molecule + * is not in this SimInfo + */ + bool removeMolecule(Molecule* mol); -double roundMe( double x ); -class OOPSEMinimizer; -class SimInfo{ + /** Returns the total number of molecules in the system. */ + int getNGlobalMolecules() { + return nGlobalMols_; + } -public: + /** Returns the total number of atoms in the system. */ + int getNGlobalAtoms() { + return nGlobalAtoms_; + } - SimInfo(); - ~SimInfo(); + /** Returns the total number of cutoff groups in the system. */ + int getNGlobalCutoffGroups() { + return nGlobalCutoffGroups_; + } - int n_atoms; // the number of atoms - Atom **atoms; // the array of atom objects + /** + * Returns the total number of integrable objects (total number of + * rigid bodies plus the total number of atoms which do not belong + * to the rigid bodies) in the system + */ + int getNGlobalIntegrableObjects() { + return nGlobalIntegrableObjects_; + } - vector rigidBodies; // A vector of rigid bodies - vector integrableObjects; - - double tau[9]; // the stress tensor + /** + * Returns the total number of integrable objects (total number of + * rigid bodies plus the total number of atoms which do not belong + * to the rigid bodies) in the system + */ + int getNGlobalRigidBodies() { + return nGlobalRigidBodies_; + } - int n_bonds; // number of bends - int n_bends; // number of bends - int n_torsions; // number of torsions - int n_oriented; // number of of atoms with orientation - int ndf; // number of actual degrees of freedom - int ndfRaw; // number of settable degrees of freedom - int ndfTrans; // number of translational degrees of freedom - int nZconstraints; // the number of zConstraints + int getNGlobalConstraints(); + /** + * Returns the number of local molecules. + * @return the number of local molecules + */ + int getNMolecules() { + return molecules_.size(); + } - int setTemp; // boolean to set the temperature at each sampleTime - int resetIntegrator; // boolean to reset the integrator + /** Returns the number of local atoms */ + unsigned int getNAtoms() { + return nAtoms_; + } - int n_dipoles; // number of dipoles + /** Returns the number of local bonds */ + unsigned int getNBonds(){ + return nBonds_; + } - int n_exclude; - Exclude* excludes; // the exclude list for ignoring pairs in fortran - int nGlobalExcludes; - int* globalExcludes; // same as above, but these guys participate in - // no long range forces. + /** Returns the number of local bends */ + unsigned int getNBends() { + return nBends_; + } - int* identArray; // array of unique identifiers for the atoms - int* molMembershipArray; // map of atom numbers onto molecule numbers + /** Returns the number of local torsions */ + unsigned int getNTorsions() { + return nTorsions_; + } - int n_constraints; // the number of constraints on the system + /** Returns the number of local torsions */ + unsigned int getNInversions() { + return nInversions_; + } + /** Returns the number of local rigid bodies */ + unsigned int getNRigidBodies() { + return nRigidBodies_; + } - int n_SRI; // the number of short range interactions + /** Returns the number of local integrable objects */ + unsigned int getNIntegrableObjects() { + return nIntegrableObjects_; + } - double lrPot; // the potential energy from the long range calculations. + /** Returns the number of local cutoff groups */ + unsigned int getNCutoffGroups() { + return nCutoffGroups_; + } - double Hmat[3][3]; // the periodic boundry conditions. The Hmat is the - // column vectors of the x, y, and z box vectors. - // h1 h2 h3 - // [ Xx Yx Zx ] - // [ Xy Yy Zy ] - // [ Xz Yz Zz ] - // - double HmatInv[3][3]; + /** Returns the total number of constraints in this SimInfo */ + unsigned int getNConstraints() { + return nConstraints_; + } + + /** + * Returns the first molecule in this SimInfo and intialize the iterator. + * @return the first molecule, return NULL if there is not molecule in this SimInfo + * @param i the iterator of molecule array (user shouldn't change it) + */ + Molecule* beginMolecule(MoleculeIterator& i); - double boxL[3]; // The Lengths of the 3 column vectors of Hmat - double boxVol; - int orthoRhombic; - + /** + * Returns the next avaliable Molecule based on the iterator. + * @return the next avaliable molecule, return NULL if reaching the end of the array + * @param i the iterator of molecule array + */ + Molecule* nextMolecule(MoleculeIterator& i); - double dielectric; // the dielectric of the medium for reaction field + /** Returns the number of degrees of freedom */ + int getNdf() { + return ndf_ - getFdf(); + } - - int usePBC; // whether we use periodic boundry conditions. - int useLJ; - int useSticky; - int useCharges; - int useDipoles; - int useReactionField; - int useGB; - int useEAM; - bool haveCutoffGroups; - bool useInitXSstate; - double orthoTolerance; + /** Returns the number of raw degrees of freedom */ + int getNdfRaw() { + return ndfRaw_; + } - double dt, run_time; // the time step and total time - double sampleTime, statusTime; // the position and energy dump frequencies - double target_temp; // the target temperature of the system - double thermalTime; // the temp kick interval - double currentTime; // Used primarily for correlation Functions - double resetTime; // Use to reset the integrator periodically - short int have_target_temp; + /** Returns the number of translational degrees of freedom */ + int getNdfTrans() { + return ndfTrans_; + } - int n_mol; // n_molecules; - Molecule* molecules; // the array of molecules - - int nComponents; // the number of components in the system - int* componentsNmol; // the number of molecules of each component - MoleculeStamp** compStamps;// the stamps matching the components - LinkedMolStamp* headStamp; // list of stamps used in the simulation - - - char ensemble[100]; // the enesemble of the simulation (NVT, NVE, etc. ) - char mixingRule[100]; // the mixing rules for Lennard jones/van der walls - BaseIntegrator *the_integrator; // the integrator of the simulation + /** sets the current number of frozen degrees of freedom */ + void setFdf(int fdf) { + fdf_local = fdf; + } - OOPSEMinimizer* the_minimizer; // the energy minimizer - Restraints* restraint; - bool has_minimizer; + int getFdf(); + + //getNZconstraint and setNZconstraint ruin the coherence of + //SimInfo class, need refactoring + + /** Returns the total number of z-constraint molecules in the system */ + int getNZconstraint() { + return nZconstraint_; + } - string finalName; // the name of the eor file to be written - string sampleName; // the name of the dump file to be written - string statusName; // the name of the stat file to be written + /** + * Sets the number of z-constraint molecules in the system. + */ + void setNZconstraint(int nZconstraint) { + nZconstraint_ = nZconstraint; + } + + /** Returns the snapshot manager. */ + SnapshotManager* getSnapshotManager() { + return sman_; + } - int seed; //seed for random number generator + /** Sets the snapshot manager. */ + void setSnapshotManager(SnapshotManager* sman); + + /** Returns the force field */ + ForceField* getForceField() { + return forceField_; + } - int useSolidThermInt; // is solid-state thermodynamic integration being used - int useLiquidThermInt; // is liquid thermodynamic integration being used - double thermIntLambda; // lambda for TI - double thermIntK; // power of lambda for TI - double vRaw; // unperturbed potential for TI - double vHarm; // harmonic potential for TI - int i; // just an int + Globals* getSimParams() { + return simParams_; + } - vector mfact; - vector FglobalGroupMembership; - int ngroup; - int* globalGroupMembership; + /** Returns the velocity of center of mass of the whole system.*/ + Vector3d getComVel(); - // refreshes the sim if things get changed (load balanceing, volume - // adjustment, etc.) + /** Returns the center of the mass of the whole system.*/ + Vector3d getCom(); + /** Returns the center of the mass and Center of Mass velocity of + the whole system.*/ + void getComAll(Vector3d& com,Vector3d& comVel); - void refreshSim( void ); - + /** Returns intertia tensor for the entire system and system + Angular Momentum.*/ + void getInertiaTensor(Mat3x3d &intertiaTensor,Vector3d &angularMomentum); + + /** Returns system angular momentum */ + Vector3d getAngularMomentum(); - // sets the internal function pointer to fortran. + /** Returns volume of system as estimated by an ellipsoid defined + by the radii of gyration*/ + void getGyrationalVolume(RealType &vol); + /** Overloaded version of gyrational volume that also returns + det(I) so dV/dr can be calculated*/ + void getGyrationalVolume(RealType &vol, RealType &detI); - void setInternal( setFortranSim_TD fSetup, - setFortranBox_TD fBox, - notifyFortranCutOff_TD fCut){ - setFsimulation = fSetup; - setFortranBoxSize = fBox; - notifyFortranCutOffs = fCut; - } + void update(); + /** + * Do final bookkeeping before Force managers need their data. + */ + void prepareTopology(); - int getNDF(); - int getNDFraw(); - int getNDFtranslational(); - int getTotIntegrableObjects(); - void setBox( double newBox[3] ); - void setBoxM( double newBox[3][3] ); - void getBoxM( double theBox[3][3] ); - void scaleBox( double scale ); - - void setDefaultRcut( double theRcut ); - void setDefaultRcut( double theRcut, double theRsw ); - void checkCutOffs( void ); - double getRcut( void ) { return rCut; } - double getRlist( void ) { return rList; } - double getRsw( void ) { return rSw; } - double getMaxCutoff( void ) { return maxCutoff; } - - void setTime( double theTime ) { currentTime = theTime; } - void incrTime( double the_dt ) { currentTime += the_dt; } - void decrTime( double the_dt ) { currentTime -= the_dt; } - double getTime( void ) { return currentTime; } + /** Returns the local index manager */ + LocalIndexManager* getLocalIndexManager() { + return &localIndexMan_; + } - void wrapVector( double thePos[3] ); + int getMoleculeStampId(int globalIndex) { + //assert(globalIndex < molStampIds_.size()) + return molStampIds_[globalIndex]; + } - SimState* getConfiguration( void ) { return myConfiguration; } - - void addProperty(GenericData* prop); - GenericData* getProperty(const string& propName); - //vector& getProperties() {return properties;} + /** Returns the molecule stamp */ + MoleculeStamp* getMoleculeStamp(int id) { + return moleculeStamps_[id]; + } - int getSeed(void) { return seed; } - void setSeed(int theSeed) { seed = theSeed;} + /** Return the total number of the molecule stamps */ + int getNMoleculeStamp() { + return moleculeStamps_.size(); + } + /** + * Finds a molecule with a specified global index + * @return a pointer point to found molecule + * @param index + */ + Molecule* getMoleculeByGlobalIndex(int index) { + MoleculeIterator i; + i = molecules_.find(index); -private: + return i != molecules_.end() ? i->second : NULL; + } - SimState* myConfiguration; + int getGlobalMolMembership(int id){ + return globalMolMembership_[id]; + } - int boxIsInit, haveRcut, haveRsw; + /** + * returns a vector which maps the local atom index on this + * processor to the global atom index. With only one processor, + * these should be identical. + */ + vector getGlobalAtomIndices(); - double rList, rCut; // variables for the neighborlist - double rSw; // the switching radius + /** + * returns a vector which maps the local cutoff group index on + * this processor to the global cutoff group index. With only one + * processor, these should be identical. + */ + vector getGlobalGroupIndices(); - double maxCutoff; + + string getFinalConfigFileName() { + return finalConfigFileName_; + } - double distXY; - double distYZ; - double distZX; - - void calcHmatInv( void ); - void calcBoxL(); - double calcMaxCutOff(); + void setFinalConfigFileName(const string& fileName) { + finalConfigFileName_ = fileName; + } - // private function to initialize the fortran side of the simulation - setFortranSim_TD setFsimulation; + string getRawMetaData() { + return rawMetaData_; + } + void setRawMetaData(const string& rawMetaData) { + rawMetaData_ = rawMetaData; + } + + string getDumpFileName() { + return dumpFileName_; + } + + void setDumpFileName(const string& fileName) { + dumpFileName_ = fileName; + } - setFortranBox_TD setFortranBoxSize; - - notifyFortranCutOff_TD notifyFortranCutOffs; - - //Addtional Properties of SimInfo - map properties; - void getFortranGroupArrays(SimInfo* info, - vector& FglobalGroupMembership, - vector& mfact); + string getStatFileName() { + return statFileName_; + } + + void setStatFileName(const string& fileName) { + statFileName_ = fileName; + } + + string getRestFileName() { + return restFileName_; + } + + void setRestFileName(const string& fileName) { + restFileName_ = fileName; + } + /** + * Sets GlobalGroupMembership + * @see #SimCreator::setGlobalIndex + */ + void setGlobalGroupMembership(const vector& globalGroupMembership) { + assert(globalGroupMembership.size() == static_cast(nGlobalAtoms_)); + globalGroupMembership_ = globalGroupMembership; + } -}; + /** + * Sets GlobalMolMembership + * @see #SimCreator::setGlobalIndex + */ + void setGlobalMolMembership(const vector& globalMolMembership) { + assert(globalMolMembership.size() == static_cast(nGlobalAtoms_)); + globalMolMembership_ = globalMolMembership; + } -#endif + bool isTopologyDone() { + return topologyDone_; + } + + bool getCalcBoxDipole() { + return calcBoxDipole_; + } + + bool getUseAtomicVirial() { + return useAtomicVirial_; + } + + /** + * Adds property into property map + * @param genData GenericData to be added into PropertyMap + */ + void addProperty(GenericData* genData); + + /** + * Removes property from PropertyMap by name + * @param propName the name of property to be removed + */ + void removeProperty(const string& propName); + + /** + * clear all of the properties + */ + void clearProperties(); + + /** + * Returns all names of properties + * @return all names of properties + */ + vector getPropertyNames(); + + /** + * Returns all of the properties in PropertyMap + * @return all of the properties in PropertyMap + */ + vector getProperties(); + + /** + * Returns property + * @param propName name of property + * @return a pointer point to property with propName. If no property named propName + * exists, return NULL + */ + GenericData* getPropertyByName(const string& propName); + + /** + * add all special interaction pairs (including excluded + * interactions) in a molecule into the appropriate lists. + */ + void addInteractionPairs(Molecule* mol); + + /** + * remove all special interaction pairs which belong to a molecule + * from the appropriate lists. + */ + void removeInteractionPairs(Molecule* mol); + + /** Returns the set of atom types present in this simulation */ + set getSimulatedAtomTypes(); + + friend ostream& operator <<(ostream& o, SimInfo& info); + + void getCutoff(RealType& rcut, RealType& rsw); + + private: + + /** fill up the simtype struct and other simulation-related variables */ + void setupSimVariables(); + + + /** Determine if we need to accumulate the simulation box dipole */ + void setupAccumulateBoxDipole(); + + /** Calculates the number of degress of freedom in the whole system */ + void calcNdf(); + void calcNdfRaw(); + void calcNdfTrans(); + + /** + * Adds molecule stamp and the total number of the molecule with + * same molecule stamp in the whole system. + */ + void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); + + // Other classes holdingn important information + ForceField* forceField_; /**< provides access to defined atom types, bond types, etc. */ + Globals* simParams_; /**< provides access to simulation parameters set by user */ + + /// Counts of local objects + int nAtoms_; /**< number of atoms in local processor */ + int nBonds_; /**< number of bonds in local processor */ + int nBends_; /**< number of bends in local processor */ + int nTorsions_; /**< number of torsions in local processor */ + int nInversions_; /**< number of inversions in local processor */ + int nRigidBodies_; /**< number of rigid bodies in local processor */ + int nIntegrableObjects_; /**< number of integrable objects in local processor */ + int nCutoffGroups_; /**< number of cutoff groups in local processor */ + int nConstraints_; /**< number of constraints in local processors */ + + /// Counts of global objects + int nGlobalMols_; /**< number of molecules in the system (GLOBAL) */ + int nGlobalAtoms_; /**< number of atoms in the system (GLOBAL) */ + int nGlobalCutoffGroups_; /**< number of cutoff groups in this system (GLOBAL) */ + int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ + int nGlobalRigidBodies_; /**< number of rigid bodies in this system (GLOBAL) */ + + /// Degress of freedom + int ndf_; /**< number of degress of freedom (excludes constraints) (LOCAL) */ + int fdf_local; /**< number of frozen degrees of freedom (LOCAL) */ + int fdf_; /**< number of frozen degrees of freedom (GLOBAL) */ + int ndfRaw_; /**< number of degress of freedom (includes constraints), (LOCAL) */ + int ndfTrans_; /**< number of translation degress of freedom, (LOCAL) */ + int nZconstraint_; /**< number of z-constraint molecules (GLOBAL) */ + + /// logicals + bool usesPeriodicBoundaries_; /**< use periodic boundary conditions? */ + bool usesDirectionalAtoms_; /**< are there atoms with position AND orientation? */ + bool usesMetallicAtoms_; /**< are there transition metal atoms? */ + bool usesElectrostaticAtoms_; /**< are there electrostatic atoms? */ + bool usesAtomicVirial_; /**< are we computing atomic virials? */ + bool requiresPrepair_; /**< does this simulation require a pre-pair loop? */ + bool requiresSkipCorrection_; /**< does this simulation require a skip-correction? */ + bool requiresSelfCorrection_; /**< does this simulation require a self-correction? */ + + public: + bool usesElectrostaticAtoms() { return usesElectrostaticAtoms_; } + bool usesDirectionalAtoms() { return usesDirectionalAtoms_; } + bool usesMetallicAtoms() { return usesMetallicAtoms_; } + bool usesAtomicVirial() { return usesAtomicVirial_; } + bool requiresPrepair() { return requiresPrepair_; } + bool requiresSkipCorrection() { return requiresSkipCorrection_;} + bool requiresSelfCorrection() { return requiresSelfCorrection_;} + + private: + /// Data structures holding primary simulation objects + map molecules_; /**< map holding pointers to LOCAL molecules */ + + /// Stamps are templates for objects that are then used to create + /// groups of objects. For example, a molecule stamp contains + /// information on how to build that molecule (i.e. the topology, + /// the atoms, the bonds, etc.) Once the system is built, the + /// stamps are no longer useful. + vector molStampIds_; /**< stamp id for molecules in the system */ + vector moleculeStamps_; /**< molecule stamps array */ + + /** + * A vector that maps between the global index of an atom, and the + * global index of cutoff group the atom belong to. It is filled + * by SimCreator once and only once, since it never changed during + * the simulation. It should be nGlobalAtoms_ in size. + */ + vector globalGroupMembership_; + public: + vector getGlobalGroupMembership() { return globalGroupMembership_; } + private: + + /** + * A vector that maps between the global index of an atom and the + * global index of the molecule the atom belongs to. It is filled + * by SimCreator once and only once, since it is never changed + * during the simulation. It shoudl be nGlobalAtoms_ in size. + */ + vector globalMolMembership_; + + /** + * A vector that maps between the local index of an atom and the + * index of the AtomType. + */ + vector identArray_; + public: + vector getIdentArray() { return identArray_; } + private: + + /** + * A vector which contains the fractional contribution of an + * atom's mass to the total mass of the cutoffGroup that atom + * belongs to. In the case of single atom cutoff groups, the mass + * factor for that atom is 1. For massless atoms, the factor is + * also 1. + */ + vector massFactors_; + public: + vector getMassFactors() { return massFactors_; } + private: + + + /// lists to handle atoms needing special treatment in the non-bonded interactions + PairList excludedInteractions_; /**< atoms excluded from interacting with each other */ + PairList oneTwoInteractions_; /**< atoms that are directly Bonded */ + PairList oneThreeInteractions_; /**< atoms sharing a Bend */ + PairList oneFourInteractions_; /**< atoms sharing a Torsion */ + + PropertyMap properties_; /**< Generic Properties can be added */ + SnapshotManager* sman_; /**< SnapshotManager (handles particle positions, etc.) */ + + /** + * The reason to have a local index manager is that when molecule + * is migrating to other processors, the atoms and the + * rigid-bodies will release their local indices to + * LocalIndexManager. Combining the information of molecule + * migrating to current processor, Migrator class can query the + * LocalIndexManager to make a efficient data moving plan. + */ + LocalIndexManager localIndexMan_; + + // unparsed MetaData block for storing in Dump and EOR files: + string rawMetaData_; + + // file names + string finalConfigFileName_; + string dumpFileName_; + string statFileName_; + string restFileName_; + + + bool topologyDone_; /** flag to indicate whether the topology has + been scanned and all the relevant + bookkeeping has been done*/ + + bool calcBoxDipole_; /**< flag to indicate whether or not we calculate + the simulation box dipole moment */ + + bool useAtomicVirial_; /**< flag to indicate whether or not we use + Atomic Virials to calculate the pressure */ + + public: + /** + * return an integral objects by its global index. In MPI + * version, if the StuntDouble with specified global index does + * not belong to local processor, a NULL will be return. + */ + StuntDouble* getIOIndexToIntegrableObject(int index); + void setIOIndexToIntegrableObject(const vector& v); + + private: + vector IOIndexToIntegrableObject; + + public: + + /** + * Finds the processor where a molecule resides + * @return the id of the processor which contains the molecule + * @param globalIndex global Index of the molecule + */ + int getMolToProc(int globalIndex) { + //assert(globalIndex < molToProcMap_.size()); + return molToProcMap_[globalIndex]; + } + + /** + * Set MolToProcMap array + * @see #SimCreator::divideMolecules + */ + void setMolToProcMap(const vector& molToProcMap) { + molToProcMap_ = molToProcMap; + } + + private: + + /** + * The size of molToProcMap_ is equal to total number of molecules + * in the system. It maps a molecule to the processor on which it + * resides. it is filled by SimCreator once and only once. + */ + vector molToProcMap_; + + }; + +} //namespace OpenMD +#endif //BRAINS_SIMMODEL_HPP +