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 "UseTheForce/fortranWrapDefines.hpp" |
21 |
< |
#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 |
49 |
< |
int ndf; // number of actual degrees of freedom |
50 |
< |
int ndfRaw; // number of settable degrees of freedom |
51 |
< |
int ndfTrans; // number of translational degrees of freedom |
52 |
< |
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 ] |
78 |
< |
// [ Xy Yy Zy ] |
79 |
< |
// [ Xz Yz Zz ] |
80 |
< |
// |
81 |
< |
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 useLJ; |
165 |
< |
int useSticky; |
94 |
< |
int useCharges; |
95 |
< |
int useDipoles; |
96 |
< |
int useReactionField; |
97 |
< |
int useGB; |
98 |
< |
int useEAM; |
99 |
< |
bool haveCutoffGroups; |
100 |
< |
bool useInitXSstate; |
101 |
< |
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 |
< |
|
114 |
< |
int nComponents; // the number of components in the system |
115 |
< |
int* componentsNmol; // the number of molecules of each component |
116 |
< |
MoleculeStamp** compStamps;// the stamps matching the components |
117 |
< |
LinkedMolStamp* headStamp; // list of stamps used in the simulation |
118 |
< |
|
119 |
< |
|
120 |
< |
char ensemble[100]; // the enesemble of the simulation (NVT, NVE, etc. ) |
121 |
< |
char mixingRule[100]; // the mixing rules for Lennard jones/van der walls |
122 |
< |
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 |
137 |
< |
double thermIntK; // power of lambda for TI |
138 |
< |
double vRaw; // unperturbed potential for TI |
139 |
< |
double vHarm; // harmonic potential for TI |
140 |
< |
int i; // just an int |
193 |
> |
void calcNdf(); |
194 |
> |
void calcNdfRaw(); |
195 |
> |
void calcNdfTrans(); |
196 |
|
|
197 |
< |
vector<double> mfact; |
198 |
< |
vector<int> FglobalGroupMembership; |
144 |
< |
int ngroup; |
145 |
< |
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 |
< |
void setInternal( setFortranSim_TD fSetup, |
156 |
< |
setFortranBox_TD fBox, |
157 |
< |
notifyFortranCutOff_TD fCut){ |
158 |
< |
setFsimulation = fSetup; |
159 |
< |
setFortranBoxSize = fBox; |
160 |
< |
notifyFortranCutOffs = fCut; |
161 |
< |
} |
162 |
< |
|
163 |
< |
int getNDF(); |
164 |
< |
int getNDFraw(); |
165 |
< |
int getNDFtranslational(); |
166 |
< |
int getTotIntegrableObjects(); |
167 |
< |
void setBox( double newBox[3] ); |
168 |
< |
void setBoxM( double newBox[3][3] ); |
169 |
< |
void getBoxM( double theBox[3][3] ); |
170 |
< |
void scaleBox( double scale ); |
171 |
< |
|
172 |
< |
void setDefaultRcut( double theRcut ); |
173 |
< |
void setDefaultRcut( double theRcut, double theRsw ); |
174 |
< |
void checkCutOffs( void ); |
175 |
< |
|
176 |
< |
double getRcut( void ) { return rCut; } |
177 |
< |
double getRlist( void ) { return rList; } |
178 |
< |
double getRsw( void ) { return rSw; } |
179 |
< |
double getMaxCutoff( void ) { return maxCutoff; } |
180 |
< |
|
181 |
< |
void setTime( double theTime ) { currentTime = theTime; } |
182 |
< |
void incrTime( double the_dt ) { currentTime += the_dt; } |
183 |
< |
void decrTime( double the_dt ) { currentTime -= the_dt; } |
184 |
< |
double getTime( void ) { return currentTime; } |
185 |
< |
|
186 |
< |
void wrapVector( double thePos[3] ); |
187 |
< |
|
188 |
< |
SimState* getConfiguration( void ) { return myConfiguration; } |
189 |
< |
|
190 |
< |
void addProperty(GenericData* prop); |
191 |
< |
GenericData* getProperty(const string& propName); |
192 |
< |
//vector<GenericData*>& getProperties() {return properties;} |
193 |
< |
|
194 |
< |
int getSeed(void) { return seed; } |
195 |
< |
void setSeed(int theSeed) { seed = theSeed;} |
196 |
< |
|
197 |
< |
private: |
198 |
< |
|
199 |
< |
SimState* myConfiguration; |
200 |
< |
|
201 |
< |
int boxIsInit, haveRcut, haveRsw; |
202 |
< |
|
203 |
< |
double rList, rCut; // variables for the neighborlist |
204 |
< |
double rSw; // the switching radius |
205 |
< |
|
206 |
< |
double maxCutoff; |
207 |
< |
|
208 |
< |
double distXY; |
209 |
< |
double distYZ; |
210 |
< |
double distZX; |
211 |
< |
|
212 |
< |
void calcHmatInv( void ); |
213 |
< |
void calcBoxL(); |
214 |
< |
double calcMaxCutOff(); |
215 |
< |
|
216 |
< |
// private function to initialize the fortran side of the simulation |
217 |
< |
setFortranSim_TD setFsimulation; |
218 |
< |
|
219 |
< |
setFortranBox_TD setFortranBoxSize; |
220 |
< |
|
221 |
< |
notifyFortranCutOff_TD notifyFortranCutOffs; |
222 |
< |
|
223 |
< |
//Addtional Properties of SimInfo |
224 |
< |
map<string, GenericData*> properties; |
225 |
< |
void getFortranGroupArrays(SimInfo* info, |
226 |
< |
vector<int>& FglobalGroupMembership, |
227 |
< |
vector<double>& mfact); |
228 |
< |
|
229 |
< |
|
224 |
> |
int seed_; |
225 |
|
}; |
226 |
|
|
227 |
< |
|
228 |
< |
#endif |
227 |
> |
} //namespace oopse |
228 |
> |
#endif //BRAINS_SIMMODEL_HPP |