# | Line 1 | Line 1 | |
---|---|---|
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" |
64 | < | #include "SimState.hpp" |
16 | < | #include "Restraints.hpp" |
57 | > | #include "brains/PairList.hpp" |
58 | > | #include "io/Globals.hpp" |
59 | > | #include "math/Vector3.hpp" |
60 | > | #include "math/SquareMatrix3.hpp" |
61 | > | #include "types/MoleculeStamp.hpp" |
62 | > | #include "UseTheForce/ForceField.hpp" |
63 | > | #include "utils/PropertyMap.hpp" |
64 | > | #include "utils/LocalIndexManager.hpp" |
65 | ||
66 | + | //another nonsense macro declaration |
67 | #define __C | |
68 | < | #include "fSimulation.h" |
20 | < | #include "fortranWrapDefines.hpp" |
21 | < | #include "GenericData.hpp" |
68 | > | #include "brains/fSimulation.h" |
69 | ||
70 | + | namespace oopse{ |
71 | ||
72 | < | //#include "Minimizer.hpp" |
73 | < | //#include "OOPSEMinimizer.hpp" |
72 | > | //forward decalration |
73 | > | class SnapshotManager; |
74 | > | class Molecule; |
75 | > | class SelectionManager; |
76 | > | class StuntDouble; |
77 | > | /** |
78 | > | * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
79 | > | * @brief One of the heavy weight classes of OOPSE, SimInfo maintains a list of molecules. |
80 | > | * The Molecule class maintains all of the concrete objects |
81 | > | * (atoms, bond, bend, torsions, inversions, rigid bodies, cutoff groups, |
82 | > | * constraints). In both the single and parallel versions, atoms and |
83 | > | * rigid bodies have both global and local indices. The local index is |
84 | > | * not relevant to molecules or cutoff groups. |
85 | > | */ |
86 | > | class SimInfo { |
87 | > | public: |
88 | > | typedef std::map<int, Molecule*>::iterator MoleculeIterator; |
89 | ||
90 | + | /** |
91 | + | * Constructor of SimInfo |
92 | + | * @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the |
93 | + | * second element is the total number of molecules with the same molecule stamp in the system |
94 | + | * @param ff pointer of a concrete ForceField instance |
95 | + | * @param simParams |
96 | + | * @note |
97 | + | */ |
98 | + | SimInfo(ForceField* ff, Globals* simParams); |
99 | + | virtual ~SimInfo(); |
100 | ||
101 | < | double roundMe( double x ); |
102 | < | class OOPSEMinimizer; |
103 | < | class SimInfo{ |
101 | > | /** |
102 | > | * Adds a molecule |
103 | > | * @return return true if adding successfully, return false if the molecule is already in SimInfo |
104 | > | * @param mol molecule to be added |
105 | > | */ |
106 | > | bool addMolecule(Molecule* mol); |
107 | ||
108 | < | public: |
108 | > | /** |
109 | > | * Removes a molecule from SimInfo |
110 | > | * @return true if removing successfully, return false if molecule is not in this SimInfo |
111 | > | */ |
112 | > | bool removeMolecule(Molecule* mol); |
113 | ||
114 | < | SimInfo(); |
115 | < | ~SimInfo(); |
114 | > | /** Returns the total number of molecules in the system. */ |
115 | > | int getNGlobalMolecules() { |
116 | > | return nGlobalMols_; |
117 | > | } |
118 | ||
119 | < | int n_atoms; // the number of atoms |
120 | < | Atom **atoms; // the array of atom objects |
119 | > | /** Returns the total number of atoms in the system. */ |
120 | > | int getNGlobalAtoms() { |
121 | > | return nGlobalAtoms_; |
122 | > | } |
123 | ||
124 | < | vector<RigidBody*> rigidBodies; // A vector of rigid bodies |
125 | < | vector<StuntDouble*> integrableObjects; |
126 | < | |
127 | < | double tau[9]; // the stress tensor |
124 | > | /** Returns the total number of cutoff groups in the system. */ |
125 | > | int getNGlobalCutoffGroups() { |
126 | > | return nGlobalCutoffGroups_; |
127 | > | } |
128 | ||
129 | < | int n_bonds; // number of bends |
130 | < | int n_bends; // number of bends |
131 | < | int n_torsions; // number of torsions |
132 | < | int n_oriented; // number of of atoms with orientation |
133 | < | int ndf; // number of actual degrees of freedom |
134 | < | int ndfRaw; // number of settable degrees of freedom |
135 | < | int ndfTrans; // number of translational degrees of freedom |
52 | < | int nZconstraints; // the number of zConstraints |
129 | > | /** |
130 | > | * Returns the total number of integrable objects (total number of rigid bodies plus the total number |
131 | > | * of atoms which do not belong to the rigid bodies) in the system |
132 | > | */ |
133 | > | int getNGlobalIntegrableObjects() { |
134 | > | return nGlobalIntegrableObjects_; |
135 | > | } |
136 | ||
137 | < | int setTemp; // boolean to set the temperature at each sampleTime |
138 | < | int resetIntegrator; // boolean to reset the integrator |
137 | > | /** |
138 | > | * Returns the total number of integrable objects (total number of rigid bodies plus the total number |
139 | > | * of atoms which do not belong to the rigid bodies) in the system |
140 | > | */ |
141 | > | int getNGlobalRigidBodies() { |
142 | > | return nGlobalRigidBodies_; |
143 | > | } |
144 | ||
145 | < | int n_dipoles; // number of dipoles |
145 | > | int getNGlobalConstraints(); |
146 | > | /** |
147 | > | * Returns the number of local molecules. |
148 | > | * @return the number of local molecules |
149 | > | */ |
150 | > | int getNMolecules() { |
151 | > | return molecules_.size(); |
152 | > | } |
153 | ||
154 | < | int n_exclude; |
155 | < | Exclude* excludes; // the exclude list for ignoring pairs in fortran |
156 | < | int nGlobalExcludes; |
157 | < | int* globalExcludes; // same as above, but these guys participate in |
63 | < | // no long range forces. |
154 | > | /** Returns the number of local atoms */ |
155 | > | unsigned int getNAtoms() { |
156 | > | return nAtoms_; |
157 | > | } |
158 | ||
159 | < | int* identArray; // array of unique identifiers for the atoms |
160 | < | int* molMembershipArray; // map of atom numbers onto molecule numbers |
159 | > | /** Returns the number of local bonds */ |
160 | > | unsigned int getNBonds(){ |
161 | > | return nBonds_; |
162 | > | } |
163 | ||
164 | < | int n_constraints; // the number of constraints on the system |
164 | > | /** Returns the number of local bends */ |
165 | > | unsigned int getNBends() { |
166 | > | return nBends_; |
167 | > | } |
168 | ||
169 | < | int n_SRI; // the number of short range interactions |
169 | > | /** Returns the number of local torsions */ |
170 | > | unsigned int getNTorsions() { |
171 | > | return nTorsions_; |
172 | > | } |
173 | ||
174 | < | double lrPot; // the potential energy from the long range calculations. |
174 | > | /** Returns the number of local torsions */ |
175 | > | unsigned int getNInversions() { |
176 | > | return nInversions_; |
177 | > | } |
178 | > | /** Returns the number of local rigid bodies */ |
179 | > | unsigned int getNRigidBodies() { |
180 | > | return nRigidBodies_; |
181 | > | } |
182 | ||
183 | < | double Hmat[3][3]; // the periodic boundry conditions. The Hmat is the |
184 | < | // column vectors of the x, y, and z box vectors. |
185 | < | // h1 h2 h3 |
186 | < | // [ Xx Yx Zx ] |
78 | < | // [ Xy Yy Zy ] |
79 | < | // [ Xz Yz Zz ] |
80 | < | // |
81 | < | double HmatInv[3][3]; |
183 | > | /** Returns the number of local integrable objects */ |
184 | > | unsigned int getNIntegrableObjects() { |
185 | > | return nIntegrableObjects_; |
186 | > | } |
187 | ||
188 | < | double boxL[3]; // The Lengths of the 3 column vectors of Hmat |
189 | < | double boxVol; |
190 | < | int orthoRhombic; |
191 | < | |
188 | > | /** Returns the number of local cutoff groups */ |
189 | > | unsigned int getNCutoffGroups() { |
190 | > | return nCutoffGroups_; |
191 | > | } |
192 | ||
193 | < | double dielectric; // the dielectric of the medium for reaction field |
193 | > | /** Returns the total number of constraints in this SimInfo */ |
194 | > | unsigned int getNConstraints() { |
195 | > | return nConstraints_; |
196 | > | } |
197 | > | |
198 | > | /** |
199 | > | * Returns the first molecule in this SimInfo and intialize the iterator. |
200 | > | * @return the first molecule, return NULL if there is not molecule in this SimInfo |
201 | > | * @param i the iterator of molecule array (user shouldn't change it) |
202 | > | */ |
203 | > | Molecule* beginMolecule(MoleculeIterator& i); |
204 | ||
205 | < | |
206 | < | int usePBC; // whether we use periodic boundry conditions. |
207 | < | int useLJ; |
208 | < | int useSticky; |
209 | < | int useCharges; |
210 | < | int useDipoles; |
96 | < | int useReactionField; |
97 | < | int useGB; |
98 | < | int useEAM; |
99 | < | bool haveCutoffGroups; |
100 | < | bool useInitXSstate; |
101 | < | double orthoTolerance; |
205 | > | /** |
206 | > | * Returns the next avaliable Molecule based on the iterator. |
207 | > | * @return the next avaliable molecule, return NULL if reaching the end of the array |
208 | > | * @param i the iterator of molecule array |
209 | > | */ |
210 | > | Molecule* nextMolecule(MoleculeIterator& i); |
211 | ||
212 | < | double dt, run_time; // the time step and total time |
213 | < | double sampleTime, statusTime; // the position and energy dump frequencies |
214 | < | double target_temp; // the target temperature of the system |
215 | < | 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; |
212 | > | /** Returns the number of degrees of freedom */ |
213 | > | int getNdf() { |
214 | > | return ndf_ - getFdf(); |
215 | > | } |
216 | ||
217 | < | int n_mol; // n_molecules; |
218 | < | Molecule* molecules; // the array of molecules |
219 | < | |
220 | < | 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 |
217 | > | /** Returns the number of raw degrees of freedom */ |
218 | > | int getNdfRaw() { |
219 | > | return ndfRaw_; |
220 | > | } |
221 | ||
222 | < | OOPSEMinimizer* the_minimizer; // the energy minimizer |
223 | < | Restraints* restraint; |
224 | < | bool has_minimizer; |
222 | > | /** Returns the number of translational degrees of freedom */ |
223 | > | int getNdfTrans() { |
224 | > | return ndfTrans_; |
225 | > | } |
226 | ||
227 | < | string finalName; // the name of the eor file to be written |
228 | < | string sampleName; // the name of the dump file to be written |
229 | < | string statusName; // the name of the stat file to be written |
227 | > | /** sets the current number of frozen degrees of freedom */ |
228 | > | void setFdf(int fdf) { |
229 | > | fdf_local = fdf; |
230 | > | } |
231 | ||
232 | < | int seed; //seed for random number generator |
232 | > | int getFdf(); |
233 | > | |
234 | > | //getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying |
235 | > | |
236 | > | /** Returns the total number of z-constraint molecules in the system */ |
237 | > | int getNZconstraint() { |
238 | > | return nZconstraint_; |
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 | > | /** |
242 | > | * Sets the number of z-constraint molecules in the system. |
243 | > | */ |
244 | > | void setNZconstraint(int nZconstraint) { |
245 | > | nZconstraint_ = nZconstraint; |
246 | > | } |
247 | > | |
248 | > | /** Returns the snapshot manager. */ |
249 | > | SnapshotManager* getSnapshotManager() { |
250 | > | return sman_; |
251 | > | } |
252 | ||
253 | < | vector<double> mfact; |
254 | < | vector<int> FglobalGroupMembership; |
255 | < | int ngroup; |
256 | < | int* globalGroupMembership; |
253 | > | /** Sets the snapshot manager. */ |
254 | > | void setSnapshotManager(SnapshotManager* sman); |
255 | > | |
256 | > | /** Returns the force field */ |
257 | > | ForceField* getForceField() { |
258 | > | return forceField_; |
259 | > | } |
260 | ||
261 | < | // refreshes the sim if things get changed (load balanceing, volume |
262 | < | // adjustment, etc.) |
261 | > | Globals* getSimParams() { |
262 | > | return simParams_; |
263 | > | } |
264 | ||
265 | < | void refreshSim( void ); |
266 | < | |
265 | > | /** Returns the velocity of center of mass of the whole system.*/ |
266 | > | Vector3d getComVel(); |
267 | ||
268 | < | // sets the internal function pointer to fortran. |
268 | > | /** Returns the center of the mass of the whole system.*/ |
269 | > | Vector3d getCom(); |
270 | > | /** Returns the center of the mass and Center of Mass velocity of the whole system.*/ |
271 | > | void getComAll(Vector3d& com,Vector3d& comVel); |
272 | ||
273 | < | void setInternal( setFortranSim_TD fSetup, |
274 | < | setFortranBox_TD fBox, |
275 | < | notifyFortranCutOff_TD fCut){ |
276 | < | setFsimulation = fSetup; |
277 | < | setFortranBoxSize = fBox; |
160 | < | notifyFortranCutOffs = fCut; |
161 | < | } |
273 | > | /** Returns intertia tensor for the entire system and system Angular Momentum.*/ |
274 | > | void getInertiaTensor(Mat3x3d &intertiaTensor,Vector3d &angularMomentum); |
275 | > | |
276 | > | /** Returns system angular momentum */ |
277 | > | Vector3d getAngularMomentum(); |
278 | ||
279 | < | int getNDF(); |
280 | < | int getNDFraw(); |
281 | < | int getNDFtranslational(); |
282 | < | int getTotIntegrableObjects(); |
283 | < | void setBox( double newBox[3] ); |
284 | < | 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 ); |
279 | > | /** Returns volume of system as estimated by an ellipsoid defined by the radii of gyration*/ |
280 | > | void getGyrationalVolume(RealType &vol); |
281 | > | /** Overloaded version of gyrational volume that also returns det(I) so dV/dr can be calculated*/ |
282 | > | void getGyrationalVolume(RealType &vol, RealType &detI); |
283 | > | /** main driver function to interact with fortran during the initialization and molecule migration */ |
284 | > | void update(); |
285 | ||
286 | < | double getRcut( void ) { return rCut; } |
287 | < | double getRlist( void ) { return rList; } |
288 | < | double getRsw( void ) { return rSw; } |
289 | < | 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] ); |
286 | > | /** Returns the local index manager */ |
287 | > | LocalIndexManager* getLocalIndexManager() { |
288 | > | return &localIndexMan_; |
289 | > | } |
290 | ||
291 | < | SimState* getConfiguration( void ) { return myConfiguration; } |
292 | < | |
293 | < | void addProperty(GenericData* prop); |
294 | < | GenericData* getProperty(const string& propName); |
192 | < | //vector<GenericData*>& getProperties() {return properties;} |
291 | > | int getMoleculeStampId(int globalIndex) { |
292 | > | //assert(globalIndex < molStampIds_.size()) |
293 | > | return molStampIds_[globalIndex]; |
294 | > | } |
295 | ||
296 | < | int getSeed(void) { return seed; } |
297 | < | void setSeed(int theSeed) { seed = theSeed;} |
296 | > | /** Returns the molecule stamp */ |
297 | > | MoleculeStamp* getMoleculeStamp(int id) { |
298 | > | return moleculeStamps_[id]; |
299 | > | } |
300 | ||
301 | < | private: |
301 | > | /** Return the total number of the molecule stamps */ |
302 | > | int getNMoleculeStamp() { |
303 | > | return moleculeStamps_.size(); |
304 | > | } |
305 | > | /** |
306 | > | * Finds a molecule with a specified global index |
307 | > | * @return a pointer point to found molecule |
308 | > | * @param index |
309 | > | */ |
310 | > | Molecule* getMoleculeByGlobalIndex(int index) { |
311 | > | MoleculeIterator i; |
312 | > | i = molecules_.find(index); |
313 | ||
314 | < | SimState* myConfiguration; |
314 | > | return i != molecules_.end() ? i->second : NULL; |
315 | > | } |
316 | ||
317 | < | int boxIsInit, haveRcut, haveRsw; |
317 | > | RealType getRcut() { |
318 | > | return rcut_; |
319 | > | } |
320 | ||
321 | < | double rList, rCut; // variables for the neighborlist |
322 | < | double rSw; // the switching radius |
321 | > | RealType getRsw() { |
322 | > | return rsw_; |
323 | > | } |
324 | ||
325 | < | double maxCutoff; |
325 | > | RealType getList() { |
326 | > | return rlist_; |
327 | > | } |
328 | > | |
329 | > | std::string getFinalConfigFileName() { |
330 | > | return finalConfigFileName_; |
331 | > | } |
332 | ||
333 | < | double distXY; |
334 | < | double distYZ; |
335 | < | double distZX; |
211 | < | |
212 | < | void calcHmatInv( void ); |
213 | < | void calcBoxL(); |
214 | < | double calcMaxCutOff(); |
333 | > | void setFinalConfigFileName(const std::string& fileName) { |
334 | > | finalConfigFileName_ = fileName; |
335 | > | } |
336 | ||
337 | < | // private function to initialize the fortran side of the simulation |
338 | < | setFortranSim_TD setFsimulation; |
337 | > | std::string getRawMetaData() { |
338 | > | return rawMetaData_; |
339 | > | } |
340 | > | void setRawMetaData(const std::string& rawMetaData) { |
341 | > | rawMetaData_ = rawMetaData; |
342 | > | } |
343 | > | |
344 | > | std::string getDumpFileName() { |
345 | > | return dumpFileName_; |
346 | > | } |
347 | > | |
348 | > | void setDumpFileName(const std::string& fileName) { |
349 | > | dumpFileName_ = fileName; |
350 | > | } |
351 | ||
352 | < | setFortranBox_TD setFortranBoxSize; |
353 | < | |
354 | < | notifyFortranCutOff_TD notifyFortranCutOffs; |
355 | < | |
356 | < | //Addtional Properties of SimInfo |
357 | < | map<string, GenericData*> properties; |
358 | < | void getFortranGroupArrays(SimInfo* info, |
359 | < | vector<int>& FglobalGroupMembership, |
360 | < | vector<double>& mfact); |
352 | > | std::string getStatFileName() { |
353 | > | return statFileName_; |
354 | > | } |
355 | > | |
356 | > | void setStatFileName(const std::string& fileName) { |
357 | > | statFileName_ = fileName; |
358 | > | } |
359 | > | |
360 | > | std::string getRestFileName() { |
361 | > | return restFileName_; |
362 | > | } |
363 | > | |
364 | > | void setRestFileName(const std::string& fileName) { |
365 | > | restFileName_ = fileName; |
366 | > | } |
367 | ||
368 | + | /** |
369 | + | * Sets GlobalGroupMembership |
370 | + | * @see #SimCreator::setGlobalIndex |
371 | + | */ |
372 | + | void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) { |
373 | + | assert(globalGroupMembership.size() == static_cast<size_t>(nGlobalAtoms_)); |
374 | + | globalGroupMembership_ = globalGroupMembership; |
375 | + | } |
376 | ||
377 | < | }; |
377 | > | /** |
378 | > | * Sets GlobalMolMembership |
379 | > | * @see #SimCreator::setGlobalIndex |
380 | > | */ |
381 | > | void setGlobalMolMembership(const std::vector<int>& globalMolMembership) { |
382 | > | assert(globalMolMembership.size() == static_cast<size_t>(nGlobalAtoms_)); |
383 | > | globalMolMembership_ = globalMolMembership; |
384 | > | } |
385 | ||
386 | ||
387 | < | #endif |
387 | > | bool isFortranInitialized() { |
388 | > | return fortranInitialized_; |
389 | > | } |
390 | > | |
391 | > | bool getCalcBoxDipole() { |
392 | > | return calcBoxDipole_; |
393 | > | } |
394 | > | |
395 | > | bool getUseAtomicVirial() { |
396 | > | return useAtomicVirial_; |
397 | > | } |
398 | > | |
399 | > | //below functions are just forward functions |
400 | > | //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the |
401 | > | //the other hand, has-a relation need composing. |
402 | > | /** |
403 | > | * Adds property into property map |
404 | > | * @param genData GenericData to be added into PropertyMap |
405 | > | */ |
406 | > | void addProperty(GenericData* genData); |
407 | > | |
408 | > | /** |
409 | > | * Removes property from PropertyMap by name |
410 | > | * @param propName the name of property to be removed |
411 | > | */ |
412 | > | void removeProperty(const std::string& propName); |
413 | > | |
414 | > | /** |
415 | > | * clear all of the properties |
416 | > | */ |
417 | > | void clearProperties(); |
418 | > | |
419 | > | /** |
420 | > | * Returns all names of properties |
421 | > | * @return all names of properties |
422 | > | */ |
423 | > | std::vector<std::string> getPropertyNames(); |
424 | > | |
425 | > | /** |
426 | > | * Returns all of the properties in PropertyMap |
427 | > | * @return all of the properties in PropertyMap |
428 | > | */ |
429 | > | std::vector<GenericData*> getProperties(); |
430 | > | |
431 | > | /** |
432 | > | * Returns property |
433 | > | * @param propName name of property |
434 | > | * @return a pointer point to property with propName. If no property named propName |
435 | > | * exists, return NULL |
436 | > | */ |
437 | > | GenericData* getPropertyByName(const std::string& propName); |
438 | > | |
439 | > | /** |
440 | > | * add all special interaction pairs (including excluded |
441 | > | * interactions) in a molecule into the appropriate lists. |
442 | > | */ |
443 | > | void addInteractionPairs(Molecule* mol); |
444 | > | |
445 | > | /** |
446 | > | * remove all special interaction pairs which belong to a molecule |
447 | > | * from the appropriate lists. |
448 | > | */ |
449 | > | void removeInteractionPairs(Molecule* mol); |
450 | > | |
451 | > | |
452 | > | /** Returns the unique atom types of local processor in an array */ |
453 | > | std::set<AtomType*> getUniqueAtomTypes(); |
454 | > | |
455 | > | friend std::ostream& operator <<(std::ostream& o, SimInfo& info); |
456 | > | |
457 | > | void getCutoff(RealType& rcut, RealType& rsw); |
458 | > | |
459 | > | private: |
460 | > | |
461 | > | /** fill up the simtype struct*/ |
462 | > | void setupSimType(); |
463 | > | |
464 | > | /** |
465 | > | * Setup Fortran Simulation |
466 | > | * @see #setupFortranParallel |
467 | > | */ |
468 | > | void setupFortranSim(); |
469 | > | |
470 | > | /** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ |
471 | > | void setupCutoff(); |
472 | > | |
473 | > | /** Figure out which coulombic correction method to use and pass to fortran */ |
474 | > | void setupElectrostaticSummationMethod( int isError ); |
475 | > | |
476 | > | /** Figure out which polynomial type to use for the switching function */ |
477 | > | void setupSwitchingFunction(); |
478 | > | |
479 | > | /** Determine if we need to accumulate the simulation box dipole */ |
480 | > | void setupAccumulateBoxDipole(); |
481 | > | |
482 | > | /** Calculates the number of degress of freedom in the whole system */ |
483 | > | void calcNdf(); |
484 | > | void calcNdfRaw(); |
485 | > | void calcNdfTrans(); |
486 | > | |
487 | > | ForceField* forceField_; |
488 | > | Globals* simParams_; |
489 | > | |
490 | > | std::map<int, Molecule*> molecules_; /**< Molecule array */ |
491 | > | |
492 | > | /** |
493 | > | * Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole |
494 | > | * system. |
495 | > | */ |
496 | > | void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); |
497 | > | |
498 | > | //degress of freedom |
499 | > | int ndf_; /**< number of degress of freedom (excludes constraints), ndf_ is local */ |
500 | > | int fdf_local; /**< number of frozen degrees of freedom */ |
501 | > | int fdf_; /**< number of frozen degrees of freedom */ |
502 | > | int ndfRaw_; /**< number of degress of freedom (includes constraints), ndfRaw_ is local */ |
503 | > | int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ |
504 | > | int nZconstraint_; /** number of z-constraint molecules, nZconstraint_ is global */ |
505 | > | |
506 | > | //number of global objects |
507 | > | int nGlobalMols_; /**< number of molecules in the system */ |
508 | > | int nGlobalAtoms_; /**< number of atoms in the system */ |
509 | > | int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */ |
510 | > | int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ |
511 | > | int nGlobalRigidBodies_; /**< number of rigid bodies in this system */ |
512 | > | /** |
513 | > | * the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
514 | > | * corresponding content is the global index of cutoff group this atom belong to. |
515 | > | * It is filled by SimCreator once and only once, since it never changed during the simulation. |
516 | > | */ |
517 | > | std::vector<int> globalGroupMembership_; |
518 | > | |
519 | > | /** |
520 | > | * the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
521 | > | * corresponding content is the global index of molecule this atom belong to. |
522 | > | * It is filled by SimCreator once and only once, since it is never changed during the simulation. |
523 | > | */ |
524 | > | std::vector<int> globalMolMembership_; |
525 | > | |
526 | > | |
527 | > | std::vector<int> molStampIds_; /**< stamp id array of all molecules in the system */ |
528 | > | std::vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
529 | > | |
530 | > | //number of local objects |
531 | > | int nAtoms_; /**< number of atoms in local processor */ |
532 | > | int nBonds_; /**< number of bonds in local processor */ |
533 | > | int nBends_; /**< number of bends in local processor */ |
534 | > | int nTorsions_; /**< number of torsions in local processor */ |
535 | > | int nInversions_; /**< number of inversions in local processor */ |
536 | > | int nRigidBodies_; /**< number of rigid bodies in local processor */ |
537 | > | int nIntegrableObjects_; /**< number of integrable objects in local processor */ |
538 | > | int nCutoffGroups_; /**< number of cutoff groups in local processor */ |
539 | > | int nConstraints_; /**< number of constraints in local processors */ |
540 | > | |
541 | > | simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/ |
542 | > | PairList excludedInteractions_; |
543 | > | PairList oneTwoInteractions_; |
544 | > | PairList oneThreeInteractions_; |
545 | > | PairList oneFourInteractions_; |
546 | > | PropertyMap properties_; /**< Generic Property */ |
547 | > | SnapshotManager* sman_; /**< SnapshotManager */ |
548 | > | |
549 | > | /** |
550 | > | * The reason to have a local index manager is that when molecule is migrating to other processors, |
551 | > | * the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the |
552 | > | * information of molecule migrating to current processor, Migrator class can query the LocalIndexManager |
553 | > | * to make a efficient data moving plan. |
554 | > | */ |
555 | > | LocalIndexManager localIndexMan_; |
556 | > | |
557 | > | // unparsed MetaData block for storing in Dump and EOR files: |
558 | > | std::string rawMetaData_; |
559 | > | |
560 | > | //file names |
561 | > | std::string finalConfigFileName_; |
562 | > | std::string dumpFileName_; |
563 | > | std::string statFileName_; |
564 | > | std::string restFileName_; |
565 | > | |
566 | > | RealType rcut_; /**< cutoff radius*/ |
567 | > | RealType rsw_; /**< radius of switching function*/ |
568 | > | RealType rlist_; /**< neighbor list radius */ |
569 | > | |
570 | > | bool ljsp_; /**< use shifted potential for LJ*/ |
571 | > | bool ljsf_; /**< use shifted force for LJ*/ |
572 | > | |
573 | > | bool fortranInitialized_; /**< flag indicate whether fortran side |
574 | > | is initialized */ |
575 | > | |
576 | > | bool calcBoxDipole_; /**< flag to indicate whether or not we calculate |
577 | > | the simulation box dipole moment */ |
578 | > | |
579 | > | bool useAtomicVirial_; /**< flag to indicate whether or not we use |
580 | > | Atomic Virials to calculate the pressure */ |
581 | > | |
582 | > | public: |
583 | > | /** |
584 | > | * return an integral objects by its global index. In MPI version, if the StuntDouble with specified |
585 | > | * global index does not belong to local processor, a NULL will be return. |
586 | > | */ |
587 | > | StuntDouble* getIOIndexToIntegrableObject(int index); |
588 | > | void setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v); |
589 | > | private: |
590 | > | std::vector<StuntDouble*> IOIndexToIntegrableObject; |
591 | > | //public: |
592 | > | //void setStuntDoubleFromGlobalIndex(std::vector<StuntDouble*> v); |
593 | > | /** |
594 | > | * return a StuntDouble by its global index. In MPI version, if the StuntDouble with specified |
595 | > | * global index does not belong to local processor, a NULL will be return. |
596 | > | */ |
597 | > | //StuntDouble* getStuntDoubleFromGlobalIndex(int index); |
598 | > | //private: |
599 | > | //std::vector<StuntDouble*> sdByGlobalIndex_; |
600 | > | |
601 | > | //in Parallel version, we need MolToProc |
602 | > | public: |
603 | > | |
604 | > | /** |
605 | > | * Finds the processor where a molecule resides |
606 | > | * @return the id of the processor which contains the molecule |
607 | > | * @param globalIndex global Index of the molecule |
608 | > | */ |
609 | > | int getMolToProc(int globalIndex) { |
610 | > | //assert(globalIndex < molToProcMap_.size()); |
611 | > | return molToProcMap_[globalIndex]; |
612 | > | } |
613 | > | |
614 | > | /** |
615 | > | * Set MolToProcMap array |
616 | > | * @see #SimCreator::divideMolecules |
617 | > | */ |
618 | > | void setMolToProcMap(const std::vector<int>& molToProcMap) { |
619 | > | molToProcMap_ = molToProcMap; |
620 | > | } |
621 | > | |
622 | > | private: |
623 | > | |
624 | > | void setupFortranParallel(); |
625 | > | |
626 | > | /** |
627 | > | * The size of molToProcMap_ is equal to total number of molecules |
628 | > | * in the system. It maps a molecule to the processor on which it |
629 | > | * resides. it is filled by SimCreator once and only once. |
630 | > | */ |
631 | > | std::vector<int> molToProcMap_; |
632 | > | |
633 | > | |
634 | > | }; |
635 | > | |
636 | > | } //namespace oopse |
637 | > | #endif //BRAINS_SIMMODEL_HPP |
638 | > |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |