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. Redistributions of source code must retain the above copyright |
10 |
> |
* notice, this list of conditions and the following disclaimer. |
11 |
> |
* |
12 |
> |
* 2. Redistributions in binary form must reproduce the above copyright |
13 |
> |
* notice, this list of conditions and the following disclaimer in the |
14 |
> |
* documentation and/or other materials provided with the |
15 |
> |
* distribution. |
16 |
> |
* |
17 |
> |
* This software is provided "AS IS," without a warranty of any |
18 |
> |
* kind. All express or implied conditions, representations and |
19 |
> |
* warranties, including any implied warranty of merchantability, |
20 |
> |
* fitness for a particular purpose or non-infringement, are hereby |
21 |
> |
* excluded. The University of Notre Dame and its licensors shall not |
22 |
> |
* be liable for any damages suffered by licensee as a result of |
23 |
> |
* using, modifying or distributing the software or its |
24 |
> |
* derivatives. In no event will the University of Notre Dame or its |
25 |
> |
* licensors be liable for any lost revenue, profit or data, or for |
26 |
> |
* direct, indirect, special, consequential, incidental or punitive |
27 |
> |
* damages, however caused and regardless of the theory of liability, |
28 |
> |
* arising out of the use of or inability to use software, even if the |
29 |
> |
* University of Notre Dame has been advised of the possibility of |
30 |
> |
* such damages. |
31 |
> |
* |
32 |
> |
* SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your |
33 |
> |
* research, please cite the appropriate papers when you publish your |
34 |
> |
* work. Good starting points are: |
35 |
> |
* |
36 |
> |
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
37 |
> |
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
38 |
> |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
39 |
> |
* [4] Vardeman & Gezelter, in progress (2009). |
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 "primitives/Atom.hpp" |
58 |
< |
#include "primitives/RigidBody.hpp" |
59 |
< |
#include "primitives/Molecule.hpp" |
60 |
< |
#include "brains/Exclude.hpp" |
61 |
< |
#include "brains/SkipList.hpp" |
62 |
< |
#include "primitives/AbstractClasses.hpp" |
63 |
< |
#include "types/MakeStamps.hpp" |
64 |
< |
#include "brains/SimState.hpp" |
65 |
< |
#include "restraints/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 |
> |
#include "nonbonded/SwitchingFunction.hpp" |
66 |
|
|
67 |
< |
#define __C |
67 |
> |
//another nonsense macro declaration |
68 |
> |
#define __OPENMD_C |
69 |
|
#include "brains/fSimulation.h" |
20 |
– |
#include "UseTheForce/fortranWrapDefines.hpp" |
21 |
– |
#include "utils/GenericData.hpp" |
70 |
|
|
71 |
+ |
using namespace std; |
72 |
+ |
namespace OpenMD{ |
73 |
+ |
//forward decalration |
74 |
+ |
class SnapshotManager; |
75 |
+ |
class Molecule; |
76 |
+ |
class SelectionManager; |
77 |
+ |
class StuntDouble; |
78 |
|
|
79 |
< |
//#include "Minimizer.hpp" |
80 |
< |
//#include "minimizers/OOPSEMinimizer.hpp" |
79 |
> |
/** |
80 |
> |
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
81 |
> |
* |
82 |
> |
* @brief One of the heavy-weight classes of OpenMD, SimInfo |
83 |
> |
* maintains objects and variables relating to the current |
84 |
> |
* simulation. This includes the master list of Molecules. The |
85 |
> |
* Molecule class maintains all of the concrete objects (Atoms, |
86 |
> |
* Bond, Bend, Torsions, Inversions, RigidBodies, CutoffGroups, |
87 |
> |
* Constraints). In both the single and parallel versions, Atoms and |
88 |
> |
* RigidBodies have both global and local indices. |
89 |
> |
*/ |
90 |
> |
class SimInfo { |
91 |
> |
public: |
92 |
> |
typedef map<int, Molecule*>::iterator MoleculeIterator; |
93 |
> |
|
94 |
> |
/** |
95 |
> |
* Constructor of SimInfo |
96 |
> |
* |
97 |
> |
* @param molStampPairs MoleculeStamp Array. The first element of |
98 |
> |
* the pair is molecule stamp, the second element is the total |
99 |
> |
* number of molecules with the same molecule stamp in the system |
100 |
> |
* |
101 |
> |
* @param ff pointer of a concrete ForceField instance |
102 |
> |
* |
103 |
> |
* @param simParams |
104 |
> |
*/ |
105 |
> |
SimInfo(ForceField* ff, Globals* simParams); |
106 |
> |
virtual ~SimInfo(); |
107 |
|
|
108 |
+ |
/** |
109 |
+ |
* Adds a molecule |
110 |
+ |
* |
111 |
+ |
* @return return true if adding successfully, return false if the |
112 |
+ |
* molecule is already in SimInfo |
113 |
+ |
* |
114 |
+ |
* @param mol molecule to be added |
115 |
+ |
*/ |
116 |
+ |
bool addMolecule(Molecule* mol); |
117 |
|
|
118 |
< |
double roundMe( double x ); |
119 |
< |
class OOPSEMinimizer; |
120 |
< |
class SimInfo{ |
118 |
> |
/** |
119 |
> |
* Removes a molecule from SimInfo |
120 |
> |
* |
121 |
> |
* @return true if removing successfully, return false if molecule |
122 |
> |
* is not in this SimInfo |
123 |
> |
*/ |
124 |
> |
bool removeMolecule(Molecule* mol); |
125 |
|
|
126 |
< |
public: |
126 |
> |
/** Returns the total number of molecules in the system. */ |
127 |
> |
int getNGlobalMolecules() { |
128 |
> |
return nGlobalMols_; |
129 |
> |
} |
130 |
|
|
131 |
< |
SimInfo(); |
132 |
< |
~SimInfo(); |
131 |
> |
/** Returns the total number of atoms in the system. */ |
132 |
> |
int getNGlobalAtoms() { |
133 |
> |
return nGlobalAtoms_; |
134 |
> |
} |
135 |
|
|
136 |
< |
int n_atoms; // the number of atoms |
137 |
< |
Atom **atoms; // the array of atom objects |
136 |
> |
/** Returns the total number of cutoff groups in the system. */ |
137 |
> |
int getNGlobalCutoffGroups() { |
138 |
> |
return nGlobalCutoffGroups_; |
139 |
> |
} |
140 |
|
|
141 |
< |
vector<RigidBody*> rigidBodies; // A vector of rigid bodies |
142 |
< |
vector<StuntDouble*> integrableObjects; |
143 |
< |
|
144 |
< |
double tau[9]; // the stress tensor |
141 |
> |
/** |
142 |
> |
* Returns the total number of integrable objects (total number of |
143 |
> |
* rigid bodies plus the total number of atoms which do not belong |
144 |
> |
* to the rigid bodies) in the system |
145 |
> |
*/ |
146 |
> |
int getNGlobalIntegrableObjects() { |
147 |
> |
return nGlobalIntegrableObjects_; |
148 |
> |
} |
149 |
|
|
150 |
< |
int n_bonds; // number of bends |
151 |
< |
int n_bends; // number of bends |
152 |
< |
int n_torsions; // number of torsions |
153 |
< |
int n_oriented; // number of of atoms with orientation |
154 |
< |
int ndf; // number of actual degrees of freedom |
155 |
< |
int ndfRaw; // number of settable degrees of freedom |
156 |
< |
int ndfTrans; // number of translational degrees of freedom |
157 |
< |
int nZconstraints; // the number of zConstraints |
150 |
> |
/** |
151 |
> |
* Returns the total number of integrable objects (total number of |
152 |
> |
* rigid bodies plus the total number of atoms which do not belong |
153 |
> |
* to the rigid bodies) in the system |
154 |
> |
*/ |
155 |
> |
int getNGlobalRigidBodies() { |
156 |
> |
return nGlobalRigidBodies_; |
157 |
> |
} |
158 |
|
|
159 |
< |
int setTemp; // boolean to set the temperature at each sampleTime |
160 |
< |
int resetIntegrator; // boolean to reset the integrator |
159 |
> |
int getNGlobalConstraints(); |
160 |
> |
/** |
161 |
> |
* Returns the number of local molecules. |
162 |
> |
* @return the number of local molecules |
163 |
> |
*/ |
164 |
> |
int getNMolecules() { |
165 |
> |
return molecules_.size(); |
166 |
> |
} |
167 |
|
|
168 |
< |
int n_dipoles; // number of dipoles |
168 |
> |
/** Returns the number of local atoms */ |
169 |
> |
unsigned int getNAtoms() { |
170 |
> |
return nAtoms_; |
171 |
> |
} |
172 |
|
|
173 |
< |
int n_exclude; |
174 |
< |
Exclude* excludes; // the exclude list for ignoring pairs in fortran |
175 |
< |
int nGlobalExcludes; |
176 |
< |
int* globalExcludes; // same as above, but these guys participate in |
63 |
< |
// no long range forces. |
173 |
> |
/** Returns the number of local bonds */ |
174 |
> |
unsigned int getNBonds(){ |
175 |
> |
return nBonds_; |
176 |
> |
} |
177 |
|
|
178 |
< |
int* identArray; // array of unique identifiers for the atoms |
179 |
< |
int* molMembershipArray; // map of atom numbers onto molecule numbers |
178 |
> |
/** Returns the number of local bends */ |
179 |
> |
unsigned int getNBends() { |
180 |
> |
return nBends_; |
181 |
> |
} |
182 |
|
|
183 |
< |
int n_constraints; // the number of constraints on the system |
183 |
> |
/** Returns the number of local torsions */ |
184 |
> |
unsigned int getNTorsions() { |
185 |
> |
return nTorsions_; |
186 |
> |
} |
187 |
|
|
188 |
< |
int n_SRI; // the number of short range interactions |
188 |
> |
/** Returns the number of local torsions */ |
189 |
> |
unsigned int getNInversions() { |
190 |
> |
return nInversions_; |
191 |
> |
} |
192 |
> |
/** Returns the number of local rigid bodies */ |
193 |
> |
unsigned int getNRigidBodies() { |
194 |
> |
return nRigidBodies_; |
195 |
> |
} |
196 |
|
|
197 |
< |
double lrPot; // the potential energy from the long range calculations. |
197 |
> |
/** Returns the number of local integrable objects */ |
198 |
> |
unsigned int getNIntegrableObjects() { |
199 |
> |
return nIntegrableObjects_; |
200 |
> |
} |
201 |
|
|
202 |
< |
double Hmat[3][3]; // the periodic boundry conditions. The Hmat is the |
203 |
< |
// column vectors of the x, y, and z box vectors. |
204 |
< |
// h1 h2 h3 |
205 |
< |
// [ Xx Yx Zx ] |
78 |
< |
// [ Xy Yy Zy ] |
79 |
< |
// [ Xz Yz Zz ] |
80 |
< |
// |
81 |
< |
double HmatInv[3][3]; |
202 |
> |
/** Returns the number of local cutoff groups */ |
203 |
> |
unsigned int getNCutoffGroups() { |
204 |
> |
return nCutoffGroups_; |
205 |
> |
} |
206 |
|
|
207 |
< |
double boxL[3]; // The Lengths of the 3 column vectors of Hmat |
208 |
< |
double boxVol; |
209 |
< |
int orthoRhombic; |
210 |
< |
|
207 |
> |
/** Returns the total number of constraints in this SimInfo */ |
208 |
> |
unsigned int getNConstraints() { |
209 |
> |
return nConstraints_; |
210 |
> |
} |
211 |
> |
|
212 |
> |
/** |
213 |
> |
* Returns the first molecule in this SimInfo and intialize the iterator. |
214 |
> |
* @return the first molecule, return NULL if there is not molecule in this SimInfo |
215 |
> |
* @param i the iterator of molecule array (user shouldn't change it) |
216 |
> |
*/ |
217 |
> |
Molecule* beginMolecule(MoleculeIterator& i); |
218 |
|
|
219 |
< |
double dielectric; // the dielectric of the medium for reaction field |
219 |
> |
/** |
220 |
> |
* Returns the next avaliable Molecule based on the iterator. |
221 |
> |
* @return the next avaliable molecule, return NULL if reaching the end of the array |
222 |
> |
* @param i the iterator of molecule array |
223 |
> |
*/ |
224 |
> |
Molecule* nextMolecule(MoleculeIterator& i); |
225 |
|
|
226 |
< |
|
227 |
< |
int usePBC; // whether we use periodic boundry conditions. |
228 |
< |
int useLJ; |
229 |
< |
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; |
226 |
> |
/** Returns the number of degrees of freedom */ |
227 |
> |
int getNdf() { |
228 |
> |
return ndf_ - getFdf(); |
229 |
> |
} |
230 |
|
|
231 |
< |
double dt, run_time; // the time step and total time |
232 |
< |
double sampleTime, statusTime; // the position and energy dump frequencies |
233 |
< |
double target_temp; // the target temperature of the system |
234 |
< |
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; |
231 |
> |
/** Returns the number of raw degrees of freedom */ |
232 |
> |
int getNdfRaw() { |
233 |
> |
return ndfRaw_; |
234 |
> |
} |
235 |
|
|
236 |
< |
int n_mol; // n_molecules; |
237 |
< |
Molecule* molecules; // the array of molecules |
238 |
< |
|
239 |
< |
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 |
236 |
> |
/** Returns the number of translational degrees of freedom */ |
237 |
> |
int getNdfTrans() { |
238 |
> |
return ndfTrans_; |
239 |
> |
} |
240 |
|
|
241 |
< |
OOPSEMinimizer* the_minimizer; // the energy minimizer |
242 |
< |
Restraints* restraint; |
243 |
< |
bool has_minimizer; |
241 |
> |
/** sets the current number of frozen degrees of freedom */ |
242 |
> |
void setFdf(int fdf) { |
243 |
> |
fdf_local = fdf; |
244 |
> |
} |
245 |
|
|
246 |
< |
string finalName; // the name of the eor file to be written |
247 |
< |
string sampleName; // the name of the dump file to be written |
248 |
< |
string statusName; // the name of the stat file to be written |
246 |
> |
int getFdf(); |
247 |
> |
|
248 |
> |
//getNZconstraint and setNZconstraint ruin the coherence of |
249 |
> |
//SimInfo class, need refactoring |
250 |
> |
|
251 |
> |
/** Returns the total number of z-constraint molecules in the system */ |
252 |
> |
int getNZconstraint() { |
253 |
> |
return nZconstraint_; |
254 |
> |
} |
255 |
|
|
256 |
< |
int seed; //seed for random number generator |
256 |
> |
/** |
257 |
> |
* Sets the number of z-constraint molecules in the system. |
258 |
> |
*/ |
259 |
> |
void setNZconstraint(int nZconstraint) { |
260 |
> |
nZconstraint_ = nZconstraint; |
261 |
> |
} |
262 |
> |
|
263 |
> |
/** Returns the snapshot manager. */ |
264 |
> |
SnapshotManager* getSnapshotManager() { |
265 |
> |
return sman_; |
266 |
> |
} |
267 |
|
|
268 |
< |
int useSolidThermInt; // is solid-state thermodynamic integration being used |
269 |
< |
int useLiquidThermInt; // is liquid thermodynamic integration being used |
270 |
< |
double thermIntLambda; // lambda for TI |
271 |
< |
double thermIntK; // power of lambda for TI |
272 |
< |
double vRaw; // unperturbed potential for TI |
273 |
< |
double vHarm; // harmonic potential for TI |
274 |
< |
int i; // just an int |
268 |
> |
/** Sets the snapshot manager. */ |
269 |
> |
void setSnapshotManager(SnapshotManager* sman); |
270 |
> |
|
271 |
> |
/** Returns the force field */ |
272 |
> |
ForceField* getForceField() { |
273 |
> |
return forceField_; |
274 |
> |
} |
275 |
|
|
276 |
< |
vector<double> mfact; |
277 |
< |
vector<int> FglobalGroupMembership; |
278 |
< |
int ngroup; |
145 |
< |
int* globalGroupMembership; |
276 |
> |
Globals* getSimParams() { |
277 |
> |
return simParams_; |
278 |
> |
} |
279 |
|
|
280 |
< |
// refreshes the sim if things get changed (load balanceing, volume |
281 |
< |
// adjustment, etc.) |
280 |
> |
/** Returns the velocity of center of mass of the whole system.*/ |
281 |
> |
Vector3d getComVel(); |
282 |
|
|
283 |
< |
void refreshSim( void ); |
284 |
< |
|
283 |
> |
/** Returns the center of the mass of the whole system.*/ |
284 |
> |
Vector3d getCom(); |
285 |
> |
/** Returns the center of the mass and Center of Mass velocity of |
286 |
> |
the whole system.*/ |
287 |
> |
void getComAll(Vector3d& com,Vector3d& comVel); |
288 |
|
|
289 |
< |
// sets the internal function pointer to fortran. |
289 |
> |
/** Returns intertia tensor for the entire system and system |
290 |
> |
Angular Momentum.*/ |
291 |
> |
void getInertiaTensor(Mat3x3d &intertiaTensor,Vector3d &angularMomentum); |
292 |
> |
|
293 |
> |
/** Returns system angular momentum */ |
294 |
> |
Vector3d getAngularMomentum(); |
295 |
|
|
296 |
< |
void setInternal( setFortranSim_TD fSetup, |
297 |
< |
setFortranBox_TD fBox, |
298 |
< |
notifyFortranCutOff_TD fCut){ |
299 |
< |
setFsimulation = fSetup; |
300 |
< |
setFortranBoxSize = fBox; |
301 |
< |
notifyFortranCutOffs = fCut; |
161 |
< |
} |
296 |
> |
/** Returns volume of system as estimated by an ellipsoid defined |
297 |
> |
by the radii of gyration*/ |
298 |
> |
void getGyrationalVolume(RealType &vol); |
299 |
> |
/** Overloaded version of gyrational volume that also returns |
300 |
> |
det(I) so dV/dr can be calculated*/ |
301 |
> |
void getGyrationalVolume(RealType &vol, RealType &detI); |
302 |
|
|
303 |
< |
int getNDF(); |
304 |
< |
int getNDFraw(); |
305 |
< |
int getNDFtranslational(); |
306 |
< |
int getTotIntegrableObjects(); |
307 |
< |
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 ); |
303 |
> |
void update(); |
304 |
> |
/** |
305 |
> |
* Setup Fortran Simulation |
306 |
> |
*/ |
307 |
> |
void setupFortran(); |
308 |
|
|
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; } |
309 |
|
|
310 |
< |
void wrapVector( double thePos[3] ); |
310 |
> |
/** Returns the local index manager */ |
311 |
> |
LocalIndexManager* getLocalIndexManager() { |
312 |
> |
return &localIndexMan_; |
313 |
> |
} |
314 |
|
|
315 |
< |
SimState* getConfiguration( void ) { return myConfiguration; } |
316 |
< |
|
317 |
< |
void addProperty(GenericData* prop); |
318 |
< |
GenericData* getProperty(const string& propName); |
192 |
< |
//vector<GenericData*>& getProperties() {return properties;} |
315 |
> |
int getMoleculeStampId(int globalIndex) { |
316 |
> |
//assert(globalIndex < molStampIds_.size()) |
317 |
> |
return molStampIds_[globalIndex]; |
318 |
> |
} |
319 |
|
|
320 |
< |
int getSeed(void) { return seed; } |
321 |
< |
void setSeed(int theSeed) { seed = theSeed;} |
320 |
> |
/** Returns the molecule stamp */ |
321 |
> |
MoleculeStamp* getMoleculeStamp(int id) { |
322 |
> |
return moleculeStamps_[id]; |
323 |
> |
} |
324 |
|
|
325 |
< |
private: |
325 |
> |
/** Return the total number of the molecule stamps */ |
326 |
> |
int getNMoleculeStamp() { |
327 |
> |
return moleculeStamps_.size(); |
328 |
> |
} |
329 |
> |
/** |
330 |
> |
* Finds a molecule with a specified global index |
331 |
> |
* @return a pointer point to found molecule |
332 |
> |
* @param index |
333 |
> |
*/ |
334 |
> |
Molecule* getMoleculeByGlobalIndex(int index) { |
335 |
> |
MoleculeIterator i; |
336 |
> |
i = molecules_.find(index); |
337 |
|
|
338 |
< |
SimState* myConfiguration; |
338 |
> |
return i != molecules_.end() ? i->second : NULL; |
339 |
> |
} |
340 |
|
|
341 |
< |
int boxIsInit, haveRcut, haveRsw; |
341 |
> |
int getGlobalMolMembership(int id){ |
342 |
> |
return globalMolMembership_[id]; |
343 |
> |
} |
344 |
> |
|
345 |
> |
string getFinalConfigFileName() { |
346 |
> |
return finalConfigFileName_; |
347 |
> |
} |
348 |
|
|
349 |
< |
double rList, rCut; // variables for the neighborlist |
350 |
< |
double rSw; // the switching radius |
349 |
> |
void setFinalConfigFileName(const string& fileName) { |
350 |
> |
finalConfigFileName_ = fileName; |
351 |
> |
} |
352 |
|
|
353 |
< |
double maxCutoff; |
353 |
> |
string getRawMetaData() { |
354 |
> |
return rawMetaData_; |
355 |
> |
} |
356 |
> |
void setRawMetaData(const string& rawMetaData) { |
357 |
> |
rawMetaData_ = rawMetaData; |
358 |
> |
} |
359 |
> |
|
360 |
> |
string getDumpFileName() { |
361 |
> |
return dumpFileName_; |
362 |
> |
} |
363 |
> |
|
364 |
> |
void setDumpFileName(const string& fileName) { |
365 |
> |
dumpFileName_ = fileName; |
366 |
> |
} |
367 |
|
|
368 |
< |
double distXY; |
369 |
< |
double distYZ; |
370 |
< |
double distZX; |
371 |
< |
|
372 |
< |
void calcHmatInv( void ); |
373 |
< |
void calcBoxL(); |
374 |
< |
double calcMaxCutOff(); |
368 |
> |
string getStatFileName() { |
369 |
> |
return statFileName_; |
370 |
> |
} |
371 |
> |
|
372 |
> |
void setStatFileName(const string& fileName) { |
373 |
> |
statFileName_ = fileName; |
374 |
> |
} |
375 |
> |
|
376 |
> |
string getRestFileName() { |
377 |
> |
return restFileName_; |
378 |
> |
} |
379 |
> |
|
380 |
> |
void setRestFileName(const string& fileName) { |
381 |
> |
restFileName_ = fileName; |
382 |
> |
} |
383 |
|
|
384 |
< |
// private function to initialize the fortran side of the simulation |
385 |
< |
setFortranSim_TD setFsimulation; |
384 |
> |
/** |
385 |
> |
* Sets GlobalGroupMembership |
386 |
> |
* @see #SimCreator::setGlobalIndex |
387 |
> |
*/ |
388 |
> |
void setGlobalGroupMembership(const vector<int>& globalGroupMembership) { |
389 |
> |
assert(globalGroupMembership.size() == static_cast<size_t>(nGlobalAtoms_)); |
390 |
> |
globalGroupMembership_ = globalGroupMembership; |
391 |
> |
} |
392 |
|
|
393 |
< |
setFortranBox_TD setFortranBoxSize; |
394 |
< |
|
395 |
< |
notifyFortranCutOff_TD notifyFortranCutOffs; |
396 |
< |
|
397 |
< |
//Addtional Properties of SimInfo |
398 |
< |
map<string, GenericData*> properties; |
399 |
< |
void getFortranGroupArrays(SimInfo* info, |
400 |
< |
vector<int>& FglobalGroupMembership, |
227 |
< |
vector<double>& mfact); |
393 |
> |
/** |
394 |
> |
* Sets GlobalMolMembership |
395 |
> |
* @see #SimCreator::setGlobalIndex |
396 |
> |
*/ |
397 |
> |
void setGlobalMolMembership(const vector<int>& globalMolMembership) { |
398 |
> |
assert(globalMolMembership.size() == static_cast<size_t>(nGlobalAtoms_)); |
399 |
> |
globalMolMembership_ = globalMolMembership; |
400 |
> |
} |
401 |
|
|
402 |
|
|
403 |
< |
}; |
403 |
> |
bool isFortranInitialized() { |
404 |
> |
return fortranInitialized_; |
405 |
> |
} |
406 |
> |
|
407 |
> |
bool getCalcBoxDipole() { |
408 |
> |
return calcBoxDipole_; |
409 |
> |
} |
410 |
|
|
411 |
+ |
bool getUseAtomicVirial() { |
412 |
+ |
return useAtomicVirial_; |
413 |
+ |
} |
414 |
|
|
415 |
< |
#endif |
415 |
> |
/** |
416 |
> |
* Adds property into property map |
417 |
> |
* @param genData GenericData to be added into PropertyMap |
418 |
> |
*/ |
419 |
> |
void addProperty(GenericData* genData); |
420 |
> |
|
421 |
> |
/** |
422 |
> |
* Removes property from PropertyMap by name |
423 |
> |
* @param propName the name of property to be removed |
424 |
> |
*/ |
425 |
> |
void removeProperty(const string& propName); |
426 |
> |
|
427 |
> |
/** |
428 |
> |
* clear all of the properties |
429 |
> |
*/ |
430 |
> |
void clearProperties(); |
431 |
> |
|
432 |
> |
/** |
433 |
> |
* Returns all names of properties |
434 |
> |
* @return all names of properties |
435 |
> |
*/ |
436 |
> |
vector<string> getPropertyNames(); |
437 |
> |
|
438 |
> |
/** |
439 |
> |
* Returns all of the properties in PropertyMap |
440 |
> |
* @return all of the properties in PropertyMap |
441 |
> |
*/ |
442 |
> |
vector<GenericData*> getProperties(); |
443 |
> |
|
444 |
> |
/** |
445 |
> |
* Returns property |
446 |
> |
* @param propName name of property |
447 |
> |
* @return a pointer point to property with propName. If no property named propName |
448 |
> |
* exists, return NULL |
449 |
> |
*/ |
450 |
> |
GenericData* getPropertyByName(const string& propName); |
451 |
> |
|
452 |
> |
/** |
453 |
> |
* add all special interaction pairs (including excluded |
454 |
> |
* interactions) in a molecule into the appropriate lists. |
455 |
> |
*/ |
456 |
> |
void addInteractionPairs(Molecule* mol); |
457 |
> |
|
458 |
> |
/** |
459 |
> |
* remove all special interaction pairs which belong to a molecule |
460 |
> |
* from the appropriate lists. |
461 |
> |
*/ |
462 |
> |
void removeInteractionPairs(Molecule* mol); |
463 |
> |
|
464 |
> |
/** Returns the set of atom types present in this simulation */ |
465 |
> |
set<AtomType*> getSimulatedAtomTypes(); |
466 |
> |
|
467 |
> |
friend ostream& operator <<(ostream& o, SimInfo& info); |
468 |
> |
|
469 |
> |
void getCutoff(RealType& rcut, RealType& rsw); |
470 |
> |
|
471 |
> |
private: |
472 |
> |
|
473 |
> |
/** fill up the simtype struct and other simulation-related variables */ |
474 |
> |
void setupSimVariables(); |
475 |
> |
|
476 |
> |
|
477 |
> |
/** Determine if we need to accumulate the simulation box dipole */ |
478 |
> |
void setupAccumulateBoxDipole(); |
479 |
> |
|
480 |
> |
/** Calculates the number of degress of freedom in the whole system */ |
481 |
> |
void calcNdf(); |
482 |
> |
void calcNdfRaw(); |
483 |
> |
void calcNdfTrans(); |
484 |
> |
|
485 |
> |
/** |
486 |
> |
* Adds molecule stamp and the total number of the molecule with |
487 |
> |
* same molecule stamp in the whole system. |
488 |
> |
*/ |
489 |
> |
void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); |
490 |
> |
|
491 |
> |
// Other classes holdingn important information |
492 |
> |
ForceField* forceField_; /**< provides access to defined atom types, bond types, etc. */ |
493 |
> |
Globals* simParams_; /**< provides access to simulation parameters set by user */ |
494 |
> |
|
495 |
> |
/// Counts of local objects |
496 |
> |
int nAtoms_; /**< number of atoms in local processor */ |
497 |
> |
int nBonds_; /**< number of bonds in local processor */ |
498 |
> |
int nBends_; /**< number of bends in local processor */ |
499 |
> |
int nTorsions_; /**< number of torsions in local processor */ |
500 |
> |
int nInversions_; /**< number of inversions in local processor */ |
501 |
> |
int nRigidBodies_; /**< number of rigid bodies in local processor */ |
502 |
> |
int nIntegrableObjects_; /**< number of integrable objects in local processor */ |
503 |
> |
int nCutoffGroups_; /**< number of cutoff groups in local processor */ |
504 |
> |
int nConstraints_; /**< number of constraints in local processors */ |
505 |
> |
|
506 |
> |
/// Counts of global objects |
507 |
> |
int nGlobalMols_; /**< number of molecules in the system (GLOBAL) */ |
508 |
> |
int nGlobalAtoms_; /**< number of atoms in the system (GLOBAL) */ |
509 |
> |
int nGlobalCutoffGroups_; /**< number of cutoff groups in this system (GLOBAL) */ |
510 |
> |
int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ |
511 |
> |
int nGlobalRigidBodies_; /**< number of rigid bodies in this system (GLOBAL) */ |
512 |
> |
|
513 |
> |
/// Degress of freedom |
514 |
> |
int ndf_; /**< number of degress of freedom (excludes constraints) (LOCAL) */ |
515 |
> |
int fdf_local; /**< number of frozen degrees of freedom (LOCAL) */ |
516 |
> |
int fdf_; /**< number of frozen degrees of freedom (GLOBAL) */ |
517 |
> |
int ndfRaw_; /**< number of degress of freedom (includes constraints), (LOCAL) */ |
518 |
> |
int ndfTrans_; /**< number of translation degress of freedom, (LOCAL) */ |
519 |
> |
int nZconstraint_; /**< number of z-constraint molecules (GLOBAL) */ |
520 |
> |
|
521 |
> |
/// logicals |
522 |
> |
bool usesPeriodicBoundaries_; /**< use periodic boundary conditions? */ |
523 |
> |
bool usesDirectionalAtoms_; /**< are there atoms with position AND orientation? */ |
524 |
> |
bool usesMetallicAtoms_; /**< are there transition metal atoms? */ |
525 |
> |
bool usesElectrostaticAtoms_; /**< are there electrostatic atoms? */ |
526 |
> |
bool usesAtomicVirial_; /**< are we computing atomic virials? */ |
527 |
> |
bool requiresPrepair_; /**< does this simulation require a pre-pair loop? */ |
528 |
> |
bool requiresSkipCorrection_; /**< does this simulation require a skip-correction? */ |
529 |
> |
bool requiresSelfCorrection_; /**< does this simulation require a self-correction? */ |
530 |
> |
|
531 |
> |
public: |
532 |
> |
bool usesElectrostaticAtoms() { return usesElectrostaticAtoms_; } |
533 |
> |
bool usesDirectionalAtoms() { return usesDirectionalAtoms_; } |
534 |
> |
bool usesMetallicAtoms() { return usesMetallicAtoms_; } |
535 |
> |
|
536 |
> |
private: |
537 |
> |
/// Data structures holding primary simulation objects |
538 |
> |
map<int, Molecule*> molecules_; /**< map holding pointers to LOCAL molecules */ |
539 |
> |
simtype fInfo_; /**< A dual struct shared by C++ |
540 |
> |
and Fortran to pass |
541 |
> |
information about what types |
542 |
> |
of calculation are |
543 |
> |
required */ |
544 |
> |
|
545 |
> |
/// Stamps are templates for objects that are then used to create |
546 |
> |
/// groups of objects. For example, a molecule stamp contains |
547 |
> |
/// information on how to build that molecule (i.e. the topology, |
548 |
> |
/// the atoms, the bonds, etc.) Once the system is built, the |
549 |
> |
/// stamps are no longer useful. |
550 |
> |
vector<int> molStampIds_; /**< stamp id for molecules in the system */ |
551 |
> |
vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
552 |
> |
|
553 |
> |
/** |
554 |
> |
* A vector that maps between the global index of an atom, and the |
555 |
> |
* global index of cutoff group the atom belong to. It is filled |
556 |
> |
* by SimCreator once and only once, since it never changed during |
557 |
> |
* the simulation. It should be nGlobalAtoms_ in size. |
558 |
> |
*/ |
559 |
> |
vector<int> globalGroupMembership_; |
560 |
> |
|
561 |
> |
/** |
562 |
> |
* A vector that maps between the global index of an atom and the |
563 |
> |
* global index of the molecule the atom belongs to. It is filled |
564 |
> |
* by SimCreator once and only once, since it is never changed |
565 |
> |
* during the simulation. It shoudl be nGlobalAtoms_ in size. |
566 |
> |
*/ |
567 |
> |
vector<int> globalMolMembership_; |
568 |
> |
|
569 |
> |
/** |
570 |
> |
* A vector that maps between the local index of an atom and the |
571 |
> |
* index of the AtomType. |
572 |
> |
*/ |
573 |
> |
vector<int> identArray_; |
574 |
> |
public: |
575 |
> |
vector<int> getIdentArray() { return identArray_; } |
576 |
> |
private: |
577 |
> |
|
578 |
> |
/// lists to handle atoms needing special treatment in the non-bonded interactions |
579 |
> |
PairList excludedInteractions_; /**< atoms excluded from interacting with each other */ |
580 |
> |
PairList oneTwoInteractions_; /**< atoms that are directly Bonded */ |
581 |
> |
PairList oneThreeInteractions_; /**< atoms sharing a Bend */ |
582 |
> |
PairList oneFourInteractions_; /**< atoms sharing a Torsion */ |
583 |
> |
|
584 |
> |
PropertyMap properties_; /**< Generic Properties can be added */ |
585 |
> |
SnapshotManager* sman_; /**< SnapshotManager (handles particle positions, etc.) */ |
586 |
> |
|
587 |
> |
/** |
588 |
> |
* The reason to have a local index manager is that when molecule |
589 |
> |
* is migrating to other processors, the atoms and the |
590 |
> |
* rigid-bodies will release their local indices to |
591 |
> |
* LocalIndexManager. Combining the information of molecule |
592 |
> |
* migrating to current processor, Migrator class can query the |
593 |
> |
* LocalIndexManager to make a efficient data moving plan. |
594 |
> |
*/ |
595 |
> |
LocalIndexManager localIndexMan_; |
596 |
> |
|
597 |
> |
// unparsed MetaData block for storing in Dump and EOR files: |
598 |
> |
string rawMetaData_; |
599 |
> |
|
600 |
> |
// file names |
601 |
> |
string finalConfigFileName_; |
602 |
> |
string dumpFileName_; |
603 |
> |
string statFileName_; |
604 |
> |
string restFileName_; |
605 |
> |
|
606 |
> |
|
607 |
> |
bool fortranInitialized_; /** flag to indicate whether the fortran side is initialized */ |
608 |
> |
|
609 |
> |
bool calcBoxDipole_; /**< flag to indicate whether or not we calculate |
610 |
> |
the simulation box dipole moment */ |
611 |
> |
|
612 |
> |
bool useAtomicVirial_; /**< flag to indicate whether or not we use |
613 |
> |
Atomic Virials to calculate the pressure */ |
614 |
> |
|
615 |
> |
public: |
616 |
> |
/** |
617 |
> |
* return an integral objects by its global index. In MPI |
618 |
> |
* version, if the StuntDouble with specified global index does |
619 |
> |
* not belong to local processor, a NULL will be return. |
620 |
> |
*/ |
621 |
> |
StuntDouble* getIOIndexToIntegrableObject(int index); |
622 |
> |
void setIOIndexToIntegrableObject(const vector<StuntDouble*>& v); |
623 |
> |
|
624 |
> |
private: |
625 |
> |
vector<StuntDouble*> IOIndexToIntegrableObject; |
626 |
> |
|
627 |
> |
public: |
628 |
> |
|
629 |
> |
/** |
630 |
> |
* Finds the processor where a molecule resides |
631 |
> |
* @return the id of the processor which contains the molecule |
632 |
> |
* @param globalIndex global Index of the molecule |
633 |
> |
*/ |
634 |
> |
int getMolToProc(int globalIndex) { |
635 |
> |
//assert(globalIndex < molToProcMap_.size()); |
636 |
> |
return molToProcMap_[globalIndex]; |
637 |
> |
} |
638 |
> |
|
639 |
> |
/** |
640 |
> |
* Set MolToProcMap array |
641 |
> |
* @see #SimCreator::divideMolecules |
642 |
> |
*/ |
643 |
> |
void setMolToProcMap(const vector<int>& molToProcMap) { |
644 |
> |
molToProcMap_ = molToProcMap; |
645 |
> |
} |
646 |
> |
|
647 |
> |
private: |
648 |
> |
|
649 |
> |
/** |
650 |
> |
* The size of molToProcMap_ is equal to total number of molecules |
651 |
> |
* in the system. It maps a molecule to the processor on which it |
652 |
> |
* resides. it is filled by SimCreator once and only once. |
653 |
> |
*/ |
654 |
> |
vector<int> molToProcMap_; |
655 |
> |
|
656 |
> |
}; |
657 |
> |
|
658 |
> |
} //namespace OpenMD |
659 |
> |
#endif //BRAINS_SIMMODEL_HPP |
660 |
> |
|