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 useLJ; |
165 |
< |
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 |
> |
/** 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 |
< |
|
113 |
< |
int nComponents; // the number of components in the system |
114 |
< |
int* componentsNmol; // the number of molecules of each component |
115 |
< |
MoleculeStamp** compStamps;// the stamps matching the components |
116 |
< |
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 |
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 |
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 |
193 |
> |
void calcNdf(); |
194 |
> |
void calcNdfRaw(); |
195 |
> |
void calcNdfTrans(); |
196 |
|
|
197 |
< |
vector<double> mfact; |
198 |
< |
vector<int> FglobalGroupMembership; |
143 |
< |
int ngroup; |
144 |
< |
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 |
< |
|
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 |
< |
|
224 |
> |
int seed_; |
225 |
|
}; |
226 |
|
|
227 |
< |
|
228 |
< |
#endif |
227 |
> |
} //namespace oopse |
228 |
> |
#endif //BRAINS_SIMMODEL_HPP |