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