--- branches/new_design/OOPSE-3.0/src/brains/SimInfo.hpp 2004/11/04 16:22:03 1709 +++ branches/new_design/OOPSE-3.0/src/brains/SimInfo.hpp 2004/11/04 19:48:22 1710 @@ -1,223 +1,183 @@ -#ifndef __SIMINFO_H__ -#define __SIMINFO_H__ +/* + * Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project + * + * Contact: oopse@oopse.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * All we ask is that proper credit is given for our work, which includes + * - but is not limited to - adding the above copyright notice to the beginning + * of your source code files, and to any copyright notice that you may distribute + * with programs based on this work. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ -#include -#include +/** + * @file SimInfo.hpp + * @author tlin + * @date 11/02/2004 + * @version 1.0 + */ + +#ifndef BRAINS_SIMMODEL_HPP +#define BRAINS_SIMMODEL_HPP #include +#include -#include "primitives/Atom.hpp" -#include "primitives/RigidBody.hpp" +#include "brains/fSimulation.h" #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 "utils/PropertyMap.hpp" -#define __C -#include "brains/fSimulation.h" -#include "utils/GenericData.hpp" +namespace oopse{ +/** + * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" + * @brief + */ +class SimInfo { + public: + SimInfo(); + 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 number of molecules. + * @return the number of molecules in this SimInfo + */ + int getNMolecules() { + return molecules_.size(); + } -public: + /** Returns the total number of atoms in this SimInfo */ + unsigned int getNAtoms() { + return nAtoms_; + } - SimInfo(); - ~SimInfo(); + /** Returns the total number of bonds in this SimInfo */ + unsigned int getNBonds(){ + return nBonds_; + } - int n_atoms; // the number of atoms - Atom **atoms; // the array of atom objects + /** Returns the total number of bends in this SimInfo */ + unsigned int getNBends() { + return nBends_; + } - vector rigidBodies; // A vector of rigid bodies - vector integrableObjects; - - double tau[9]; // the stress tensor + /** Returns the total number of torsions in this SimInfo */ + unsigned int getNTorsions() { + return nTorsions_; + } - 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 + /** Returns the total number of rigid bodies in this SimInfo */ + unsigned int getNRigidBodies() { + return nRigidBodies_; + } - int setTemp; // boolean to set the temperature at each sampleTime - int resetIntegrator; // boolean to reset the integrator + /** Returns the total number of integrable objects in this SimInfo */ + unsigned int getNIntegrableObjects() { + return nIntegrableObjects_; + } - int n_dipoles; // number of dipoles + /** Returns the total number of cutoff groups in this SimInfo */ + unsigned int getNCutoffGroups() { + return nCutoffGroups_; + } - 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 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(std::vector::iterator& i); - int* identArray; // array of unique identifiers for the atoms - int* molMembershipArray; // map of atom numbers onto molecule numbers + /** + * 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(std::vector::iterator& i); - int n_constraints; // the number of constraints on the system + /** Returns the number of degrees of freedom */ + int getNDF() { + return ndf_; + } - int n_SRI; // the number of short range interactions + /** Returns the number of raw degrees of freedom */ + int getNDFRaw() { + return ndfRaw_; + } - double lrPot; // the potential energy from the long range calculations. + /** Returns the number of translational degrees of freedom */ + int getNDFTrans() { + return ndfTrans_; + } - 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 snapshot manager. */ + SnapshotManager* getSnapshotManager() { + return sman_; + } - double boxL[3]; // The Lengths of the 3 column vectors of Hmat - double boxVol; - int orthoRhombic; - + /** Sets the snapshot manager. */ + void setSnapshotManager(SnapshotManager* sman) { + sman_ = sman; + } + + private: - double dielectric; // the dielectric of the medium for reaction field + void calcNDF(); + void calcNDFRaw(); + void calcNDFTrans(); - - int usePBC; // whether we use periodic boundry conditions. - int useDirectionalAtoms; - int useLennardJones; - int useElectrostatics; - int useCharges; - int useDipoles; - int useSticky; - int useGayBerne; - int useEAM; - int useShapes; - int useFLARB; - int useReactionField; - bool haveCutoffGroups; - bool useInitXSstate; - double orthoTolerance; + int ndf_; + int ndfRaw_; + int ndfTrans_; + + int nAtoms_; + int nBonds_; + int nBends_; + int nTorsions_; + int nRigidBodies_; + int nIntegrableObjects_; + int nCutoffGroups_; + int nConstraints_; - 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; + simtype fInfo; + Exclude excludeList; + + + std::vector molecules_; /**< Molecule array */ + PropertyMap properties_; /** Generic Property */ + SnapshotManager* sman_; /** SnapshotManager */ - 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 - - OOPSEMinimizer* the_minimizer; // the energy minimizer - Restraints* restraint; - bool has_minimizer; - - 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 - - int seed; //seed for random number generator - - 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 - - vector mfact; - vector FglobalGroupMembership; - int ngroup; - int* globalGroupMembership; - - // refreshes the sim if things get changed (load balanceing, volume - // adjustment, etc.) - - void refreshSim( void ); - - - // sets the internal function pointer to fortran. - - - 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; } - - void wrapVector( double thePos[3] ); - - SimState* getConfiguration( void ) { return myConfiguration; } - - void addProperty(GenericData* prop); - GenericData* getPropertyByName(const string& propName); - //vector& getProperties() {return properties;} - - int getSeed(void) { return seed; } - void setSeed(int theSeed) { seed = theSeed;} - -private: - - SimState* myConfiguration; - - int boxIsInit, haveRcut, haveRsw; - - double rList, rCut; // variables for the neighborlist - double rSw; // the switching radius - - double maxCutoff; - - double distXY; - double distYZ; - double distZX; - - void calcHmatInv( void ); - void calcBoxL(); - double calcMaxCutOff(); - - - //Addtional Properties of SimInfo - map properties; - void getFortranGroupArrays(SimInfo* info, - vector& FglobalGroupMembership, - vector& mfact); - - }; - -#endif +} //namespace oopse +#endif //BRAINS_SIMMODEL_HPP