--- trunk/src/brains/SimInfo.hpp 2005/11/11 15:22:11 726 +++ trunk/src/brains/SimInfo.hpp 2007/04/20 18:15:48 1129 @@ -73,15 +73,15 @@ 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, rigid bodies, cutoff groups, constrains). + * 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: @@ -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(); /** @@ -207,7 +207,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 +220,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 +272,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 +310,33 @@ namespace oopse{ return i != molecules_.end() ? i->second : NULL; } - /** Calculate the maximum cutoff radius based on the atom types */ - double calcMaxCutoffRadius(); - - 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_; } @@ -365,6 +384,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. @@ -422,7 +449,7 @@ namespace oopse{ friend std::ostream& operator <<(std::ostream& o, SimInfo& info); - void getCutoff(double& rcut, double& rsw); + void getCutoff(RealType& rcut, RealType& rsw); private: @@ -443,26 +470,30 @@ namespace oopse{ /** 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 */ @@ -514,17 +545,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*/ + 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_; + #ifdef IS_MPI //in Parallel version, we need MolToProc public: @@ -546,6 +610,8 @@ namespace oopse{ void setMolToProcMap(const std::vector& molToProcMap) { molToProcMap_ = molToProcMap; } + + private: