| 1 |
tim |
1710 |
/* |
| 2 |
|
|
* Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project |
| 3 |
|
|
* |
| 4 |
|
|
* Contact: oopse@oopse.org |
| 5 |
|
|
* |
| 6 |
|
|
* This program is free software; you can redistribute it and/or |
| 7 |
|
|
* modify it under the terms of the GNU Lesser General Public License |
| 8 |
|
|
* as published by the Free Software Foundation; either version 2.1 |
| 9 |
|
|
* of the License, or (at your option) any later version. |
| 10 |
|
|
* All we ask is that proper credit is given for our work, which includes |
| 11 |
|
|
* - but is not limited to - adding the above copyright notice to the beginning |
| 12 |
|
|
* of your source code files, and to any copyright notice that you may distribute |
| 13 |
|
|
* with programs based on this work. |
| 14 |
|
|
* |
| 15 |
|
|
* This program is distributed in the hope that it will be useful, |
| 16 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 |
|
|
* GNU Lesser General Public License for more details. |
| 19 |
|
|
* |
| 20 |
|
|
* You should have received a copy of the GNU Lesser General Public License |
| 21 |
|
|
* along with this program; if not, write to the Free Software |
| 22 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 23 |
|
|
* |
| 24 |
|
|
*/ |
| 25 |
gezelter |
1490 |
|
| 26 |
tim |
1710 |
/** |
| 27 |
|
|
* @file SimInfo.hpp |
| 28 |
|
|
* @author tlin |
| 29 |
|
|
* @date 11/02/2004 |
| 30 |
|
|
* @version 1.0 |
| 31 |
|
|
*/ |
| 32 |
|
|
|
| 33 |
|
|
#ifndef BRAINS_SIMMODEL_HPP |
| 34 |
|
|
#define BRAINS_SIMMODEL_HPP |
| 35 |
tim |
1719 |
|
| 36 |
|
|
#include <iostream> |
| 37 |
gezelter |
1490 |
#include <vector> |
| 38 |
tim |
1719 |
#include <utility> |
| 39 |
gezelter |
1490 |
|
| 40 |
tim |
1710 |
#include "brains/fSimulation.h" |
| 41 |
tim |
1492 |
#include "primitives/Molecule.hpp" |
| 42 |
tim |
1719 |
#include "types/MoleculeStamp.hpp" |
| 43 |
tim |
1710 |
#include "utils/PropertyMap.hpp" |
| 44 |
tim |
1719 |
#include "io/Globals.hpp" |
| 45 |
gezelter |
1490 |
|
| 46 |
tim |
1710 |
namespace oopse{ |
| 47 |
gezelter |
1490 |
|
| 48 |
tim |
1710 |
/** |
| 49 |
|
|
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
| 50 |
tim |
1735 |
* @brief As one of the heavy weight class of OOPSE, SimInfo |
| 51 |
|
|
* One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules. |
| 52 |
|
|
* And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies, |
| 53 |
|
|
* cutoff groups, constrains). |
| 54 |
|
|
* Another major change is the index. No matter single version or parallel version, atoms and |
| 55 |
|
|
* rigid bodies have both global index and local index. Local index is not important to molecule as well as |
| 56 |
|
|
* cutoff group. |
| 57 |
tim |
1710 |
*/ |
| 58 |
|
|
class SimInfo { |
| 59 |
|
|
public: |
| 60 |
tim |
1738 |
typedef std::map<int, Molecule*>::iterator MoleculeIterator; |
| 61 |
tim |
1733 |
|
| 62 |
|
|
/** |
| 63 |
|
|
* Constructor of SimInfo |
| 64 |
|
|
* @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the |
| 65 |
|
|
* second element is the total number of molecules with the same molecule stamp in the system |
| 66 |
|
|
* @param ff pointer of a concrete ForceField instance |
| 67 |
|
|
* @param globals |
| 68 |
|
|
* @note |
| 69 |
|
|
*/ |
| 70 |
|
|
SimInfo(const std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, ForceField* ff, Globals* globals); |
| 71 |
tim |
1710 |
virtual ~SimInfo(); |
| 72 |
gezelter |
1490 |
|
| 73 |
tim |
1710 |
/** |
| 74 |
|
|
* Adds a molecule |
| 75 |
|
|
* @return return true if adding successfully, return false if the molecule is already in SimInfo |
| 76 |
|
|
* @param mol molecule to be added |
| 77 |
|
|
*/ |
| 78 |
|
|
bool addMolecule(Molecule* mol); |
| 79 |
gezelter |
1490 |
|
| 80 |
tim |
1710 |
/** |
| 81 |
|
|
* Removes a molecule from SimInfo |
| 82 |
|
|
* @return true if removing successfully, return false if molecule is not in this SimInfo |
| 83 |
|
|
*/ |
| 84 |
|
|
bool removeMolecule(Molecule* mol); |
| 85 |
gezelter |
1490 |
|
| 86 |
tim |
1725 |
/** Returns the total number of molecules in the system. */ |
| 87 |
|
|
int getNGlobalMolecules() { |
| 88 |
tim |
1733 |
return nGlobalMols_; |
| 89 |
tim |
1725 |
} |
| 90 |
|
|
|
| 91 |
|
|
/** Returns the total number of atoms in the system. */ |
| 92 |
|
|
int getNGlobalAtoms() { |
| 93 |
tim |
1733 |
return nGlobalAtoms_; |
| 94 |
tim |
1725 |
} |
| 95 |
|
|
|
| 96 |
|
|
/** Returns the total number of cutoff groups in the system. */ |
| 97 |
|
|
int getNGlobalCutoffGroups() { |
| 98 |
tim |
1733 |
return nGlobalCutoffGroups_; |
| 99 |
tim |
1725 |
} |
| 100 |
|
|
|
| 101 |
tim |
1710 |
/** |
| 102 |
tim |
1725 |
* Returns the number of local molecules. |
| 103 |
|
|
* @return the number of local molecules |
| 104 |
tim |
1710 |
*/ |
| 105 |
|
|
int getNMolecules() { |
| 106 |
|
|
return molecules_.size(); |
| 107 |
|
|
} |
| 108 |
gezelter |
1490 |
|
| 109 |
tim |
1725 |
/** Returns the number of local atoms */ |
| 110 |
tim |
1710 |
unsigned int getNAtoms() { |
| 111 |
|
|
return nAtoms_; |
| 112 |
|
|
} |
| 113 |
gezelter |
1490 |
|
| 114 |
tim |
1725 |
/** Returns the number of local bonds */ |
| 115 |
tim |
1710 |
unsigned int getNBonds(){ |
| 116 |
|
|
return nBonds_; |
| 117 |
|
|
} |
| 118 |
gezelter |
1490 |
|
| 119 |
tim |
1725 |
/** Returns the number of local bends */ |
| 120 |
tim |
1710 |
unsigned int getNBends() { |
| 121 |
|
|
return nBends_; |
| 122 |
|
|
} |
| 123 |
gezelter |
1490 |
|
| 124 |
tim |
1725 |
/** Returns the number of local torsions */ |
| 125 |
tim |
1710 |
unsigned int getNTorsions() { |
| 126 |
|
|
return nTorsions_; |
| 127 |
|
|
} |
| 128 |
gezelter |
1490 |
|
| 129 |
tim |
1725 |
/** Returns the number of local rigid bodies */ |
| 130 |
tim |
1710 |
unsigned int getNRigidBodies() { |
| 131 |
|
|
return nRigidBodies_; |
| 132 |
|
|
} |
| 133 |
gezelter |
1490 |
|
| 134 |
tim |
1725 |
/** Returns the number of local integrable objects */ |
| 135 |
tim |
1710 |
unsigned int getNIntegrableObjects() { |
| 136 |
|
|
return nIntegrableObjects_; |
| 137 |
|
|
} |
| 138 |
gezelter |
1490 |
|
| 139 |
tim |
1725 |
/** Returns the number of local cutoff groups */ |
| 140 |
tim |
1710 |
unsigned int getNCutoffGroups() { |
| 141 |
|
|
return nCutoffGroups_; |
| 142 |
|
|
} |
| 143 |
gezelter |
1490 |
|
| 144 |
tim |
1710 |
/** Returns the total number of constraints in this SimInfo */ |
| 145 |
|
|
unsigned int getNConstraints() { |
| 146 |
|
|
return nConstraints_; |
| 147 |
|
|
} |
| 148 |
|
|
|
| 149 |
|
|
/** |
| 150 |
|
|
* Returns the first molecule in this SimInfo and intialize the iterator. |
| 151 |
|
|
* @return the first molecule, return NULL if there is not molecule in this SimInfo |
| 152 |
|
|
* @param i the iterator of molecule array (user shouldn't change it) |
| 153 |
|
|
*/ |
| 154 |
tim |
1726 |
Molecule* beginMolecule(MoleculeIterator& i); |
| 155 |
gezelter |
1490 |
|
| 156 |
tim |
1710 |
/** |
| 157 |
|
|
* Returns the next avaliable Molecule based on the iterator. |
| 158 |
|
|
* @return the next avaliable molecule, return NULL if reaching the end of the array |
| 159 |
|
|
* @param i the iterator of molecule array |
| 160 |
|
|
*/ |
| 161 |
tim |
1726 |
Molecule* nextMolecule(MoleculeIterator& i); |
| 162 |
gezelter |
1490 |
|
| 163 |
tim |
1710 |
/** Returns the number of degrees of freedom */ |
| 164 |
tim |
1722 |
int getNdf() { |
| 165 |
tim |
1710 |
return ndf_; |
| 166 |
|
|
} |
| 167 |
gezelter |
1490 |
|
| 168 |
tim |
1710 |
/** Returns the number of raw degrees of freedom */ |
| 169 |
tim |
1722 |
int getNdfRaw() { |
| 170 |
tim |
1710 |
return ndfRaw_; |
| 171 |
|
|
} |
| 172 |
gezelter |
1490 |
|
| 173 |
tim |
1710 |
/** Returns the number of translational degrees of freedom */ |
| 174 |
tim |
1722 |
int getNdfTrans() { |
| 175 |
tim |
1710 |
return ndfTrans_; |
| 176 |
|
|
} |
| 177 |
gezelter |
1490 |
|
| 178 |
tim |
1733 |
//getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying |
| 179 |
|
|
|
| 180 |
|
|
/** Returns the total number of z-constraint molecules in the system */ |
| 181 |
|
|
int getNZconstraint() { |
| 182 |
|
|
return nZconstraint_; |
| 183 |
|
|
} |
| 184 |
|
|
|
| 185 |
|
|
/** |
| 186 |
|
|
* Sets the number of z-constraint molecules in the system. |
| 187 |
|
|
*/ |
| 188 |
|
|
int setNZconstraint(int nZconstraint) { |
| 189 |
|
|
nZconstraint_ = nZconstraint; |
| 190 |
|
|
} |
| 191 |
|
|
|
| 192 |
tim |
1710 |
/** Returns the snapshot manager. */ |
| 193 |
|
|
SnapshotManager* getSnapshotManager() { |
| 194 |
|
|
return sman_; |
| 195 |
|
|
} |
| 196 |
gezelter |
1490 |
|
| 197 |
tim |
1710 |
/** Sets the snapshot manager. */ |
| 198 |
|
|
void setSnapshotManager(SnapshotManager* sman) { |
| 199 |
|
|
sman_ = sman; |
| 200 |
|
|
} |
| 201 |
tim |
1712 |
|
| 202 |
tim |
1719 |
/** Returns the force field */ |
| 203 |
tim |
1712 |
ForceField* getForceField() { |
| 204 |
|
|
return forceField_; |
| 205 |
|
|
} |
| 206 |
tim |
1719 |
|
| 207 |
|
|
Globals* getGlobals() { |
| 208 |
|
|
return globals_; |
| 209 |
|
|
} |
| 210 |
|
|
|
| 211 |
tim |
1725 |
/** Returns the velocity of center of mass of the whole system.*/ |
| 212 |
|
|
Vector3d getComVel(); |
| 213 |
tim |
1722 |
|
| 214 |
tim |
1725 |
/** Returns the center of the mass of the whole system.*/ |
| 215 |
tim |
1722 |
Vector3d getCom(); |
| 216 |
|
|
|
| 217 |
tim |
1725 |
/** Returns the seed (used for random number generator) */ |
| 218 |
tim |
1722 |
int getSeed() { |
| 219 |
|
|
return seed_; |
| 220 |
|
|
} |
| 221 |
|
|
|
| 222 |
tim |
1725 |
/** Sets the seed*/ |
| 223 |
tim |
1722 |
void setSeed(int seed) { |
| 224 |
|
|
seed_ = seed; |
| 225 |
|
|
} |
| 226 |
tim |
1725 |
|
| 227 |
tim |
1733 |
/** main driver function to interact with fortran during the initialization and molecule migration */ |
| 228 |
tim |
1725 |
void update(); |
| 229 |
|
|
|
| 230 |
|
|
/** Returns the local index manager */ |
| 231 |
|
|
LocalIndexManager* getLocalIndexManager() { |
| 232 |
tim |
1735 |
return &localIndexMan_; |
| 233 |
tim |
1725 |
} |
| 234 |
|
|
|
| 235 |
|
|
int getMoleculeStampId(int globalIndex) { |
| 236 |
|
|
//assert(globalIndex < molStampIds_.size()) |
| 237 |
|
|
return molStampIds_[globalIndex]; |
| 238 |
|
|
} |
| 239 |
|
|
|
| 240 |
|
|
/** Returns the molecule stamp */ |
| 241 |
|
|
MoleculeStamp* getMoleculeStamp(int id) { |
| 242 |
|
|
return moleculeStamps_[id]; |
| 243 |
|
|
} |
| 244 |
|
|
|
| 245 |
|
|
/** |
| 246 |
|
|
* Finds a molecule with a specified global index |
| 247 |
|
|
* @return a pointer point to found molecule |
| 248 |
|
|
* @param index |
| 249 |
|
|
*/ |
| 250 |
|
|
Molecule* getMoleculeByGlobalIndex(int index) { |
| 251 |
|
|
std::map<int, Molecule*> i; |
| 252 |
tim |
1726 |
i = molecules_.find(index); |
| 253 |
tim |
1725 |
|
| 254 |
tim |
1726 |
return i != molecules_.end() ? i->second : NULL; |
| 255 |
tim |
1725 |
} |
| 256 |
|
|
|
| 257 |
tim |
1735 |
/** Calculate the maximum cutoff radius based on the atom types */ |
| 258 |
|
|
double calcMaxCutoffRadius(); |
| 259 |
tim |
1733 |
|
| 260 |
tim |
1735 |
double getRcut() { |
| 261 |
|
|
return rcut_; |
| 262 |
|
|
} |
| 263 |
|
|
|
| 264 |
|
|
double getRsw() { |
| 265 |
|
|
return rsw_; |
| 266 |
|
|
} |
| 267 |
|
|
|
| 268 |
tim |
1733 |
std::string getFinalConfigFileName() { |
| 269 |
|
|
return finalConfigFileName_; |
| 270 |
|
|
} |
| 271 |
|
|
|
| 272 |
|
|
void setFinalConfigFileName(const std::string& fileName) { |
| 273 |
|
|
finalConfigFileName_ = fileName; |
| 274 |
|
|
} |
| 275 |
|
|
|
| 276 |
|
|
std::string getDumpFileName() { |
| 277 |
|
|
return dumpFileName_; |
| 278 |
|
|
} |
| 279 |
|
|
|
| 280 |
|
|
void setDumpFileName(const std::string& fileName) { |
| 281 |
|
|
dumpFileName_ = fileName; |
| 282 |
|
|
} |
| 283 |
|
|
|
| 284 |
|
|
std::string getStatFileName() { |
| 285 |
|
|
return statFileName_; |
| 286 |
|
|
} |
| 287 |
|
|
|
| 288 |
|
|
void setStatFileName(const std::string& fileName) { |
| 289 |
|
|
statFileName_ = fileName; |
| 290 |
|
|
} |
| 291 |
|
|
|
| 292 |
tim |
1735 |
/** |
| 293 |
|
|
* Returns the pointer of internal globalGroupMembership_ array. This array will be filled by SimCreator class |
| 294 |
|
|
* @see #SimCreator::setGlobalIndex |
| 295 |
|
|
*/ |
| 296 |
tim |
1733 |
int* getGlobalGroupMembershipPointer() { |
| 297 |
|
|
return globalGroupMembership_[0]; |
| 298 |
|
|
} |
| 299 |
|
|
|
| 300 |
tim |
1735 |
/** |
| 301 |
|
|
* Returns the pointer of internal globalMolMembership_ array. This array will be filled by SimCreator class |
| 302 |
|
|
* @see #SimCreator::setGlobalIndex |
| 303 |
|
|
*/ |
| 304 |
|
|
int* getGlobalMolMembershipPointer() { |
| 305 |
|
|
return globalMolMembership_[0]; |
| 306 |
|
|
} |
| 307 |
tim |
1738 |
|
| 308 |
|
|
|
| 309 |
|
|
bool isFortranInitialized() { |
| 310 |
|
|
return fortranInitialized_; |
| 311 |
|
|
} |
| 312 |
tim |
1735 |
|
| 313 |
tim |
1733 |
//below functions are just forward functions |
| 314 |
|
|
//To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the |
| 315 |
|
|
//the other hand, has-a relation need composing. |
| 316 |
|
|
/** |
| 317 |
|
|
* Adds property into property map |
| 318 |
|
|
* @param genData GenericData to be added into PropertyMap |
| 319 |
|
|
*/ |
| 320 |
|
|
void addProperty(GenericData* genData); |
| 321 |
|
|
|
| 322 |
|
|
/** |
| 323 |
|
|
* Removes property from PropertyMap by name |
| 324 |
|
|
* @param propName the name of property to be removed |
| 325 |
|
|
*/ |
| 326 |
|
|
void removeProperty(const std::string& propName); |
| 327 |
|
|
|
| 328 |
|
|
/** |
| 329 |
|
|
* clear all of the properties |
| 330 |
|
|
*/ |
| 331 |
|
|
void clearProperties(); |
| 332 |
|
|
|
| 333 |
|
|
/** |
| 334 |
|
|
* Returns all names of properties |
| 335 |
|
|
* @return all names of properties |
| 336 |
|
|
*/ |
| 337 |
|
|
std::vector<std::string> getPropertyNames(); |
| 338 |
|
|
|
| 339 |
|
|
/** |
| 340 |
|
|
* Returns all of the properties in PropertyMap |
| 341 |
|
|
* @return all of the properties in PropertyMap |
| 342 |
|
|
*/ |
| 343 |
|
|
std::vector<GenericData*> getProperties(); |
| 344 |
|
|
|
| 345 |
|
|
/** |
| 346 |
|
|
* Returns property |
| 347 |
|
|
* @param propName name of property |
| 348 |
|
|
* @return a pointer point to property with propName. If no property named propName |
| 349 |
|
|
* exists, return NULL |
| 350 |
|
|
*/ |
| 351 |
|
|
GenericData* getPropertyByName(const std::string& propName); |
| 352 |
|
|
|
| 353 |
tim |
1725 |
friend std::ostream& operator <<(ostream& o, SimInfo& info); |
| 354 |
|
|
|
| 355 |
tim |
1710 |
private: |
| 356 |
gezelter |
1490 |
|
| 357 |
tim |
1735 |
|
| 358 |
|
|
/** Returns the unique atom types of local processor in an array */ |
| 359 |
|
|
std::set<AtomType*> SimInfo::getUniqueAtomTypes(); |
| 360 |
|
|
|
| 361 |
|
|
/** fill up the simtype struct*/ |
| 362 |
tim |
1733 |
void setupSimType(); |
| 363 |
|
|
|
| 364 |
|
|
/** |
| 365 |
|
|
* Setup Fortran Simulation |
| 366 |
|
|
* @see #setupFortranParallel |
| 367 |
|
|
*/ |
| 368 |
|
|
void setupFortranSim(); |
| 369 |
|
|
|
| 370 |
tim |
1738 |
/** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ |
| 371 |
|
|
void setupCutoff(); |
| 372 |
|
|
|
| 373 |
tim |
1733 |
/** Calculates the number of degress of freedom in the whole system */ |
| 374 |
tim |
1722 |
void calcNdf(); |
| 375 |
|
|
void calcNdfRaw(); |
| 376 |
|
|
void calcNdfTrans(); |
| 377 |
gezelter |
1490 |
|
| 378 |
tim |
1719 |
void addExcludePairs(Molecule* mol); |
| 379 |
|
|
void removeExcludePairs(Molecule* mol); |
| 380 |
|
|
|
| 381 |
tim |
1733 |
/** |
| 382 |
tim |
1735 |
* Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole |
| 383 |
|
|
* system. |
| 384 |
tim |
1733 |
*/ |
| 385 |
|
|
void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); |
| 386 |
|
|
|
| 387 |
|
|
std::map<int, Molecule*> molecules_; /**< Molecule array */ |
| 388 |
|
|
|
| 389 |
tim |
1725 |
//degress of freedom |
| 390 |
tim |
1733 |
int ndf_; /**< number of degress of freedom (excludes constraints), ndf_ is local */ |
| 391 |
|
|
int ndfRaw_; /**< number of degress of freedom (includes constraints), ndfRaw_ is local */ |
| 392 |
|
|
int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ |
| 393 |
|
|
int nZconstraint_; /** number of z-constraint molecules, nZconstraint_ is global */ |
| 394 |
|
|
|
| 395 |
|
|
//number of global objects |
| 396 |
|
|
int nGlobalMols_; /**< number of molecules in the system */ |
| 397 |
|
|
int nGlobalAtoms_; /**< number of atoms in the system */ |
| 398 |
|
|
int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */ |
| 399 |
tim |
1725 |
|
| 400 |
tim |
1733 |
/** |
| 401 |
|
|
* the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
| 402 |
|
|
* corresponding content is the global index of cutoff group this atom belong to. |
| 403 |
|
|
* It is filled by SimCreator once and only once, since it is never changed during the simulation. |
| 404 |
|
|
*/ |
| 405 |
|
|
std::vector<int> globalGroupMembership_; |
| 406 |
tim |
1735 |
|
| 407 |
|
|
/** |
| 408 |
|
|
* the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
| 409 |
|
|
* corresponding content is the global index of molecule this atom belong to. |
| 410 |
|
|
* It is filled by SimCreator once and only once, since it is never changed during the simulation. |
| 411 |
|
|
*/ |
| 412 |
|
|
std::vector<int> globalMolMembership_; |
| 413 |
|
|
|
| 414 |
tim |
1733 |
|
| 415 |
|
|
std::vector<int> molStampIds_; /**< stamp id array of all molecules in the system */ |
| 416 |
|
|
std::vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
| 417 |
|
|
|
| 418 |
tim |
1725 |
//number of local objects |
| 419 |
tim |
1733 |
int nAtoms_; /**< number of atoms in local processor */ |
| 420 |
|
|
int nBonds_; /**< number of bonds in local processor */ |
| 421 |
|
|
int nBends_; /**< number of bends in local processor */ |
| 422 |
|
|
int nTorsions_; /**< number of torsions in local processor */ |
| 423 |
|
|
int nRigidBodies_; /**< number of rigid bodies in local processor */ |
| 424 |
|
|
int nIntegrableObjects_; /**< number of integrable objects in local processor */ |
| 425 |
|
|
int nCutoffGroups_; /**< number of cutoff groups in local processor */ |
| 426 |
|
|
int nConstraints_; /**< number of constraints in local processors */ |
| 427 |
gezelter |
1490 |
|
| 428 |
tim |
1733 |
simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/ |
| 429 |
tim |
1719 |
Exclude exclude_; |
| 430 |
tim |
1733 |
ForceField* forceField_; |
| 431 |
tim |
1725 |
PropertyMap properties_; /**< Generic Property */ |
| 432 |
|
|
SnapshotManager* sman_; /**< SnapshotManager */ |
| 433 |
tim |
1719 |
Globals* globals_; |
| 434 |
tim |
1725 |
int seed_; /**< seed for random number generator */ |
| 435 |
|
|
|
| 436 |
tim |
1735 |
/** |
| 437 |
|
|
* The reason to have a local index manager is that when molecule is migrating to other processors, |
| 438 |
|
|
* the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the |
| 439 |
|
|
* information of molecule migrating to current processor, Migrator class can query the LocalIndexManager |
| 440 |
|
|
* to make a efficient data moving plan. |
| 441 |
|
|
*/ |
| 442 |
tim |
1725 |
LocalIndexManager localIndexMan_; |
| 443 |
|
|
|
| 444 |
tim |
1735 |
//file names |
| 445 |
tim |
1733 |
std::string finalConfigFileName_; |
| 446 |
|
|
std::string dumpFileName_; |
| 447 |
|
|
std::string statFileName_; |
| 448 |
tim |
1735 |
|
| 449 |
|
|
double rcut_; /**< cutoff radius*/ |
| 450 |
|
|
double rsw_; /**< radius of switching function*/ |
| 451 |
tim |
1738 |
|
| 452 |
|
|
bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */ |
| 453 |
tim |
1733 |
|
| 454 |
|
|
#ifdef IS_MPI |
| 455 |
|
|
//in Parallel version, we need MolToProc |
| 456 |
|
|
public: |
| 457 |
|
|
|
| 458 |
|
|
/** |
| 459 |
|
|
* Finds the processor where a molecule resides |
| 460 |
|
|
* @return the id of the processor which contains the molecule |
| 461 |
|
|
* @param globalIndex global Index of the molecule |
| 462 |
|
|
*/ |
| 463 |
|
|
int getMolToProc(int globalIndex) { |
| 464 |
|
|
//assert(globalIndex < molToProcMap_.size()); |
| 465 |
|
|
return molToProcMap_[globalIndex]; |
| 466 |
|
|
} |
| 467 |
tim |
1725 |
|
| 468 |
tim |
1735 |
/** |
| 469 |
|
|
* Returns the pointer of internal molToProcMap array. This array will be filled by SimCreator class |
| 470 |
|
|
* @see #SimCreator::divideMolecules |
| 471 |
|
|
*/ |
| 472 |
tim |
1733 |
int* getMolToProcMapPointer() { |
| 473 |
|
|
return &molToProcMap_[0]; |
| 474 |
|
|
} |
| 475 |
|
|
|
| 476 |
|
|
private: |
| 477 |
|
|
|
| 478 |
|
|
void setupFortranParallel(); |
| 479 |
|
|
|
| 480 |
|
|
/** |
| 481 |
|
|
* The size of molToProcMap_ is equal to total number of molecules in the system. |
| 482 |
|
|
* It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only |
| 483 |
|
|
* once. |
| 484 |
|
|
*/ |
| 485 |
|
|
std::vector<int> molToProcMap_; |
| 486 |
|
|
#endif |
| 487 |
|
|
|
| 488 |
gezelter |
1490 |
}; |
| 489 |
|
|
|
| 490 |
tim |
1710 |
} //namespace oopse |
| 491 |
|
|
#endif //BRAINS_SIMMODEL_HPP |