OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
SimInfo.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2004-present, The University of Notre Dame. All rights
3 * reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
32 * research, please cite the appropriate papers when you publish your
33 * work. Good starting points are:
34 *
35 * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
36 * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
37 * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).
38 * [4] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
39 * [5] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012).
40 * [6] Lamichhane, Gezelter & Newman, J. Chem. Phys. 141, 134109 (2014).
41 * [7] Lamichhane, Newman & Gezelter, J. Chem. Phys. 141, 134110 (2014).
42 * [8] Bhattarai, Newman & Gezelter, Phys. Rev. B 99, 094106 (2019).
43 */
44
45/**
46 * @file SimInfo.hpp
47 * @author tlin
48 * @date 11/02/2004
49 * @version 1.0
50 */
51
52#ifndef BRAINS_SIMMODEL_HPP
53#define BRAINS_SIMMODEL_HPP
54
55#include <iostream>
56#include <map>
57#include <memory>
58#include <set>
59#include <string>
60#include <utility>
61#include <vector>
62
63#include "brains/ForceField.hpp"
64#include "brains/PairList.hpp"
65#include "io/Globals.hpp"
67#include "math/Vector3.hpp"
68#include "nonbonded/SwitchingFunction.hpp"
69#include "types/MoleculeStamp.hpp"
71#include "utils/PropertyMap.hpp"
72#include "utils/RandNumGen.hpp"
73
74using namespace std;
75namespace OpenMD {
76 // forward declaration
77 class SnapshotManager;
78 class Molecule;
79 class SelectionManager;
80 class StuntDouble;
81
82 /**
83 * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp"
84 *
85 * @brief One of the heavy-weight classes of OpenMD, SimInfo
86 * maintains objects and variables relating to the current
87 * simulation. This includes the primary list of Molecules. The
88 * Molecule class maintains all of the concrete objects (Atoms,
89 * Bond, Bend, Torsions, Inversions, RigidBodies, CutoffGroups,
90 * Constraints). In both the single and parallel versions, Atoms and
91 * RigidBodies have both global and local indices.
92 */
93 class SimInfo {
94 public:
95 using MoleculeIterator = std::map<int, Molecule*>::iterator;
96
97 /**
98 * Constructor of SimInfo
99 *
100 * @param ff pointer to a concrete ForceField instance
101 *
102 * @param simParams pointer to the simulation parameters in a Globals object
103 */
104 SimInfo(ForceField* ff, Globals* simParams);
105 virtual ~SimInfo();
106
107 /**
108 * Adds a molecule
109 *
110 * @return return true if adding successfully, return false if the
111 * molecule is already in SimInfo
112 *
113 * @param mol Molecule to be added
114 */
115 bool addMolecule(Molecule* mol);
116
117 /**
118 * Removes a molecule from SimInfo
119 *
120 * @return true if removing successfully, return false if molecule
121 * is not in this SimInfo
122 */
123 bool removeMolecule(Molecule* mol);
124
125 /** Returns the total number of molecules in the system. */
126 int getNGlobalMolecules() { return nGlobalMols_; }
127
128 /** Returns the total number of atoms in the system. */
129 int getNGlobalAtoms() { return nGlobalAtoms_; }
130
131 /** Returns the total number of cutoff groups in the system. */
132 int getNGlobalCutoffGroups() { return nGlobalCutoffGroups_; }
133
134 /**
135 * Returns the total number of integrable objects (total number of
136 * rigid bodies plus the total number of atoms which do not belong
137 * to the rigid bodies) in the system
138 */
139 int getNGlobalIntegrableObjects() { return nGlobalIntegrableObjects_; }
140
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 getNGlobalRigidBodies() { return nGlobalRigidBodies_; }
147
148 /** Returns the number of global bonds */
149 unsigned int getNGlobalBonds() { return nGlobalBonds_; }
150
151 /** Returns the number of global bends */
152 unsigned int getNGlobalBends() { return nGlobalBends_; }
153
154 /** Returns the number of global torsions */
155 unsigned int getNGlobalTorsions() { return nGlobalTorsions_; }
156
157 /** Returns the number of global inversions */
158 unsigned int getNGlobalInversions() { return nGlobalInversions_; }
159
160 unsigned int getNGlobalConstraints() {
161 if (!hasNGlobalConstraints_) calcNConstraints();
162 return nGlobalConstraints_;
163 }
164
165 /**
166 * Returns the number of local molecules.
167 * @return the number of local molecules
168 */
169 size_t getNMolecules() { return molecules_.size(); }
170
171 /** Returns the number of local atoms */
172 unsigned int getNAtoms() { return nAtoms_; }
173
174 /** Returns the number of effective cutoff groups on local processor */
175 unsigned int getNLocalCutoffGroups();
176
177 /** Returns the number of local bonds */
178 unsigned int getNBonds() { return nBonds_; }
179
180 /** Returns the number of local bends */
181 unsigned int getNBends() { return nBends_; }
182
183 /** Returns the number of local torsions */
184 unsigned int getNTorsions() { return nTorsions_; }
185
186 /** Returns the number of local inversions */
187 unsigned int getNInversions() { return nInversions_; }
188 /** Returns the number of local rigid bodies */
189 unsigned int getNRigidBodies() { return nRigidBodies_; }
190
191 /** Returns the number of local integrable objects */
192 unsigned int getNIntegrableObjects() { return nIntegrableObjects_; }
193
194 /** Returns the number of local cutoff groups */
195 unsigned int getNCutoffGroups() { return nCutoffGroups_; }
196
197 /** Returns the total number of constraints in this SimInfo */
198 unsigned int getNConstraints() { return nConstraints_; }
199
200 /**
201 * Returns the first molecule in this SimInfo and intialize the iterator.
202 * @return the first molecule, return NULL if there is not molecule in this
203 * SimInfo
204 * @param i the iterator of molecule array (user shouldn't change it)
205 */
206 Molecule* beginMolecule(MoleculeIterator& i);
207
208 /**
209 * Returns the next avaliable Molecule based on the iterator.
210 * @return the next avaliable molecule, return NULL if reaching the end of
211 * the array
212 * @param i the iterator of molecule array
213 */
214 Molecule* nextMolecule(MoleculeIterator& i);
215
216 /** Returns the total number of fluctuating charges that are present */
217 int getNFluctuatingCharges() { return nGlobalFluctuatingCharges_; }
218
219 /** Returns the number of degrees of freedom */
220 int getNdf() { return ndf_ - getFdf(); }
221
222 /** Returns the number of degrees of freedom (LOCAL) */
223 int getNdfLocal() { return ndfLocal_; }
224
225 /** Returns the number of raw degrees of freedom */
226 int getNdfRaw() { return ndfRaw_; }
227
228 /** Returns the number of translational degrees of freedom */
229 int getNdfTrans() { return ndfTrans_; }
230
231 /** sets the current number of frozen degrees of freedom */
232 void setFdf(int fdf) { fdf_local = fdf; }
233
234 int getFdf();
235
236 // getNZconstraint and setNZconstraint ruin the coherence of
237 // SimInfo class, need refactoring
238
239 /** Returns the total number of z-constraint molecules in the system */
240 int getNZconstraint() { return nZconstraint_; }
241
242 /**
243 * Sets the number of z-constraint molecules in the system.
244 */
245 void setNZconstraint(int nZconstraint) { nZconstraint_ = nZconstraint; }
246
247 /** Returns the snapshot manager. */
249
250 /** Returns the storage layouts (computed by SimCreator) */
251 int getAtomStorageLayout() { return atomStorageLayout_; }
252 int getRigidBodyStorageLayout() { return rigidBodyStorageLayout_; }
253 int getCutoffGroupStorageLayout() { return cutoffGroupStorageLayout_; }
254
255 /** Sets the storage layouts (computed by SimCreator) */
256 void setAtomStorageLayout(int asl) { atomStorageLayout_ = asl; }
257 void setRigidBodyStorageLayout(int rbsl) { rigidBodyStorageLayout_ = rbsl; }
258 void setCutoffGroupStorageLayout(int cgsl) {
259 cutoffGroupStorageLayout_ = cgsl;
260 }
261
262 /** Sets the snapshot manager. */
263 void setSnapshotManager(SnapshotManager* sman);
264
265 /** Returns the force field */
266 ForceField* getForceField() { return forceField_; }
267
268 Globals* getSimParams() { return simParams_; }
269
270 Utils::RandNumGenPtr getRandomNumberGenerator() const {
271 return randNumGen_;
272 }
273
274 void update();
275
276 /**
277 * Do final bookkeeping before Force managers need their data.
278 */
279 void prepareTopology();
280
281 /** Returns the local index manager */
282 LocalIndexManager* getLocalIndexManager() { return &localIndexMan_; }
283
284 int getMoleculeStampId(int globalIndex) {
285 // assert(globalIndex < molStampIds_.size())
286 return molStampIds_[globalIndex];
287 }
288
289 /** Returns the molecule stamp */
290 MoleculeStamp* getMoleculeStamp(int id) { return moleculeStamps_[id]; }
291
292 /** Return the total number of the molecule stamps */
293 size_t getNMoleculeStamp() { return moleculeStamps_.size(); }
294
295 /**
296 * Finds a molecule with a specified global index
297 * @return a pointer point to found molecule
298 * @param index
299 */
301 MoleculeIterator i;
302 i = molecules_.find(index);
303
304 return i != molecules_.end() ? i->second : NULL;
305 }
306
307 int getGlobalMolMembership(int id) { return globalMolMembership_[id]; }
308
309 /**
310 * returns a vector which maps the local atom index on this
311 * processor to the global atom index. With only one processor,
312 * these should be identical.
313 */
314 std::vector<int> getGlobalAtomIndices();
315
316 /**
317 * returns a vector which maps the local cutoff group index on
318 * this processor to the global cutoff group index. With only one
319 * processor, these should be identical.
320 */
321 std::vector<int> getGlobalGroupIndices();
322
323 std::string getFinalConfigFileName() { return finalConfigFileName_; }
324
325 void setFinalConfigFileName(const std::string& fileName) {
326 finalConfigFileName_ = fileName;
327 }
328
329 std::string getRawMetaData() { return rawMetaData_; }
330
331 void setRawMetaData(const std::string& rawMetaData) {
332 rawMetaData_ = rawMetaData;
333 }
334
335 std::string getDumpFileName() { return dumpFileName_; }
336
337 void setDumpFileName(const std::string& fileName) {
338 dumpFileName_ = fileName;
339 }
340
341 std::string getStatFileName() { return statFileName_; }
342
343 void setStatFileName(const std::string& fileName) {
344 statFileName_ = fileName;
345 }
346
347 std::string getReportFileName() { return reportFileName_; }
348
349 void setReportFileName(const std::string& fileName) {
350 reportFileName_ = fileName;
351 }
352
353 std::string getRestFileName() { return restFileName_; }
354
355 void setRestFileName(const std::string& fileName) {
356 restFileName_ = fileName;
357 }
358
359 /**
360 * Sets GlobalGroupMembership
361 */
362 void setGlobalGroupMembership(const std::vector<int>& ggm) {
363 assert(ggm.size() == static_cast<size_t>(nGlobalAtoms_));
364 globalGroupMembership_ = ggm;
365 }
366
367 /**
368 * Sets GlobalMolMembership
369 */
370 void setGlobalMolMembership(const std::vector<int>& gmm) {
371 assert(gmm.size() ==
372 (static_cast<size_t>(nGlobalAtoms_ + nGlobalRigidBodies_)));
373 globalMolMembership_ = gmm;
374 }
375
376 bool isTopologyDone() { return topologyDone_; }
377
378 bool getCalcBoxDipole() { return calcBoxDipole_; }
379 bool getCalcBoxQuadrupole() { return calcBoxQuadrupole_; }
380
381 bool getUseAtomicVirial() { return useAtomicVirial_; }
382
383 /**
384 * Adds property into property map
385 * @param genData GenericData to be added into PropertyMap
386 */
387 void addProperty(std::shared_ptr<GenericData> genData);
388
389 /**
390 * Removes property from PropertyMap by name
391 * @param propName the name of property to be removed
392 */
393 void removeProperty(const std::string& propName);
394
395 /**
396 * Returns all names of properties
397 * @return all names of properties
398 */
399 std::vector<std::string> getPropertyNames();
400
401 /**
402 * Returns all of the properties in PropertyMap
403 * @return all of the properties in PropertyMap
404 */
405 std::vector<std::shared_ptr<GenericData>> getProperties();
406
407 /**
408 * Returns property
409 * @param propName name of property
410 * @return a pointer point to property with propName. If no property named
411 * propName exists, return NULL
412 */
413 std::shared_ptr<GenericData> getPropertyByName(const std::string& propName);
414
415 /**
416 * add all special interaction pairs (including excluded
417 * interactions) in a molecule into the appropriate lists.
418 */
419 void addInteractionPairs(Molecule* mol);
420
421 /**
422 * remove all special interaction pairs which belong to a molecule
423 * from the appropriate lists.
424 */
425 void removeInteractionPairs(Molecule* mol);
426
427 /** Returns the set of atom types present in this simulation */
428 AtomTypeSet getSimulatedAtomTypes();
429
430 /** Returns the global count of atoms of a particular type */
432
433 friend ostream& operator<<(ostream& o, SimInfo& info);
434
435 void getCutoff(RealType& rcut, RealType& rsw);
436
437 private:
438 /** fill up the simtype struct and other simulation-related variables */
439 void setupSimVariables();
440
441 /** Calculates the number of degress of freedom in the whole system */
442 void calcNdf();
443 void calcNdfRaw();
444 void calcNdfTrans();
445 void calcNConstraints();
446
447 /**
448 * Adds molecule stamp and the total number of the molecule with
449 * same molecule stamp in the whole system.
450 */
451 void addMoleculeStamp(MoleculeStamp* molStamp, int nmol);
452
453 // Other classes holding important information
454 ForceField* forceField_; /**< provides access to defined atom types, bond
455 types, etc. */
456 Globals* simParams_; /**< provides access to simulation parameters
457 set by user */
458 Utils::RandNumGenPtr randNumGen_;
459
460 /// Counts of local objects
461 int nAtoms_; /**< number of atoms in local processor */
462 int nBonds_; /**< number of bonds in local processor */
463 int nBends_; /**< number of bends in local processor */
464 int nTorsions_; /**< number of torsions in local processor */
465 int nInversions_; /**< number of inversions in local processor */
466 int nRigidBodies_; /**< number of rigid bodies in local processor */
467 int nIntegrableObjects_; /**< number of integrable objects in local
468 processor */
469 int nCutoffGroups_; /**< number of cutoff groups in local processor */
470 int nConstraints_; /**< number of constraints in local processors */
471 int nFluctuatingCharges_; /**< number of fluctuating charges in local
472 processor */
473
474 /// Counts of global objects
475 int nGlobalMols_; /**< number of molecules in the system (GLOBAL) */
476 int nGlobalAtoms_; /**< number of atoms in the system (GLOBAL) */
477 int nGlobalCutoffGroups_; /**< number of cutoff groups in this system
478 (GLOBAL) */
479 int nGlobalIntegrableObjects_; /**< number of integrable objects in this
480 system */
481 int nGlobalRigidBodies_; /**< number of rigid bodies in this system (GLOBAL)
482 */
483 int nGlobalFluctuatingCharges_; /**< number of fluctuating charges in this
484 system (GLOBAL) */
485 int nGlobalBonds_; /**< number of bonds in the system */
486 int nGlobalBends_; /**< number of bends in the system */
487 int nGlobalTorsions_; /**< number of torsions in the system */
488 int nGlobalInversions_; /**< number of inversions in the system */
489 int nGlobalConstraints_; /**< number of constraints in the system */
490 bool hasNGlobalConstraints_;
491
492 /// Degress of freedom
493 int ndf_; /**< number of degress of freedom (excludes constraints) (LOCAL)
494 */
495 int ndfLocal_; /**< number of degrees of freedom (LOCAL, excludes
496 constraints) */
497 int fdf_local; /**< number of frozen degrees of freedom (LOCAL) */
498 int fdf_; /**< number of frozen degrees of freedom (GLOBAL) */
499 int ndfRaw_; /**< number of degress of freedom (includes constraints),
500 (LOCAL) */
501 int ndfTrans_; /**< number of translation degress of freedom, (LOCAL) */
502 int nZconstraint_; /**< number of z-constraint molecules (GLOBAL) */
503
504 /// logicals
505 bool usesPeriodicBoundaries_; /**< use periodic boundary conditions? */
506 bool usesDirectionalAtoms_; /**< are there atoms with position AND
507 orientation? */
508 bool usesMetallicAtoms_; /**< are there transition metal atoms? */
509 bool usesElectrostaticAtoms_; /**< are there electrostatic atoms? */
510 bool usesFluctuatingCharges_; /**< are there fluctuating charges? */
511 bool usesAtomicVirial_; /**< are we computing atomic virials? */
512 bool requiresPrepair_; /**< does this simulation require a pre-pair loop? */
513 bool requiresSkipCorrection_; /**< does this simulation require a
514 skip-correction? */
515 bool requiresSelfCorrection_; /**< does this simulation require a
516 self-correction? */
517
518 public:
519 bool usesElectrostaticAtoms() { return usesElectrostaticAtoms_; }
520 bool usesDirectionalAtoms() { return usesDirectionalAtoms_; }
521 bool usesFluctuatingCharges() { return usesFluctuatingCharges_; }
522 bool usesAtomicVirial() { return usesAtomicVirial_; }
523 bool requiresPrepair() { return requiresPrepair_; }
524 bool requiresSkipCorrection() { return requiresSkipCorrection_; }
525 bool requiresSelfCorrection() { return requiresSelfCorrection_; }
526
527 private:
528 /// Data structures holding primary simulation objects
529 std::map<int, Molecule*>
530 molecules_; /**< map holding pointers to LOCAL molecules */
531
532 /// Stamps are templates for objects that are then used to create
533 /// groups of objects. For example, a molecule stamp contains
534 /// information on how to build that molecule (i.e. the topology,
535 /// the atoms, the bonds, etc.) Once the system is built, the
536 /// stamps are no longer useful.
537 std::vector<int> molStampIds_; /**< stamp id for molecules in the system */
538 std::vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */
539
540 /**
541 * A vector that maps between the global index of an atom, and the
542 * global index of cutoff group the atom belong to. It is filled
543 * by SimCreator once and only once, since it never changed during
544 * the simulation. It should be nGlobalAtoms_ in size.
545 */
546 std::vector<int> globalGroupMembership_;
547
548 public:
549 std::vector<int> getGlobalGroupMembership() {
550 return globalGroupMembership_;
551 }
552
553 private:
554 /**
555 * A vector that maps between the global index of an atom and the
556 * global index of the molecule the atom belongs to. It is filled
557 * by SimCreator once and only once, since it is never changed
558 * during the simulation. It shoudl be nGlobalAtoms_ in size.
559 */
560 std::vector<int> globalMolMembership_;
561
562 /**
563 * A vector that maps between the local index of an atom and the
564 * index of the AtomType.
565 */
566 std::vector<int> identArray_;
567
568 public:
569 std::vector<int> getIdentArray() { return identArray_; }
570
571 /**
572 * A vector that contains information about the local region of an
573 * atom (used for fluctuating charges, etc.)
574 */
575 private:
576 std::vector<int> regions_;
577
578 public:
579 std::vector<int> getRegions() { return regions_; }
580
581 private:
582 /**
583 * A vector which contains the fractional contribution of an
584 * atom's mass to the total mass of the cutoffGroup that atom
585 * belongs to. In the case of single atom cutoff groups, the mass
586 * factor for that atom is 1. For massless atoms, the factor is
587 * also 1.
588 */
589 std::vector<RealType> massFactors_;
590
591 public:
592 std::vector<RealType> getMassFactors() { return massFactors_; }
593
594 PairList* getExcludedInteractions() { return &excludedInteractions_; }
595 PairList* getOneTwoInteractions() { return &oneTwoInteractions_; }
596 PairList* getOneThreeInteractions() { return &oneThreeInteractions_; }
597 PairList* getOneFourInteractions() { return &oneFourInteractions_; }
598
599 private:
600 /// lists to handle atoms needing special treatment in the non-bonded
601 /// interactions
602 PairList excludedInteractions_; /**< atoms excluded from interacting with
603 each other */
604 PairList oneTwoInteractions_; /**< atoms that are directly Bonded */
605 PairList oneThreeInteractions_; /**< atoms sharing a Bend */
606 PairList oneFourInteractions_; /**< atoms sharing a Torsion */
607
608 PropertyMap properties_; /**< Generic Properties can be added */
609 SnapshotManager*
610 sman_; /**< SnapshotManager (handles particle positions, etc.) */
611
612 int atomStorageLayout_; /**< Bits to tell how much data to store
613 on each object */
614 int rigidBodyStorageLayout_;
615 int cutoffGroupStorageLayout_;
616
617 /**
618 * The reason to have a local index manager is that when molecule
619 * is migrating to other processors, the atoms and the
620 * rigid-bodies will release their local indices to
621 * LocalIndexManager. Combining the information of molecule
622 * migrating to current processor, Migrator class can query the
623 * LocalIndexManager to make a efficient data moving plan.
624 */
625 LocalIndexManager localIndexMan_;
626
627 // unparsed MetaData block for storing in Dump and EOR files:
628 std::string rawMetaData_;
629
630 // file names
631 std::string finalConfigFileName_;
632 std::string dumpFileName_;
633 std::string statFileName_;
634 std::string reportFileName_;
635 std::string restFileName_;
636
637 bool topologyDone_; /** flag to indicate whether the topology has
638 been scanned and all the relevant
639 bookkeeping has been done*/
640
641 bool calcBoxDipole_; /**< flag to indicate whether or not we calculate
642 the simulation box dipole moment */
643 bool calcBoxQuadrupole_; /**< flag to indicate whether or not we calculate
644 the simulation box quadrupole moment */
645
646 bool useAtomicVirial_; /**< flag to indicate whether or not we use
647 Atomic Virials to calculate the pressure */
648
649 public:
650 /**
651 * return an integral objects by its global index. In MPI
652 * version, if the StuntDouble with specified global index does
653 * not belong to local processor, a NULL will be return.
654 */
655 StuntDouble* getIOIndexToIntegrableObject(int index);
656 void setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v);
657
658 private:
659 std::vector<StuntDouble*> IOIndexToIntegrableObject;
660
661 public:
662 /**
663 * Finds the processor where a molecule resides
664 * @return the id of the processor which contains the molecule
665 * @param globalIndex global Index of the molecule
666 */
667 int getMolToProc(int globalIndex) {
668 // assert(globalIndex < molToProcMap_.size());
669 return molToProcMap_[globalIndex];
670 }
671
672 /**
673 * Set MolToProcMap array
674 */
675 void setMolToProcMap(const std::vector<int>& molToProcMap) {
676 molToProcMap_ = molToProcMap;
677 }
678
679 private:
680 /**
681 * The size of molToProcMap_ is equal to total number of molecules
682 * in the system. It maps a molecule to the processor on which it
683 * resides. it is filled by SimCreator once and only once.
684 */
685 std::vector<int> molToProcMap_;
686 };
687} // namespace OpenMD
688
689#endif // BRAINS_SIMMODEL_HPP
AtomType is what OpenMD looks to for unchanging data about an atom.
Definition AtomType.hpp:66
"utils/LocalIndexManager.hpp"
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Definition SimInfo.hpp:93
bool removeMolecule(Molecule *mol)
Removes a molecule from SimInfo.
Definition SimInfo.cpp:212
int getNdf()
Returns the number of degrees of freedom.
Definition SimInfo.hpp:220
Molecule * getMoleculeByGlobalIndex(int index)
Finds a molecule with a specified global index.
Definition SimInfo.hpp:300
int getNGlobalIntegrableObjects()
Returns the total number of integrable objects (total number of rigid bodies plus the total number of...
Definition SimInfo.hpp:139
std::vector< std::shared_ptr< GenericData > > getProperties()
Returns all of the properties in PropertyMap.
Definition SimInfo.cpp:962
int getGlobalCountOfType(AtomType *atype)
Returns the global count of atoms of a particular type.
int getNdfRaw()
Returns the number of raw degrees of freedom.
Definition SimInfo.hpp:226
void setGlobalMolMembership(const std::vector< int > &gmm)
Sets GlobalMolMembership.
Definition SimInfo.hpp:370
void setAtomStorageLayout(int asl)
Sets the storage layouts (computed by SimCreator)
Definition SimInfo.hpp:256
void setNZconstraint(int nZconstraint)
Sets the number of z-constraint molecules in the system.
Definition SimInfo.hpp:245
unsigned int getNInversions()
Returns the number of local inversions.
Definition SimInfo.hpp:187
std::vector< int > getGlobalGroupIndices()
returns a vector which maps the local cutoff group index on this processor to the global cutoff group...
Definition SimInfo.cpp:878
int getMolToProc(int globalIndex)
Finds the processor where a molecule resides.
Definition SimInfo.hpp:667
void removeInteractionPairs(Molecule *mol)
remove all special interaction pairs which belong to a molecule from the appropriate lists.
Definition SimInfo.cpp:532
ForceField * getForceField()
Returns the force field.
Definition SimInfo.hpp:266
size_t getNMolecules()
Returns the number of local molecules.
Definition SimInfo.hpp:169
unsigned int getNGlobalInversions()
Returns the number of global inversions.
Definition SimInfo.hpp:158
Molecule * beginMolecule(MoleculeIterator &i)
Returns the first molecule in this SimInfo and intialize the iterator.
Definition SimInfo.cpp:240
MoleculeStamp * getMoleculeStamp(int id)
Returns the molecule stamp.
Definition SimInfo.hpp:290
unsigned int getNGlobalTorsions()
Returns the number of global torsions.
Definition SimInfo.hpp:155
unsigned int getNIntegrableObjects()
Returns the number of local integrable objects.
Definition SimInfo.hpp:192
unsigned int getNAtoms()
Returns the number of local atoms.
Definition SimInfo.hpp:172
int getNGlobalRigidBodies()
Returns the total number of integrable objects (total number of rigid bodies plus the total number of...
Definition SimInfo.hpp:146
unsigned int getNTorsions()
Returns the number of local torsions.
Definition SimInfo.hpp:184
void prepareTopology()
Do final bookkeeping before Force managers need their data.
Definition SimInfo.cpp:897
int getNdfLocal()
Returns the number of degrees of freedom (LOCAL)
Definition SimInfo.hpp:223
int getAtomStorageLayout()
Returns the storage layouts (computed by SimCreator)
Definition SimInfo.hpp:251
std::shared_ptr< GenericData > getPropertyByName(const std::string &propName)
Returns property.
Definition SimInfo.cpp:966
unsigned int getNConstraints()
Returns the total number of constraints in this SimInfo.
Definition SimInfo.hpp:198
unsigned int getNRigidBodies()
Returns the number of local rigid bodies.
Definition SimInfo.hpp:189
int getNGlobalAtoms()
Returns the total number of atoms in the system.
Definition SimInfo.hpp:129
int getNGlobalMolecules()
Returns the total number of molecules in the system.
Definition SimInfo.hpp:126
void setSnapshotManager(SnapshotManager *sman)
Sets the snapshot manager.
Definition SimInfo.cpp:971
void setGlobalGroupMembership(const std::vector< int > &ggm)
Sets GlobalGroupMembership.
Definition SimInfo.hpp:362
bool addMolecule(Molecule *mol)
Adds a molecule.
Definition SimInfo.cpp:187
std::vector< std::string > getPropertyNames()
Returns all names of properties.
Definition SimInfo.cpp:958
unsigned int getNBends()
Returns the number of local bends.
Definition SimInfo.hpp:181
unsigned int getNCutoffGroups()
Returns the number of local cutoff groups.
Definition SimInfo.hpp:195
void addInteractionPairs(Molecule *mol)
add all special interaction pairs (including excluded interactions) in a molecule into the appropriat...
Definition SimInfo.cpp:376
unsigned int getNGlobalBonds()
Returns the number of global bonds.
Definition SimInfo.hpp:149
void update()
update
Definition SimInfo.cpp:697
unsigned int getNLocalCutoffGroups()
Returns the number of effective cutoff groups on local processor.
Definition SimInfo.cpp:311
int getNFluctuatingCharges()
Returns the total number of fluctuating charges that are present.
Definition SimInfo.hpp:217
Molecule * nextMolecule(MoleculeIterator &i)
Returns the next avaliable Molecule based on the iterator.
Definition SimInfo.cpp:245
SnapshotManager * getSnapshotManager()
Returns the snapshot manager.
Definition SimInfo.hpp:248
int getNGlobalCutoffGroups()
Returns the total number of cutoff groups in the system.
Definition SimInfo.hpp:132
size_t getNMoleculeStamp()
Return the total number of the molecule stamps.
Definition SimInfo.hpp:293
StuntDouble * getIOIndexToIntegrableObject(int index)
return an integral objects by its global index.
Definition SimInfo.cpp:1027
void setMolToProcMap(const std::vector< int > &molToProcMap)
Set MolToProcMap array.
Definition SimInfo.hpp:675
void addProperty(std::shared_ptr< GenericData > genData)
Adds property into property map.
Definition SimInfo.cpp:950
unsigned int getNGlobalBends()
Returns the number of global bends.
Definition SimInfo.hpp:152
void setFdf(int fdf)
sets the current number of frozen degrees of freedom
Definition SimInfo.hpp:232
unsigned int getNBonds()
Returns the number of local bonds.
Definition SimInfo.hpp:178
std::vector< int > getGlobalAtomIndices()
returns a vector which maps the local atom index on this processor to the global atom index.
Definition SimInfo.cpp:862
int getNZconstraint()
Returns the total number of z-constraint molecules in the system.
Definition SimInfo.hpp:240
void removeProperty(const std::string &propName)
Removes property from PropertyMap by name.
Definition SimInfo.cpp:954
AtomTypeSet getSimulatedAtomTypes()
Returns the set of atom types present in this simulation.
Definition SimInfo.cpp:712
LocalIndexManager * getLocalIndexManager()
Returns the local index manager.
Definition SimInfo.hpp:282
int getNdfTrans()
Returns the number of translational degrees of freedom.
Definition SimInfo.hpp:229
SimInfo(ForceField *ff, Globals *simParams)
Constructor of SimInfo.
Definition SimInfo.cpp:79
SnapshotManager class is an abstract class which maintains a series of snapshots.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.