ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/brains/SimInfo.hpp
(Generate patch)

Comparing branches/new_design/OOPSE-3.0/src/brains/SimInfo.hpp (file contents):
Revision 1701 by tim, Wed Nov 3 16:08:43 2004 UTC vs.
Revision 1722 by tim, Tue Nov 9 23:11:39 2004 UTC

# Line 1 | Line 1
1 < #ifndef __SIMINFO_H__
2 < #define __SIMINFO_H__
1 > /*
2 > * Copyright (C) 2000-2004  Object Oriented Parallel Simulation Engine (OOPSE) project
3 > *
4 > * Contact: oopse@oopse.org
5 > *
6 > * This program is free software; you can redistribute it and/or
7 > * modify it under the terms of the GNU Lesser General Public License
8 > * as published by the Free Software Foundation; either version 2.1
9 > * of the License, or (at your option) any later version.
10 > * All we ask is that proper credit is given for our work, which includes
11 > * - but is not limited to - adding the above copyright notice to the beginning
12 > * of your source code files, and to any copyright notice that you may distribute
13 > * with programs based on this work.
14 > *
15 > * This program is distributed in the hope that it will be useful,
16 > * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 > * GNU Lesser General Public License for more details.
19 > *
20 > * You should have received a copy of the GNU Lesser General Public License
21 > * along with this program; if not, write to the Free Software
22 > * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23 > *
24 > */
25  
26 < #include <map>
27 < #include <string>
26 > /**
27 > * @file SimInfo.hpp
28 > * @author    tlin
29 > * @date  11/02/2004
30 > * @version 1.0
31 > */
32 >
33 > #ifndef BRAINS_SIMMODEL_HPP
34 > #define BRAINS_SIMMODEL_HPP
35 >
36 > #include <iostream>
37   #include <vector>
38 + #include <utility>
39  
40 < #include "primitives/Atom.hpp"
9 < #include "primitives/RigidBody.hpp"
40 > #include "brains/fSimulation.h"
41   #include "primitives/Molecule.hpp"
42 < #include "brains/Exclude.hpp"
43 < #include "brains/SkipList.hpp"
44 < #include "primitives/AbstractClasses.hpp"
14 < #include "types/MakeStamps.hpp"
15 < #include "brains/SimState.hpp"
16 < #include "restraints/Restraints.hpp"
42 > #include "types/MoleculeStamp.hpp"
43 > #include "utils/PropertyMap.hpp"
44 > #include "io/Globals.hpp"
45  
46 < #define __C
19 < #include "brains/fSimulation.h"
20 < #include "utils/GenericData.hpp"
46 > namespace oopse{
47  
48 + /**
49 + * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp"
50 + * @brief
51 + */
52 + class SimInfo {
53 +    public:
54 +        SimInfo();
55 +        virtual ~SimInfo();
56  
57 < //#include "Minimizer.hpp"
58 < //#include "minimizers/OOPSEMinimizer.hpp"
57 >        /**
58 >         * Adds a molecule
59 >         * @return return true if adding successfully, return false if the molecule is already in SimInfo
60 >         * @param mol molecule to be added
61 >         */
62 >        bool addMolecule(Molecule* mol);
63  
64 +        /**
65 +         * Removes a molecule from SimInfo
66 +         * @return true if removing successfully, return false if molecule is not in this SimInfo
67 +         */
68 +        bool removeMolecule(Molecule* mol);
69  
70 < double roundMe( double x );
71 < class OOPSEMinimizer;
72 < class SimInfo{
70 >        /**
71 >         * Returns the number of molecules.
72 >         * @return the number of molecules in this SimInfo
73 >         */
74 >        int getNMolecules() {
75 >            return molecules_.size();
76 >        }
77  
78 < public:
78 >        /** Returns the total number of atoms in this SimInfo */
79 >        unsigned int getNAtoms() {
80 >            return nAtoms_;
81 >        }
82  
83 <  SimInfo();
84 <  ~SimInfo();
83 >        /** Returns the total number of bonds in this SimInfo */        
84 >        unsigned int getNBonds(){
85 >            return nBonds_;
86 >        }
87  
88 <  int n_atoms; // the number of atoms
89 <  Atom **atoms; // the array of atom objects
88 >        /** Returns the total number of bends in this SimInfo */        
89 >        unsigned int getNBends() {
90 >            return nBends_;
91 >        }
92  
93 <  vector<RigidBody*> rigidBodies;  // A vector of rigid bodies
94 <  vector<StuntDouble*> integrableObjects;
95 <  
96 <  double tau[9]; // the stress tensor
93 >        /** Returns the total number of torsions in this SimInfo */        
94 >        unsigned int getNTorsions() {
95 >            return nTorsions_;
96 >        }
97  
98 <  int n_bonds;    // number of bends
99 <  int n_bends;    // number of bends
100 <  int n_torsions; // number of torsions
101 <  int n_oriented; // number of of atoms with orientation
48 <  int ndf;        // number of actual degrees of freedom
49 <  int ndfRaw;     // number of settable degrees of freedom
50 <  int ndfTrans;   // number of translational degrees of freedom
51 <  int nZconstraints; // the number of zConstraints
98 >        /** Returns the total number of rigid bodies in this SimInfo */        
99 >        unsigned int getNRigidBodies() {
100 >            return nRigidBodies_;
101 >        }
102  
103 <  int setTemp;   // boolean to set the temperature at each sampleTime
104 <  int resetIntegrator; // boolean to reset the integrator
103 >        /** Returns the total number of integrable objects in this SimInfo */
104 >        unsigned int getNIntegrableObjects() {
105 >            return nIntegrableObjects_;
106 >        }
107  
108 <  int n_dipoles; // number of dipoles
108 >        /** Returns the total number of cutoff groups in this SimInfo */
109 >        unsigned int getNCutoffGroups() {
110 >            return nCutoffGroups_;
111 >        }
112  
113 <  int n_exclude;
114 <  Exclude* excludes;  // the exclude list for ignoring pairs in fortran
115 <  int nGlobalExcludes;
116 <  int* globalExcludes; // same as above, but these guys participate in
117 <                       // no long range forces.
113 >        /** Returns the total number of constraints in this SimInfo */
114 >        unsigned int getNConstraints() {
115 >            return nConstraints_;
116 >        }
117 >        
118 >        /**
119 >         * Returns the first molecule in this SimInfo and intialize the iterator.
120 >         * @return the first molecule, return NULL if there is not molecule in this SimInfo
121 >         * @param i the iterator of molecule array (user shouldn't change it)
122 >         */
123 >        Molecule* beginMolecule(std::vector<Molecule*>::iterator& i);
124  
125 <  int* identArray;     // array of unique identifiers for the atoms
126 <  int* molMembershipArray;  // map of atom numbers onto molecule numbers
125 >        /**
126 >          * Returns the next avaliable Molecule based on the iterator.
127 >          * @return the next avaliable molecule, return NULL if reaching the end of the array
128 >          * @param i the iterator of molecule array
129 >          */
130 >        Molecule* nextMolecule(std::vector<Molecule*>::iterator& i);
131  
132 <  int n_constraints; // the number of constraints on the system
132 >        /** Returns the number of degrees of freedom */
133 >        int getNdf() {
134 >            return ndf_;
135 >        }
136  
137 <  int n_SRI;   // the number of short range interactions
137 >        /** Returns the number of raw degrees of freedom */
138 >        int getNdfRaw() {
139 >            return ndfRaw_;
140 >        }
141  
142 <  double lrPot; // the potential energy from the long range calculations.
142 >        /** Returns the number of translational degrees of freedom */
143 >        int getNdfTrans() {
144 >            return ndfTrans_;
145 >        }
146  
147 <  double Hmat[3][3];  // the periodic boundry conditions. The Hmat is the
148 <                      // column vectors of the x, y, and z box vectors.
149 <                      //   h1  h2  h3
150 <                      // [ Xx  Yx  Zx ]
77 <                      // [ Xy  Yy  Zy ]
78 <                      // [ Xz  Yz  Zz ]
79 <                      //  
80 <  double HmatInv[3][3];
147 >        /** Returns the snapshot manager. */
148 >        SnapshotManager* getSnapshotManager() {
149 >            return sman_;
150 >        }
151  
152 <  double boxL[3]; // The Lengths of the 3 column vectors of Hmat
153 <  double boxVol;
154 <  int orthoRhombic;
155 <  
152 >        /** Sets the snapshot manager. */
153 >        void setSnapshotManager(SnapshotManager* sman) {
154 >            sman_ = sman;
155 >        }
156  
157 <  double dielectric;      // the dielectric of the medium for reaction field
157 >        /** Returns the force field */
158 >        ForceField* getForceField() {
159 >            return forceField_;
160 >        }
161  
162 <  
163 <  int usePBC; // whether we use periodic boundry conditions.
164 <  int useDirectionalAtoms;
165 <  int useLennardJones;
93 <  int useElectrostatics;
94 <  int useCharges;
95 <  int useDipoles;
96 <  int useSticky;
97 <  int useGayBerne;
98 <  int useEAM;
99 <  int useShapes;
100 <  int useFLARB;
101 <  int useReactionField;
102 <  bool haveCutoffGroups;
103 <  bool useInitXSstate;
104 <  double orthoTolerance;
162 >        /** Sets the force field */
163 >        void setForceField(ForceField* ff) {
164 >            forceField_ = ff;
165 >        }
166  
167 <  double dt, run_time;           // the time step and total time
168 <  double sampleTime, statusTime; // the position and energy dump frequencies
169 <  double target_temp;            // the target temperature of the system
170 <  double thermalTime;            // the temp kick interval
171 <  double currentTime;            // Used primarily for correlation Functions
172 <  double resetTime;              // Use to reset the integrator periodically
173 <  short int have_target_temp;
167 >        Globals* getGlobals() {
168 >            return globals_;
169 >        }
170 >        
171 >        void setGlobals(Globals* globals) {
172 >            globals_ = globals;
173 >        }
174  
175 <  int n_mol;           // n_molecules;
176 <  Molecule* molecules; // the array of molecules
177 <  
117 <  int nComponents;           // the number of components in the system
118 <  int* componentsNmol;       // the number of molecules of each component
119 <  MoleculeStamp** compStamps;// the stamps matching the components
120 <  LinkedMolStamp* headStamp; // list of stamps used in the simulation
121 <  
122 <  
123 <  char ensemble[100]; // the enesemble of the simulation (NVT, NVE, etc. )
124 <  char mixingRule[100]; // the mixing rules for Lennard jones/van der walls
125 <  BaseIntegrator *the_integrator; // the integrator of the simulation
175 >        int* getExcludeList() {
176 >            return exclude_.getExcludeList();
177 >        }
178  
179 <  OOPSEMinimizer* the_minimizer; // the energy minimizer
180 <  Restraints* restraint;
181 <  bool has_minimizer;
179 >        Vector3d getComVel();
180 >        
181 >        Vector3d getCom();
182  
183 <  string finalName;  // the name of the eor file to be written
184 <  string sampleName; // the name of the dump file to be written
185 <  string statusName; // the name of the stat file to be written
183 >        int getSeed() {
184 >            return seed_;
185 >        }
186  
187 <  int seed;                    //seed for random number generator
187 >        void setSeed(int seed) {
188 >            seed_ = seed;
189 >        }
190 >        
191 >    private:
192  
193 <  int useSolidThermInt;  // is solid-state thermodynamic integration being used
194 <  int useLiquidThermInt; // is liquid thermodynamic integration being used
195 <  double thermIntLambda; // lambda for TI
140 <  double thermIntK;      // power of lambda for TI
141 <  double vRaw;           // unperturbed potential for TI
142 <  double vHarm;          // harmonic potential for TI
143 <  int i;                 // just an int
193 >        void calcNdf();
194 >        void calcNdfRaw();
195 >        void calcNdfTrans();
196  
197 <  vector<double> mfact;
198 <  vector<int> FglobalGroupMembership;
147 <  int ngroup;
148 <  int* globalGroupMembership;
197 >        void addExcludePairs(Molecule* mol);
198 >        void removeExcludePairs(Molecule* mol);
199  
200 <  // refreshes the sim if things get changed (load balanceing, volume
201 <  // adjustment, etc.)
200 >        int ndf_;
201 >        int ndfRaw_;
202 >        int ndfTrans_;
203 >        
204 >        int nAtoms_;
205 >        int nBonds_;
206 >        int nBends_;
207 >        int nTorsions_;
208 >        int nRigidBodies_;
209 >        int nIntegrableObjects_;
210 >        int nCutoffGroups_;
211 >        int nConstraints_;
212  
213 <  void refreshSim( void );
214 <  
213 >        simtype fInfo_;
214 >        Exclude exclude_;
215 >        ForceField* forceField_;
216 >        
217 >        std::vector<Molecule*> molecules_; /**< Molecule array */
218 >        PropertyMap properties_;                  /** Generic Property */
219 >        SnapshotManager* sman_;               /** SnapshotManager */
220  
221 <  // sets the internal function pointer to fortran.
221 >        std::vector<std::pair<MoleculeStamp*, int> > moleculeStamps_;
222 >        Globals* globals_;
223  
224 <
159 <  int getNDF();
160 <  int getNDFraw();
161 <  int getNDFtranslational();
162 <  int getTotIntegrableObjects();
163 <  void setBox( double newBox[3] );
164 <  void setBoxM( double newBox[3][3] );
165 <  void getBoxM( double theBox[3][3] );
166 <  void scaleBox( double scale );
167 <  
168 <  void setDefaultRcut( double theRcut );
169 <  void setDefaultRcut( double theRcut, double theRsw );
170 <  void checkCutOffs( void );
171 <
172 <  double getRcut( void )  { return rCut; }
173 <  double getRlist( void ) { return rList; }
174 <  double getRsw( void )   { return rSw; }
175 <  double getMaxCutoff( void ) { return maxCutoff; }
176 <  
177 <  void setTime( double theTime ) { currentTime = theTime; }
178 <  void incrTime( double the_dt ) { currentTime += the_dt; }
179 <  void decrTime( double the_dt ) { currentTime -= the_dt; }
180 <  double getTime( void ) { return currentTime; }
181 <
182 <  void wrapVector( double thePos[3] );
183 <
184 <  SimState* getConfiguration( void ) { return myConfiguration; }
185 <  
186 <  void addProperty(GenericData* prop);
187 <  GenericData* getPropertyByName(const string& propName);
188 <  //vector<GenericData*>& getProperties()  {return properties;}    
189 <
190 <  int getSeed(void) {  return seed; }
191 <  void setSeed(int theSeed) {  seed = theSeed;}
192 <
193 < private:
194 <
195 <  SimState* myConfiguration;
196 <
197 <  int boxIsInit, haveRcut, haveRsw;
198 <
199 <  double rList, rCut; // variables for the neighborlist
200 <  double rSw;         // the switching radius
201 <
202 <  double maxCutoff;
203 <
204 <  double distXY;
205 <  double distYZ;
206 <  double distZX;
207 <  
208 <  void calcHmatInv( void );
209 <  void calcBoxL();
210 <  double calcMaxCutOff();
211 <
212 <  
213 <  //Addtional Properties of SimInfo
214 <  map<string, GenericData*> properties;
215 <  void getFortranGroupArrays(SimInfo* info,
216 <                             vector<int>& FglobalGroupMembership,
217 <                             vector<double>& mfact);
218 <
219 <
224 >        int seed_;
225   };
226  
227 <
228 < #endif
227 > } //namespace oopse
228 > #endif //BRAINS_SIMMODEL_HPP

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines