--- trunk/src/brains/SimInfo.hpp 2005/09/15 00:14:35 598 +++ trunk/src/brains/SimInfo.hpp 2008/09/12 20:51:22 1292 @@ -54,7 +54,7 @@ #include #include -#include "brains/Exclude.hpp" +#include "brains/PairList.hpp" #include "io/Globals.hpp" #include "math/Vector3.hpp" #include "math/SquareMatrix3.hpp" @@ -64,7 +64,7 @@ #include "utils/LocalIndexManager.hpp" //another nonsense macro declaration -#define __C +#define __OOPSE_C #include "brains/fSimulation.h" namespace oopse{ @@ -73,16 +73,16 @@ namespace oopse{ class SnapshotManager; class Molecule; class SelectionManager; + class StuntDouble; /** * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" - * @brief As one of the heavy weight class of OOPSE, SimInfo - * One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules. - * And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies, - * cutoff groups, constrains). - * Another major change is the index. No matter single version or parallel version, atoms and - * rigid bodies have both global index and local index. Local index is not important to molecule as well as - * cutoff group. - */ + * @brief One of the heavy weight classes of OOPSE, SimInfo maintains a list of molecules. + * The Molecule class maintains all of the concrete objects + * (atoms, bond, bend, torsions, inversions, rigid bodies, cutoff groups, + * constraints). In both the single and parallel versions, atoms and + * rigid bodies have both global and local indices. The local index is + * not relevant to molecules or cutoff groups. + */ class SimInfo { public: typedef std::map::iterator MoleculeIterator; @@ -95,7 +95,7 @@ namespace oopse{ * @param simParams * @note */ - SimInfo(MakeStamps* stamps, std::vector >& molStampPairs, ForceField* ff, Globals* simParams); + SimInfo(ForceField* ff, Globals* simParams); virtual ~SimInfo(); /** @@ -171,6 +171,10 @@ namespace oopse{ return nTorsions_; } + /** Returns the number of local torsions */ + unsigned int getNInversions() { + return nInversions_; + } /** Returns the number of local rigid bodies */ unsigned int getNRigidBodies() { return nRigidBodies_; @@ -207,7 +211,7 @@ namespace oopse{ /** Returns the number of degrees of freedom */ int getNdf() { - return ndf_; + return ndf_ - getFdf(); } /** Returns the number of raw degrees of freedom */ @@ -220,6 +224,13 @@ namespace oopse{ return ndfTrans_; } + /** sets the current number of frozen degrees of freedom */ + void setFdf(int fdf) { + fdf_local = fdf; + } + + int getFdf(); + //getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying /** Returns the total number of z-constraint molecules in the system */ @@ -265,6 +276,10 @@ namespace oopse{ /** Returns system angular momentum */ Vector3d getAngularMomentum(); + /** 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); /** main driver function to interact with fortran during the initialization and molecule migration */ void update(); @@ -299,25 +314,37 @@ namespace oopse{ return i != molecules_.end() ? i->second : NULL; } - /** Calculate the maximum cutoff radius based on the atom types */ - double calcMaxCutoffRadius(); + int getGlobalMolMembership(int id){ + return globalMolMembership_[id]; + } - double getRcut() { + RealType getRcut() { return rcut_; } - double getRsw() { + RealType getRsw() { return rsw_; + } + + RealType getList() { + return rlist_; } std::string getFinalConfigFileName() { return finalConfigFileName_; } - + void setFinalConfigFileName(const std::string& fileName) { finalConfigFileName_ = fileName; } + std::string getRawMetaData() { + return rawMetaData_; + } + void setRawMetaData(const std::string& rawMetaData) { + rawMetaData_ = rawMetaData; + } + std::string getDumpFileName() { return dumpFileName_; } @@ -347,7 +374,7 @@ namespace oopse{ * @see #SimCreator::setGlobalIndex */ void setGlobalGroupMembership(const std::vector& globalGroupMembership) { - assert(globalGroupMembership.size() == nGlobalAtoms_); + assert(globalGroupMembership.size() == static_cast(nGlobalAtoms_)); globalGroupMembership_ = globalGroupMembership; } @@ -356,7 +383,7 @@ namespace oopse{ * @see #SimCreator::setGlobalIndex */ void setGlobalMolMembership(const std::vector& globalMolMembership) { - assert(globalMolMembership.size() == nGlobalAtoms_); + assert(globalMolMembership.size() == static_cast(nGlobalAtoms_)); globalMolMembership_ = globalMolMembership; } @@ -365,6 +392,14 @@ namespace oopse{ return fortranInitialized_; } + bool getCalcBoxDipole() { + return calcBoxDipole_; + } + + bool getUseAtomicVirial() { + return useAtomicVirial_; + } + //below functions are just forward functions //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the //the other hand, has-a relation need composing. @@ -406,23 +441,24 @@ namespace oopse{ GenericData* getPropertyByName(const std::string& propName); /** - * add all exclude pairs of a molecule into exclude list. + * add all special interaction pairs (including excluded + * interactions) in a molecule into the appropriate lists. */ - void addExcludePairs(Molecule* mol); + void addInteractionPairs(Molecule* mol); /** - * remove all exclude pairs which belong to a molecule from exclude list + * remove all special interaction pairs which belong to a molecule + * from the appropriate lists. */ + void removeInteractionPairs(Molecule* mol); - void removeExcludePairs(Molecule* mol); - /** Returns the unique atom types of local processor in an array */ std::set getUniqueAtomTypes(); friend std::ostream& operator <<(std::ostream& o, SimInfo& info); - void getCutoff(double& rcut, double& rsw); + void getCutoff(RealType& rcut, RealType& rsw); private: @@ -439,27 +475,34 @@ namespace oopse{ void setupCutoff(); /** Figure out which coulombic correction method to use and pass to fortran */ - void setupCoulombicCorrection( int isError ); + void setupElectrostaticSummationMethod( int isError ); + + /** Figure out which polynomial type to use for the switching function */ + void setupSwitchingFunction(); + /** 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(); + ForceField* forceField_; + Globals* simParams_; + + std::map molecules_; /**< Molecule array */ + /** * Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole * system. */ void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); - - MakeStamps* stamps_; - ForceField* forceField_; - Globals* simParams_; - - std::map molecules_; /**< Molecule array */ //degress of freedom int ndf_; /**< number of degress of freedom (excludes constraints), ndf_ is local */ + int fdf_local; /**< number of frozen degrees of freedom */ + int fdf_; /**< number of frozen degrees of freedom */ int ndfRaw_; /**< number of degress of freedom (includes constraints), ndfRaw_ is local */ int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ int nZconstraint_; /** number of z-constraint molecules, nZconstraint_ is global */ @@ -489,17 +532,21 @@ namespace oopse{ std::vector moleculeStamps_; /**< molecule stamps array */ //number 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 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 */ + 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 */ simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/ - Exclude exclude_; + PairList excludedInteractions_; + PairList oneTwoInteractions_; + PairList oneThreeInteractions_; + PairList oneFourInteractions_; PropertyMap properties_; /**< Generic Property */ SnapshotManager* sman_; /**< SnapshotManager */ @@ -511,18 +558,50 @@ namespace oopse{ */ LocalIndexManager localIndexMan_; + // unparsed MetaData block for storing in Dump and EOR files: + std::string rawMetaData_; + //file names std::string finalConfigFileName_; std::string dumpFileName_; std::string statFileName_; std::string restFileName_; - double rcut_; /**< cutoff radius*/ - double rsw_; /**< radius of switching function*/ + RealType rcut_; /**< cutoff radius*/ + RealType rsw_; /**< radius of switching function*/ + RealType rlist_; /**< neighbor list radius */ - bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */ + bool ljsp_; /**< use shifted potential for LJ*/ + bool ljsf_; /**< use shifted force for LJ*/ -#ifdef IS_MPI + bool fortranInitialized_; /**< flag indicate whether fortran side + is initialized */ + + 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 std::vector& v); + private: + std::vector IOIndexToIntegrableObject; + //public: + //void setStuntDoubleFromGlobalIndex(std::vector v); + /** + * return a StuntDouble 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* getStuntDoubleFromGlobalIndex(int index); + //private: + //std::vector sdByGlobalIndex_; + //in Parallel version, we need MolToProc public: @@ -549,13 +628,12 @@ namespace oopse{ void setupFortranParallel(); /** - * 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. + * 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. */ std::vector molToProcMap_; -#endif };