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

Comparing:
trunk/OOPSE-4/src/brains/SimInfo.hpp (file contents), Revision 1617 by chuckv, Wed Oct 20 20:46:20 2004 UTC vs.
branches/new_design/OOPSE-4/src/brains/SimInfo.hpp (file contents), Revision 1712 by tim, Thu Nov 4 20:55:01 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   #include <vector>
36 + #include <iostream>
37  
38 < #include "primitives/Atom.hpp"
9 < #include "primitives/RigidBody.hpp"
38 > #include "brains/fSimulation.h"
39   #include "primitives/Molecule.hpp"
40 < #include "brains/Exclude.hpp"
12 < #include "brains/SkipList.hpp"
13 < #include "primitives/AbstractClasses.hpp"
14 < #include "types/MakeStamps.hpp"
15 < #include "brains/SimState.hpp"
16 < #include "restraints/Restraints.hpp"
40 > #include "utils/PropertyMap.hpp"
41  
42 < #define __C
19 < #include "brains/fSimulation.h"
20 < #include "utils/GenericData.hpp"
42 > namespace oopse{
43  
44 + /**
45 + * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp"
46 + * @brief
47 + */
48 + class SimInfo {
49 +    public:
50 +        SimInfo();
51 +        virtual ~SimInfo();
52  
53 < //#include "Minimizer.hpp"
54 < //#include "minimizers/OOPSEMinimizer.hpp"
53 >        /**
54 >         * Adds a molecule
55 >         * @return return true if adding successfully, return false if the molecule is already in SimInfo
56 >         * @param mol molecule to be added
57 >         */
58 >        bool addMolecule(Molecule* mol);
59  
60 +        /**
61 +         * Removes a molecule from SimInfo
62 +         * @return true if removing successfully, return false if molecule is not in this SimInfo
63 +         */
64 +        bool removeMolecule(Molecule* mol);
65  
66 < double roundMe( double x );
67 < class OOPSEMinimizer;
68 < class SimInfo{
66 >        /**
67 >         * Returns the number of molecules.
68 >         * @return the number of molecules in this SimInfo
69 >         */
70 >        int getNMolecules() {
71 >            return molecules_.size();
72 >        }
73  
74 < public:
74 >        /** Returns the total number of atoms in this SimInfo */
75 >        unsigned int getNAtoms() {
76 >            return nAtoms_;
77 >        }
78  
79 <  SimInfo();
80 <  ~SimInfo();
79 >        /** Returns the total number of bonds in this SimInfo */        
80 >        unsigned int getNBonds(){
81 >            return nBonds_;
82 >        }
83  
84 <  int n_atoms; // the number of atoms
85 <  Atom **atoms; // the array of atom objects
84 >        /** Returns the total number of bends in this SimInfo */        
85 >        unsigned int getNBends() {
86 >            return nBends_;
87 >        }
88  
89 <  vector<RigidBody*> rigidBodies;  // A vector of rigid bodies
90 <  vector<StuntDouble*> integrableObjects;
91 <  
92 <  double tau[9]; // the stress tensor
89 >        /** Returns the total number of torsions in this SimInfo */        
90 >        unsigned int getNTorsions() {
91 >            return nTorsions_;
92 >        }
93  
94 <  int n_bonds;    // number of bends
95 <  int n_bends;    // number of bends
96 <  int n_torsions; // number of torsions
97 <  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
94 >        /** Returns the total number of rigid bodies in this SimInfo */        
95 >        unsigned int getNRigidBodies() {
96 >            return nRigidBodies_;
97 >        }
98  
99 <  int setTemp;   // boolean to set the temperature at each sampleTime
100 <  int resetIntegrator; // boolean to reset the integrator
99 >        /** Returns the total number of integrable objects in this SimInfo */
100 >        unsigned int getNIntegrableObjects() {
101 >            return nIntegrableObjects_;
102 >        }
103  
104 <  int n_dipoles; // number of dipoles
104 >        /** Returns the total number of cutoff groups in this SimInfo */
105 >        unsigned int getNCutoffGroups() {
106 >            return nCutoffGroups_;
107 >        }
108  
109 <  int n_exclude;
110 <  Exclude* excludes;  // the exclude list for ignoring pairs in fortran
111 <  int nGlobalExcludes;
112 <  int* globalExcludes; // same as above, but these guys participate in
113 <                       // no long range forces.
109 >        /** Returns the total number of constraints in this SimInfo */
110 >        unsigned int getNConstraints() {
111 >            return nConstraints_;
112 >        }
113 >        
114 >        /**
115 >         * Returns the first molecule in this SimInfo and intialize the iterator.
116 >         * @return the first molecule, return NULL if there is not molecule in this SimInfo
117 >         * @param i the iterator of molecule array (user shouldn't change it)
118 >         */
119 >        Molecule* beginMolecule(std::vector<Molecule*>::iterator& i);
120  
121 <  int* identArray;     // array of unique identifiers for the atoms
122 <  int* molMembershipArray;  // map of atom numbers onto molecule numbers
121 >        /**
122 >          * Returns the next avaliable Molecule based on the iterator.
123 >          * @return the next avaliable molecule, return NULL if reaching the end of the array
124 >          * @param i the iterator of molecule array
125 >          */
126 >        Molecule* nextMolecule(std::vector<Molecule*>::iterator& i);
127  
128 <  int n_constraints; // the number of constraints on the system
128 >        /** Returns the number of degrees of freedom */
129 >        int getNDF() {
130 >            return ndf_;
131 >        }
132  
133 <  int n_SRI;   // the number of short range interactions
133 >        /** Returns the number of raw degrees of freedom */
134 >        int getNDFRaw() {
135 >            return ndfRaw_;
136 >        }
137  
138 <  double lrPot; // the potential energy from the long range calculations.
138 >        /** Returns the number of translational degrees of freedom */
139 >        int getNDFTrans() {
140 >            return ndfTrans_;
141 >        }
142  
143 <  double Hmat[3][3];  // the periodic boundry conditions. The Hmat is the
144 <                      // column vectors of the x, y, and z box vectors.
145 <                      //   h1  h2  h3
146 <                      // [ Xx  Yx  Zx ]
77 <                      // [ Xy  Yy  Zy ]
78 <                      // [ Xz  Yz  Zz ]
79 <                      //  
80 <  double HmatInv[3][3];
143 >        /** Returns the snapshot manager. */
144 >        SnapshotManager* getSnapshotManager() {
145 >            return sman_;
146 >        }
147  
148 <  double boxL[3]; // The Lengths of the 3 column vectors of Hmat
149 <  double boxVol;
150 <  int orthoRhombic;
151 <  
148 >        /** Sets the snapshot manager. */
149 >        void setSnapshotManager(SnapshotManager* sman) {
150 >            sman_ = sman;
151 >        }
152  
153 <  double dielectric;      // the dielectric of the medium for reaction field
153 >        ForceField* getForceField() {
154 >            return forceField_;
155 >        }
156 >        
157 >        void setForceField(ForceField* ff) {
158 >            forceField_ = ff;
159 >        }
160 >    private:
161  
162 <  
163 <  int usePBC; // whether we use periodic boundry conditions.
164 <  int useLJ;
92 <  int useSticky;
93 <  int useCharges;
94 <  int useDipoles;
95 <  int useReactionField;
96 <  int useGB;
97 <  int useEAM;
98 <  bool haveCutoffGroups;
99 <  bool useInitXSstate;
100 <  double orthoTolerance;
162 >        void calcNDF();
163 >        void calcNDFRaw();
164 >        void calcNDFTrans();
165  
166 <  double dt, run_time;           // the time step and total time
167 <  double sampleTime, statusTime; // the position and energy dump frequencies
168 <  double target_temp;            // the target temperature of the system
169 <  double thermalTime;            // the temp kick interval
170 <  double currentTime;            // Used primarily for correlation Functions
171 <  double resetTime;              // Use to reset the integrator periodically
172 <  short int have_target_temp;
166 >        int ndf_;
167 >        int ndfRaw_;
168 >        int ndfTrans_;
169 >        
170 >        int nAtoms_;
171 >        int nBonds_;
172 >        int nBends_;
173 >        int nTorsions_;
174 >        int nRigidBodies_;
175 >        int nIntegrableObjects_;
176 >        int nCutoffGroups_;
177 >        int nConstraints_;
178  
179 <  int n_mol;           // n_molecules;
180 <  Molecule* molecules; // the array of molecules
181 <  
182 <  int nComponents;           // the number of components in the system
183 <  int* componentsNmol;       // the number of molecules of each component
184 <  MoleculeStamp** compStamps;// the stamps matching the components
185 <  LinkedMolStamp* headStamp; // list of stamps used in the simulation
117 <  
118 <  
119 <  char ensemble[100]; // the enesemble of the simulation (NVT, NVE, etc. )
120 <  char mixingRule[100]; // the mixing rules for Lennard jones/van der walls
121 <  BaseIntegrator *the_integrator; // the integrator of the simulation
179 >        simtype fInfo;
180 >        Exclude excludeList;
181 >        ForceField* forceField_;
182 >        
183 >        std::vector<Molecule*> molecules_; /**< Molecule array */
184 >        PropertyMap properties_;                  /** Generic Property */
185 >        SnapshotManager* sman_;               /** SnapshotManager */
186  
123  OOPSEMinimizer* the_minimizer; // the energy minimizer
124  Restraints* restraint;
125  bool has_minimizer;
126
127  string finalName;  // the name of the eor file to be written
128  string sampleName; // the name of the dump file to be written
129  string statusName; // the name of the stat file to be written
130
131  int seed;                    //seed for random number generator
132
133  int useSolidThermInt;  // is solid-state thermodynamic integration being used
134  int useLiquidThermInt; // is liquid thermodynamic integration being used
135  double thermIntLambda; // lambda for TI
136  double thermIntK;      // power of lambda for TI
137  double vRaw;           // unperturbed potential for TI
138  double vHarm;          // harmonic potential for TI
139  int i;                 // just an int
140
141  vector<double> mfact;
142  vector<int> FglobalGroupMembership;
143  int ngroup;
144  int* globalGroupMembership;
145
146  // refreshes the sim if things get changed (load balanceing, volume
147  // adjustment, etc.)
148
149  void refreshSim( void );
150  
151
152  // sets the internal function pointer to fortran.
153
154
155  int getNDF();
156  int getNDFraw();
157  int getNDFtranslational();
158  int getTotIntegrableObjects();
159  void setBox( double newBox[3] );
160  void setBoxM( double newBox[3][3] );
161  void getBoxM( double theBox[3][3] );
162  void scaleBox( double scale );
163  
164  void setDefaultRcut( double theRcut );
165  void setDefaultRcut( double theRcut, double theRsw );
166  void checkCutOffs( void );
167
168  double getRcut( void )  { return rCut; }
169  double getRlist( void ) { return rList; }
170  double getRsw( void )   { return rSw; }
171  double getMaxCutoff( void ) { return maxCutoff; }
172  
173  void setTime( double theTime ) { currentTime = theTime; }
174  void incrTime( double the_dt ) { currentTime += the_dt; }
175  void decrTime( double the_dt ) { currentTime -= the_dt; }
176  double getTime( void ) { return currentTime; }
177
178  void wrapVector( double thePos[3] );
179
180  SimState* getConfiguration( void ) { return myConfiguration; }
181  
182  void addProperty(GenericData* prop);
183  GenericData* getProperty(const string& propName);
184  //vector<GenericData*>& getProperties()  {return properties;}    
185
186  int getSeed(void) {  return seed; }
187  void setSeed(int theSeed) {  seed = theSeed;}
188
189 private:
190
191  SimState* myConfiguration;
192
193  int boxIsInit, haveRcut, haveRsw;
194
195  double rList, rCut; // variables for the neighborlist
196  double rSw;         // the switching radius
197
198  double maxCutoff;
199
200  double distXY;
201  double distYZ;
202  double distZX;
203  
204  void calcHmatInv( void );
205  void calcBoxL();
206  double calcMaxCutOff();
207
208  
209  //Addtional Properties of SimInfo
210  map<string, GenericData*> properties;
211  void getFortranGroupArrays(SimInfo* info,
212                             vector<int>& FglobalGroupMembership,
213                             vector<double>& mfact);
214
215
187   };
188  
189 <
190 < #endif
189 > } //namespace oopse
190 > #endif //BRAINS_SIMMODEL_HPP

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines