1 |
< |
#ifndef __SIMINFO_H__ |
2 |
< |
#define __SIMINFO_H__ |
1 |
> |
/* |
2 |
> |
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
> |
* |
4 |
> |
* The University of Notre Dame grants you ("Licensee") a |
5 |
> |
* non-exclusive, royalty free, license to use, modify and |
6 |
> |
* redistribute this software in source and binary code form, provided |
7 |
> |
* that the following conditions are met: |
8 |
> |
* |
9 |
> |
* 1. Acknowledgement of the program authors must be made in any |
10 |
> |
* publication of scientific results based in part on use of the |
11 |
> |
* program. An acceptable form of acknowledgement is citation of |
12 |
> |
* the article in which the program was described (Matthew |
13 |
> |
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
> |
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
> |
* Parallel Simulation Engine for Molecular Dynamics," |
16 |
> |
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
> |
* |
18 |
> |
* 2. Redistributions of source code must retain the above copyright |
19 |
> |
* notice, this list of conditions and the following disclaimer. |
20 |
> |
* |
21 |
> |
* 3. Redistributions in binary form must reproduce the above copyright |
22 |
> |
* notice, this list of conditions and the following disclaimer in the |
23 |
> |
* documentation and/or other materials provided with the |
24 |
> |
* distribution. |
25 |
> |
* |
26 |
> |
* This software is provided "AS IS," without a warranty of any |
27 |
> |
* kind. All express or implied conditions, representations and |
28 |
> |
* warranties, including any implied warranty of merchantability, |
29 |
> |
* fitness for a particular purpose or non-infringement, are hereby |
30 |
> |
* excluded. The University of Notre Dame and its licensors shall not |
31 |
> |
* be liable for any damages suffered by licensee as a result of |
32 |
> |
* using, modifying or distributing the software or its |
33 |
> |
* derivatives. In no event will the University of Notre Dame or its |
34 |
> |
* licensors be liable for any lost revenue, profit or data, or for |
35 |
> |
* direct, indirect, special, consequential, incidental or punitive |
36 |
> |
* damages, however caused and regardless of the theory of liability, |
37 |
> |
* arising out of the use of or inability to use software, even if the |
38 |
> |
* University of Notre Dame has been advised of the possibility of |
39 |
> |
* such damages. |
40 |
> |
*/ |
41 |
> |
|
42 |
> |
/** |
43 |
> |
* @file SimInfo.hpp |
44 |
> |
* @author tlin |
45 |
> |
* @date 11/02/2004 |
46 |
> |
* @version 1.0 |
47 |
> |
*/ |
48 |
|
|
49 |
< |
#include <map> |
50 |
< |
#include <string> |
49 |
> |
#ifndef BRAINS_SIMMODEL_HPP |
50 |
> |
#define BRAINS_SIMMODEL_HPP |
51 |
> |
|
52 |
> |
#include <iostream> |
53 |
> |
#include <set> |
54 |
> |
#include <utility> |
55 |
|
#include <vector> |
56 |
|
|
57 |
< |
#include "Atom.hpp" |
58 |
< |
#include "RigidBody.hpp" |
59 |
< |
#include "Molecule.hpp" |
60 |
< |
#include "Exclude.hpp" |
61 |
< |
#include "SkipList.hpp" |
62 |
< |
#include "AbstractClasses.hpp" |
63 |
< |
#include "MakeStamps.hpp" |
15 |
< |
#include "SimState.hpp" |
16 |
< |
#include "Restraints.hpp" |
57 |
> |
#include "brains/Exclude.hpp" |
58 |
> |
#include "io/Globals.hpp" |
59 |
> |
#include "math/Vector3.hpp" |
60 |
> |
#include "types/MoleculeStamp.hpp" |
61 |
> |
#include "UseTheForce/ForceField.hpp" |
62 |
> |
#include "utils/PropertyMap.hpp" |
63 |
> |
#include "utils/LocalIndexManager.hpp" |
64 |
|
|
65 |
+ |
//another nonsense macro declaration |
66 |
|
#define __C |
67 |
< |
#include "fSimulation.h" |
20 |
< |
#include "fortranWrapDefines.hpp" |
21 |
< |
#include "GenericData.hpp" |
67 |
> |
#include "brains/fSimulation.h" |
68 |
|
|
69 |
+ |
namespace oopse{ |
70 |
|
|
71 |
< |
//#include "Minimizer.hpp" |
72 |
< |
//#include "OOPSEMinimizer.hpp" |
71 |
> |
//forward decalration |
72 |
> |
class SnapshotManager; |
73 |
> |
class Molecule; |
74 |
> |
class SelectionManager; |
75 |
> |
/** |
76 |
> |
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
77 |
> |
* @brief As one of the heavy weight class of OOPSE, SimInfo |
78 |
> |
* One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules. |
79 |
> |
* And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies, |
80 |
> |
* cutoff groups, constrains). |
81 |
> |
* Another major change is the index. No matter single version or parallel version, atoms and |
82 |
> |
* rigid bodies have both global index and local index. Local index is not important to molecule as well as |
83 |
> |
* cutoff group. |
84 |
> |
*/ |
85 |
> |
class SimInfo { |
86 |
> |
public: |
87 |
> |
typedef std::map<int, Molecule*>::iterator MoleculeIterator; |
88 |
|
|
89 |
+ |
/** |
90 |
+ |
* Constructor of SimInfo |
91 |
+ |
* @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the |
92 |
+ |
* second element is the total number of molecules with the same molecule stamp in the system |
93 |
+ |
* @param ff pointer of a concrete ForceField instance |
94 |
+ |
* @param simParams |
95 |
+ |
* @note |
96 |
+ |
*/ |
97 |
+ |
SimInfo(std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, ForceField* ff, Globals* simParams); |
98 |
+ |
virtual ~SimInfo(); |
99 |
|
|
100 |
< |
double roundMe( double x ); |
101 |
< |
class OOPSEMinimizer; |
102 |
< |
class SimInfo{ |
100 |
> |
/** |
101 |
> |
* Adds a molecule |
102 |
> |
* @return return true if adding successfully, return false if the molecule is already in SimInfo |
103 |
> |
* @param mol molecule to be added |
104 |
> |
*/ |
105 |
> |
bool addMolecule(Molecule* mol); |
106 |
|
|
107 |
< |
public: |
107 |
> |
/** |
108 |
> |
* Removes a molecule from SimInfo |
109 |
> |
* @return true if removing successfully, return false if molecule is not in this SimInfo |
110 |
> |
*/ |
111 |
> |
bool removeMolecule(Molecule* mol); |
112 |
|
|
113 |
< |
SimInfo(); |
114 |
< |
~SimInfo(); |
113 |
> |
/** Returns the total number of molecules in the system. */ |
114 |
> |
int getNGlobalMolecules() { |
115 |
> |
return nGlobalMols_; |
116 |
> |
} |
117 |
|
|
118 |
< |
int n_atoms; // the number of atoms |
119 |
< |
Atom **atoms; // the array of atom objects |
118 |
> |
/** Returns the total number of atoms in the system. */ |
119 |
> |
int getNGlobalAtoms() { |
120 |
> |
return nGlobalAtoms_; |
121 |
> |
} |
122 |
|
|
123 |
< |
vector<RigidBody*> rigidBodies; // A vector of rigid bodies |
124 |
< |
vector<StuntDouble*> integrableObjects; |
125 |
< |
|
126 |
< |
double tau[9]; // the stress tensor |
123 |
> |
/** Returns the total number of cutoff groups in the system. */ |
124 |
> |
int getNGlobalCutoffGroups() { |
125 |
> |
return nGlobalCutoffGroups_; |
126 |
> |
} |
127 |
|
|
128 |
< |
int n_bonds; // number of bends |
129 |
< |
int n_bends; // number of bends |
130 |
< |
int n_torsions; // number of torsions |
131 |
< |
int n_oriented; // number of of atoms with orientation |
132 |
< |
int ndf; // number of actual degrees of freedom |
133 |
< |
int ndfRaw; // number of settable degrees of freedom |
134 |
< |
int ndfTrans; // number of translational degrees of freedom |
52 |
< |
int nZconstraints; // the number of zConstraints |
128 |
> |
/** |
129 |
> |
* Returns the total number of integrable objects (total number of rigid bodies plus the total number |
130 |
> |
* of atoms which do not belong to the rigid bodies) in the system |
131 |
> |
*/ |
132 |
> |
int getNGlobalIntegrableObjects() { |
133 |
> |
return nGlobalIntegrableObjects_; |
134 |
> |
} |
135 |
|
|
136 |
< |
int setTemp; // boolean to set the temperature at each sampleTime |
137 |
< |
int resetIntegrator; // boolean to reset the integrator |
136 |
> |
/** |
137 |
> |
* Returns the total number of integrable objects (total number of rigid bodies plus the total number |
138 |
> |
* of atoms which do not belong to the rigid bodies) in the system |
139 |
> |
*/ |
140 |
> |
int getNGlobalRigidBodies() { |
141 |
> |
return nGlobalRigidBodies_; |
142 |
> |
} |
143 |
|
|
144 |
< |
int n_dipoles; // number of dipoles |
144 |
> |
int getNGlobalConstraints(); |
145 |
> |
/** |
146 |
> |
* Returns the number of local molecules. |
147 |
> |
* @return the number of local molecules |
148 |
> |
*/ |
149 |
> |
int getNMolecules() { |
150 |
> |
return molecules_.size(); |
151 |
> |
} |
152 |
|
|
153 |
< |
int n_exclude; |
154 |
< |
Exclude* excludes; // the exclude list for ignoring pairs in fortran |
155 |
< |
int nGlobalExcludes; |
156 |
< |
int* globalExcludes; // same as above, but these guys participate in |
63 |
< |
// no long range forces. |
153 |
> |
/** Returns the number of local atoms */ |
154 |
> |
unsigned int getNAtoms() { |
155 |
> |
return nAtoms_; |
156 |
> |
} |
157 |
|
|
158 |
< |
int* identArray; // array of unique identifiers for the atoms |
159 |
< |
int* molMembershipArray; // map of atom numbers onto molecule numbers |
158 |
> |
/** Returns the number of local bonds */ |
159 |
> |
unsigned int getNBonds(){ |
160 |
> |
return nBonds_; |
161 |
> |
} |
162 |
|
|
163 |
< |
int n_constraints; // the number of constraints on the system |
163 |
> |
/** Returns the number of local bends */ |
164 |
> |
unsigned int getNBends() { |
165 |
> |
return nBends_; |
166 |
> |
} |
167 |
|
|
168 |
< |
int n_SRI; // the number of short range interactions |
168 |
> |
/** Returns the number of local torsions */ |
169 |
> |
unsigned int getNTorsions() { |
170 |
> |
return nTorsions_; |
171 |
> |
} |
172 |
|
|
173 |
< |
double lrPot; // the potential energy from the long range calculations. |
173 |
> |
/** Returns the number of local rigid bodies */ |
174 |
> |
unsigned int getNRigidBodies() { |
175 |
> |
return nRigidBodies_; |
176 |
> |
} |
177 |
|
|
178 |
< |
double Hmat[3][3]; // the periodic boundry conditions. The Hmat is the |
179 |
< |
// column vectors of the x, y, and z box vectors. |
180 |
< |
// h1 h2 h3 |
181 |
< |
// [ Xx Yx Zx ] |
78 |
< |
// [ Xy Yy Zy ] |
79 |
< |
// [ Xz Yz Zz ] |
80 |
< |
// |
81 |
< |
double HmatInv[3][3]; |
178 |
> |
/** Returns the number of local integrable objects */ |
179 |
> |
unsigned int getNIntegrableObjects() { |
180 |
> |
return nIntegrableObjects_; |
181 |
> |
} |
182 |
|
|
183 |
< |
double boxL[3]; // The Lengths of the 3 column vectors of Hmat |
184 |
< |
double boxVol; |
185 |
< |
int orthoRhombic; |
186 |
< |
|
183 |
> |
/** Returns the number of local cutoff groups */ |
184 |
> |
unsigned int getNCutoffGroups() { |
185 |
> |
return nCutoffGroups_; |
186 |
> |
} |
187 |
|
|
188 |
< |
double dielectric; // the dielectric of the medium for reaction field |
188 |
> |
/** Returns the total number of constraints in this SimInfo */ |
189 |
> |
unsigned int getNConstraints() { |
190 |
> |
return nConstraints_; |
191 |
> |
} |
192 |
> |
|
193 |
> |
/** |
194 |
> |
* Returns the first molecule in this SimInfo and intialize the iterator. |
195 |
> |
* @return the first molecule, return NULL if there is not molecule in this SimInfo |
196 |
> |
* @param i the iterator of molecule array (user shouldn't change it) |
197 |
> |
*/ |
198 |
> |
Molecule* beginMolecule(MoleculeIterator& i); |
199 |
|
|
200 |
< |
|
201 |
< |
int usePBC; // whether we use periodic boundry conditions. |
202 |
< |
int useLJ; |
203 |
< |
int useSticky; |
204 |
< |
int useCharges; |
205 |
< |
int useDipoles; |
96 |
< |
int useReactionField; |
97 |
< |
int useGB; |
98 |
< |
int useEAM; |
99 |
< |
bool haveCutoffGroups; |
100 |
< |
bool useInitXSstate; |
101 |
< |
double orthoTolerance; |
200 |
> |
/** |
201 |
> |
* Returns the next avaliable Molecule based on the iterator. |
202 |
> |
* @return the next avaliable molecule, return NULL if reaching the end of the array |
203 |
> |
* @param i the iterator of molecule array |
204 |
> |
*/ |
205 |
> |
Molecule* nextMolecule(MoleculeIterator& i); |
206 |
|
|
207 |
< |
double dt, run_time; // the time step and total time |
208 |
< |
double sampleTime, statusTime; // the position and energy dump frequencies |
209 |
< |
double target_temp; // the target temperature of the system |
210 |
< |
double thermalTime; // the temp kick interval |
107 |
< |
double currentTime; // Used primarily for correlation Functions |
108 |
< |
double resetTime; // Use to reset the integrator periodically |
109 |
< |
short int have_target_temp; |
207 |
> |
/** Returns the number of degrees of freedom */ |
208 |
> |
int getNdf() { |
209 |
> |
return ndf_; |
210 |
> |
} |
211 |
|
|
212 |
< |
int n_mol; // n_molecules; |
213 |
< |
Molecule* molecules; // the array of molecules |
214 |
< |
|
215 |
< |
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 |
212 |
> |
/** Returns the number of raw degrees of freedom */ |
213 |
> |
int getNdfRaw() { |
214 |
> |
return ndfRaw_; |
215 |
> |
} |
216 |
|
|
217 |
< |
OOPSEMinimizer* the_minimizer; // the energy minimizer |
218 |
< |
Restraints* restraint; |
219 |
< |
bool has_minimizer; |
217 |
> |
/** Returns the number of translational degrees of freedom */ |
218 |
> |
int getNdfTrans() { |
219 |
> |
return ndfTrans_; |
220 |
> |
} |
221 |
|
|
222 |
< |
string finalName; // the name of the eor file to be written |
223 |
< |
string sampleName; // the name of the dump file to be written |
224 |
< |
string statusName; // the name of the stat file to be written |
222 |
> |
//getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying |
223 |
> |
|
224 |
> |
/** Returns the total number of z-constraint molecules in the system */ |
225 |
> |
int getNZconstraint() { |
226 |
> |
return nZconstraint_; |
227 |
> |
} |
228 |
|
|
229 |
< |
int seed; //seed for random number generator |
229 |
> |
/** |
230 |
> |
* Sets the number of z-constraint molecules in the system. |
231 |
> |
*/ |
232 |
> |
void setNZconstraint(int nZconstraint) { |
233 |
> |
nZconstraint_ = nZconstraint; |
234 |
> |
} |
235 |
> |
|
236 |
> |
/** Returns the snapshot manager. */ |
237 |
> |
SnapshotManager* getSnapshotManager() { |
238 |
> |
return sman_; |
239 |
> |
} |
240 |
|
|
241 |
< |
int useSolidThermInt; // is solid-state thermodynamic integration being used |
242 |
< |
int useLiquidThermInt; // is liquid thermodynamic integration being used |
243 |
< |
double thermIntLambda; // lambda for TI |
244 |
< |
double thermIntK; // power of lambda for TI |
245 |
< |
double vRaw; // unperturbed potential for TI |
246 |
< |
double vHarm; // harmonic potential for TI |
247 |
< |
int i; // just an int |
241 |
> |
/** Sets the snapshot manager. */ |
242 |
> |
void setSnapshotManager(SnapshotManager* sman); |
243 |
> |
|
244 |
> |
/** Returns the force field */ |
245 |
> |
ForceField* getForceField() { |
246 |
> |
return forceField_; |
247 |
> |
} |
248 |
|
|
249 |
< |
vector<double> mfact; |
250 |
< |
vector<int> FglobalGroupMembership; |
251 |
< |
int ngroup; |
145 |
< |
int* globalGroupMembership; |
249 |
> |
Globals* getSimParams() { |
250 |
> |
return simParams_; |
251 |
> |
} |
252 |
|
|
253 |
< |
// refreshes the sim if things get changed (load balanceing, volume |
254 |
< |
// adjustment, etc.) |
253 |
> |
/** Returns the velocity of center of mass of the whole system.*/ |
254 |
> |
Vector3d getComVel(); |
255 |
|
|
256 |
< |
void refreshSim( void ); |
257 |
< |
|
256 |
> |
/** Returns the center of the mass of the whole system.*/ |
257 |
> |
Vector3d getCom(); |
258 |
|
|
259 |
< |
// sets the internal function pointer to fortran. |
259 |
> |
/** Returns the seed (used for random number generator) */ |
260 |
> |
int getSeed() { |
261 |
> |
return seed_; |
262 |
> |
} |
263 |
|
|
264 |
< |
void setInternal( setFortranSim_TD fSetup, |
265 |
< |
setFortranBox_TD fBox, |
266 |
< |
notifyFortranCutOff_TD fCut){ |
267 |
< |
setFsimulation = fSetup; |
159 |
< |
setFortranBoxSize = fBox; |
160 |
< |
notifyFortranCutOffs = fCut; |
161 |
< |
} |
264 |
> |
/** Sets the seed*/ |
265 |
> |
void setSeed(int seed) { |
266 |
> |
seed_ = seed; |
267 |
> |
} |
268 |
|
|
269 |
< |
int getNDF(); |
270 |
< |
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 ); |
269 |
> |
/** main driver function to interact with fortran during the initialization and molecule migration */ |
270 |
> |
void update(); |
271 |
|
|
272 |
< |
double getRcut( void ) { return rCut; } |
273 |
< |
double getRlist( void ) { return rList; } |
274 |
< |
double getRsw( void ) { return rSw; } |
275 |
< |
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; } |
272 |
> |
/** Returns the local index manager */ |
273 |
> |
LocalIndexManager* getLocalIndexManager() { |
274 |
> |
return &localIndexMan_; |
275 |
> |
} |
276 |
|
|
277 |
< |
void wrapVector( double thePos[3] ); |
277 |
> |
int getMoleculeStampId(int globalIndex) { |
278 |
> |
//assert(globalIndex < molStampIds_.size()) |
279 |
> |
return molStampIds_[globalIndex]; |
280 |
> |
} |
281 |
|
|
282 |
< |
SimState* getConfiguration( void ) { return myConfiguration; } |
283 |
< |
|
284 |
< |
void addProperty(GenericData* prop); |
285 |
< |
GenericData* getProperty(const string& propName); |
192 |
< |
//vector<GenericData*>& getProperties() {return properties;} |
282 |
> |
/** Returns the molecule stamp */ |
283 |
> |
MoleculeStamp* getMoleculeStamp(int id) { |
284 |
> |
return moleculeStamps_[id]; |
285 |
> |
} |
286 |
|
|
287 |
< |
int getSeed(void) { return seed; } |
288 |
< |
void setSeed(int theSeed) { seed = theSeed;} |
287 |
> |
/** Return the total number of the molecule stamps */ |
288 |
> |
int getNMoleculeStamp() { |
289 |
> |
return moleculeStamps_.size(); |
290 |
> |
} |
291 |
> |
/** |
292 |
> |
* Finds a molecule with a specified global index |
293 |
> |
* @return a pointer point to found molecule |
294 |
> |
* @param index |
295 |
> |
*/ |
296 |
> |
Molecule* getMoleculeByGlobalIndex(int index) { |
297 |
> |
MoleculeIterator i; |
298 |
> |
i = molecules_.find(index); |
299 |
|
|
300 |
< |
private: |
300 |
> |
return i != molecules_.end() ? i->second : NULL; |
301 |
> |
} |
302 |
|
|
303 |
< |
SimState* myConfiguration; |
303 |
> |
/** Calculate the maximum cutoff radius based on the atom types */ |
304 |
> |
double calcMaxCutoffRadius(); |
305 |
|
|
306 |
< |
int boxIsInit, haveRcut, haveRsw; |
306 |
> |
double getRcut() { |
307 |
> |
return rcut_; |
308 |
> |
} |
309 |
|
|
310 |
< |
double rList, rCut; // variables for the neighborlist |
311 |
< |
double rSw; // the switching radius |
310 |
> |
double getRsw() { |
311 |
> |
return rsw_; |
312 |
> |
} |
313 |
> |
|
314 |
> |
std::string getFinalConfigFileName() { |
315 |
> |
return finalConfigFileName_; |
316 |
> |
} |
317 |
> |
|
318 |
> |
void setFinalConfigFileName(const std::string& fileName) { |
319 |
> |
finalConfigFileName_ = fileName; |
320 |
> |
} |
321 |
|
|
322 |
< |
double maxCutoff; |
322 |
> |
std::string getDumpFileName() { |
323 |
> |
return dumpFileName_; |
324 |
> |
} |
325 |
> |
|
326 |
> |
void setDumpFileName(const std::string& fileName) { |
327 |
> |
dumpFileName_ = fileName; |
328 |
> |
} |
329 |
|
|
330 |
< |
double distXY; |
331 |
< |
double distYZ; |
332 |
< |
double distZX; |
333 |
< |
|
334 |
< |
void calcHmatInv( void ); |
335 |
< |
void calcBoxL(); |
336 |
< |
double calcMaxCutOff(); |
330 |
> |
std::string getStatFileName() { |
331 |
> |
return statFileName_; |
332 |
> |
} |
333 |
> |
|
334 |
> |
void setStatFileName(const std::string& fileName) { |
335 |
> |
statFileName_ = fileName; |
336 |
> |
} |
337 |
|
|
338 |
< |
// private function to initialize the fortran side of the simulation |
339 |
< |
setFortranSim_TD setFsimulation; |
338 |
> |
/** |
339 |
> |
* Sets GlobalGroupMembership |
340 |
> |
* @see #SimCreator::setGlobalIndex |
341 |
> |
*/ |
342 |
> |
void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) { |
343 |
> |
assert(globalGroupMembership.size() == nGlobalAtoms_); |
344 |
> |
globalGroupMembership_ = globalGroupMembership; |
345 |
> |
} |
346 |
|
|
347 |
< |
setFortranBox_TD setFortranBoxSize; |
348 |
< |
|
349 |
< |
notifyFortranCutOff_TD notifyFortranCutOffs; |
350 |
< |
|
351 |
< |
//Addtional Properties of SimInfo |
352 |
< |
map<string, GenericData*> properties; |
353 |
< |
void getFortranGroupArrays(SimInfo* info, |
354 |
< |
vector<int>& FglobalGroupMembership, |
227 |
< |
vector<double>& mfact); |
347 |
> |
/** |
348 |
> |
* Sets GlobalMolMembership |
349 |
> |
* @see #SimCreator::setGlobalIndex |
350 |
> |
*/ |
351 |
> |
void setGlobalMolMembership(const std::vector<int>& globalMolMembership) { |
352 |
> |
assert(globalMolMembership.size() == nGlobalAtoms_); |
353 |
> |
globalMolMembership_ = globalMolMembership; |
354 |
> |
} |
355 |
|
|
356 |
|
|
357 |
< |
}; |
357 |
> |
bool isFortranInitialized() { |
358 |
> |
return fortranInitialized_; |
359 |
> |
} |
360 |
> |
|
361 |
> |
//below functions are just forward functions |
362 |
> |
//To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the |
363 |
> |
//the other hand, has-a relation need composing. |
364 |
> |
/** |
365 |
> |
* Adds property into property map |
366 |
> |
* @param genData GenericData to be added into PropertyMap |
367 |
> |
*/ |
368 |
> |
void addProperty(GenericData* genData); |
369 |
|
|
370 |
+ |
/** |
371 |
+ |
* Removes property from PropertyMap by name |
372 |
+ |
* @param propName the name of property to be removed |
373 |
+ |
*/ |
374 |
+ |
void removeProperty(const std::string& propName); |
375 |
|
|
376 |
+ |
/** |
377 |
+ |
* clear all of the properties |
378 |
+ |
*/ |
379 |
+ |
void clearProperties(); |
380 |
+ |
|
381 |
+ |
/** |
382 |
+ |
* Returns all names of properties |
383 |
+ |
* @return all names of properties |
384 |
+ |
*/ |
385 |
+ |
std::vector<std::string> getPropertyNames(); |
386 |
+ |
|
387 |
+ |
/** |
388 |
+ |
* Returns all of the properties in PropertyMap |
389 |
+ |
* @return all of the properties in PropertyMap |
390 |
+ |
*/ |
391 |
+ |
std::vector<GenericData*> getProperties(); |
392 |
+ |
|
393 |
+ |
/** |
394 |
+ |
* Returns property |
395 |
+ |
* @param propName name of property |
396 |
+ |
* @return a pointer point to property with propName. If no property named propName |
397 |
+ |
* exists, return NULL |
398 |
+ |
*/ |
399 |
+ |
GenericData* getPropertyByName(const std::string& propName); |
400 |
+ |
|
401 |
+ |
/** |
402 |
+ |
* add all exclude pairs of a molecule into exclude list. |
403 |
+ |
*/ |
404 |
+ |
void addExcludePairs(Molecule* mol); |
405 |
+ |
|
406 |
+ |
/** |
407 |
+ |
* remove all exclude pairs which belong to a molecule from exclude list |
408 |
+ |
*/ |
409 |
+ |
|
410 |
+ |
void removeExcludePairs(Molecule* mol); |
411 |
+ |
|
412 |
+ |
|
413 |
+ |
SelectionManager* getSelectionManager() { |
414 |
+ |
return selectMan_; |
415 |
+ |
} |
416 |
+ |
|
417 |
+ |
/** Returns the unique atom types of local processor in an array */ |
418 |
+ |
std::set<AtomType*> getUniqueAtomTypes(); |
419 |
+ |
|
420 |
+ |
friend std::ostream& operator <<(std::ostream& o, SimInfo& info); |
421 |
+ |
|
422 |
+ |
private: |
423 |
+ |
|
424 |
+ |
/** fill up the simtype struct*/ |
425 |
+ |
void setupSimType(); |
426 |
+ |
|
427 |
+ |
/** |
428 |
+ |
* Setup Fortran Simulation |
429 |
+ |
* @see #setupFortranParallel |
430 |
+ |
*/ |
431 |
+ |
void setupFortranSim(); |
432 |
+ |
|
433 |
+ |
/** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ |
434 |
+ |
void setupCutoff(); |
435 |
+ |
|
436 |
+ |
/** Calculates the number of degress of freedom in the whole system */ |
437 |
+ |
void calcNdf(); |
438 |
+ |
void calcNdfRaw(); |
439 |
+ |
void calcNdfTrans(); |
440 |
+ |
|
441 |
+ |
/** |
442 |
+ |
* Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole |
443 |
+ |
* system. |
444 |
+ |
*/ |
445 |
+ |
void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); |
446 |
+ |
|
447 |
+ |
ForceField* forceField_; |
448 |
+ |
Globals* simParams_; |
449 |
+ |
|
450 |
+ |
std::map<int, Molecule*> molecules_; /**< Molecule array */ |
451 |
+ |
|
452 |
+ |
//degress of freedom |
453 |
+ |
int ndf_; /**< number of degress of freedom (excludes constraints), ndf_ is local */ |
454 |
+ |
int ndfRaw_; /**< number of degress of freedom (includes constraints), ndfRaw_ is local */ |
455 |
+ |
int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ |
456 |
+ |
int nZconstraint_; /** number of z-constraint molecules, nZconstraint_ is global */ |
457 |
+ |
|
458 |
+ |
//number of global objects |
459 |
+ |
int nGlobalMols_; /**< number of molecules in the system */ |
460 |
+ |
int nGlobalAtoms_; /**< number of atoms in the system */ |
461 |
+ |
int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */ |
462 |
+ |
int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ |
463 |
+ |
int nGlobalRigidBodies_; /**< number of rigid bodies in this system */ |
464 |
+ |
/** |
465 |
+ |
* the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
466 |
+ |
* corresponding content is the global index of cutoff group this atom belong to. |
467 |
+ |
* It is filled by SimCreator once and only once, since it never changed during the simulation. |
468 |
+ |
*/ |
469 |
+ |
std::vector<int> globalGroupMembership_; |
470 |
+ |
|
471 |
+ |
/** |
472 |
+ |
* the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
473 |
+ |
* corresponding content is the global index of molecule this atom belong to. |
474 |
+ |
* It is filled by SimCreator once and only once, since it is never changed during the simulation. |
475 |
+ |
*/ |
476 |
+ |
std::vector<int> globalMolMembership_; |
477 |
+ |
|
478 |
+ |
|
479 |
+ |
std::vector<int> molStampIds_; /**< stamp id array of all molecules in the system */ |
480 |
+ |
std::vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
481 |
+ |
|
482 |
+ |
//number of local objects |
483 |
+ |
int nAtoms_; /**< number of atoms in local processor */ |
484 |
+ |
int nBonds_; /**< number of bonds in local processor */ |
485 |
+ |
int nBends_; /**< number of bends in local processor */ |
486 |
+ |
int nTorsions_; /**< number of torsions in local processor */ |
487 |
+ |
int nRigidBodies_; /**< number of rigid bodies in local processor */ |
488 |
+ |
int nIntegrableObjects_; /**< number of integrable objects in local processor */ |
489 |
+ |
int nCutoffGroups_; /**< number of cutoff groups in local processor */ |
490 |
+ |
int nConstraints_; /**< number of constraints in local processors */ |
491 |
+ |
|
492 |
+ |
simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/ |
493 |
+ |
Exclude exclude_; |
494 |
+ |
PropertyMap properties_; /**< Generic Property */ |
495 |
+ |
SnapshotManager* sman_; /**< SnapshotManager */ |
496 |
+ |
|
497 |
+ |
int seed_; /**< seed for random number generator */ |
498 |
+ |
|
499 |
+ |
/** |
500 |
+ |
* The reason to have a local index manager is that when molecule is migrating to other processors, |
501 |
+ |
* the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the |
502 |
+ |
* information of molecule migrating to current processor, Migrator class can query the LocalIndexManager |
503 |
+ |
* to make a efficient data moving plan. |
504 |
+ |
*/ |
505 |
+ |
LocalIndexManager localIndexMan_; |
506 |
+ |
|
507 |
+ |
//file names |
508 |
+ |
std::string finalConfigFileName_; |
509 |
+ |
std::string dumpFileName_; |
510 |
+ |
std::string statFileName_; |
511 |
+ |
|
512 |
+ |
double rcut_; /**< cutoff radius*/ |
513 |
+ |
double rsw_; /**< radius of switching function*/ |
514 |
+ |
|
515 |
+ |
bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */ |
516 |
+ |
|
517 |
+ |
SelectionManager* selectMan_; |
518 |
+ |
#ifdef IS_MPI |
519 |
+ |
//in Parallel version, we need MolToProc |
520 |
+ |
public: |
521 |
+ |
|
522 |
+ |
/** |
523 |
+ |
* Finds the processor where a molecule resides |
524 |
+ |
* @return the id of the processor which contains the molecule |
525 |
+ |
* @param globalIndex global Index of the molecule |
526 |
+ |
*/ |
527 |
+ |
int getMolToProc(int globalIndex) { |
528 |
+ |
//assert(globalIndex < molToProcMap_.size()); |
529 |
+ |
return molToProcMap_[globalIndex]; |
530 |
+ |
} |
531 |
+ |
|
532 |
+ |
/** |
533 |
+ |
* Set MolToProcMap array |
534 |
+ |
* @see #SimCreator::divideMolecules |
535 |
+ |
*/ |
536 |
+ |
void setMolToProcMap(const std::vector<int>& molToProcMap) { |
537 |
+ |
molToProcMap_ = molToProcMap; |
538 |
+ |
} |
539 |
+ |
|
540 |
+ |
private: |
541 |
+ |
|
542 |
+ |
void setupFortranParallel(); |
543 |
+ |
|
544 |
+ |
/** |
545 |
+ |
* The size of molToProcMap_ is equal to total number of molecules in the system. |
546 |
+ |
* It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only |
547 |
+ |
* once. |
548 |
+ |
*/ |
549 |
+ |
std::vector<int> molToProcMap_; |
550 |
+ |
|
551 |
|
#endif |
552 |
+ |
|
553 |
+ |
}; |
554 |
+ |
|
555 |
+ |
} //namespace oopse |
556 |
+ |
#endif //BRAINS_SIMMODEL_HPP |
557 |
+ |
|