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