OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
Stats.hpp
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#ifndef BRAINS_STATS_HPP
46#define BRAINS_STATS_HPP
47
48#include <bitset>
49#include <map>
50#include <string>
51
52#include "brains/SimInfo.hpp"
54#include "utils/OldAccumulator.hpp"
55
56using namespace std;
57namespace OpenMD {
58
59 class Stats {
60 public:
61 enum StatsIndex {
62 BEGININDEX = 0, // internal use
63 TIME = BEGININDEX,
64 TOTAL_ENERGY,
65 POTENTIAL_ENERGY,
66 KINETIC_ENERGY,
67 TEMPERATURE,
68 PRESSURE,
69 VOLUME,
70 HULLVOLUME,
71 GYRVOLUME,
72 CONSERVED_QUANTITY,
73 TRANSLATIONAL_KINETIC,
74 ROTATIONAL_KINETIC,
75 ELECTRONIC_KINETIC,
76 LONG_RANGE_POTENTIAL,
77 VANDERWAALS_POTENTIAL,
78 ELECTROSTATIC_POTENTIAL,
79 METALLIC_POTENTIAL,
80 METALLIC_EMBEDDING,
81 METALLIC_PAIR,
82 HYDROGENBONDING_POTENTIAL,
83 RECIPROCAL_POTENTIAL,
84 SURFACE_POTENTIAL,
85 SHORT_RANGE_POTENTIAL,
86 BOND_POTENTIAL,
87 BEND_POTENTIAL,
88 DIHEDRAL_POTENTIAL,
89 INVERSION_POTENTIAL,
90 RAW_POTENTIAL,
91 RESTRAINT_POTENTIAL,
92 EXCLUDED_POTENTIAL,
93 PRESSURE_TENSOR,
94 VIRIAL_TENSOR,
95 SYSTEM_DIPOLE,
96 SYSTEM_QUADRUPOLE,
97 TAGGED_PAIR_DISTANCE,
98 SHADOWH,
99 HELFANDMOMENT,
100 HEATFLUX,
101 ELECTRONIC_TEMPERATURE,
102 COM,
103 COM_VELOCITY,
104 ANGULAR_MOMENTUM,
105 POTENTIAL_SELECTION,
106 NET_CHARGE,
107 CHARGE_MOMENTUM,
108 CURRENT_DENSITY,
109 ENDINDEX // internal use
110 };
111
112 struct StatsData {
113 std::string title;
114 std::string units;
115 std::string dataType;
116 BaseAccumulator* accumulator;
117 std::vector<BaseAccumulator*> accumulatorArray2d;
118 };
119
120 using StatsBitSet = std::bitset<ENDINDEX - BEGININDEX>;
121 using StatsMapType = std::map<std::string, StatsIndex>;
122
123 Stats(SimInfo* info);
124 virtual ~Stats();
125 void parseStatFileFormat(const std::string& format);
126 int getPrecision();
127 void collectStats();
128 std::string getStatsReport();
129
130 StatsBitSet getStatsMask();
131 StatsMapType getStatsMap();
132 void setStatsMask(StatsBitSet mask);
133
134 string getTitle(int index);
135 string getUnits(int index);
136 string getDataType(int index);
137
138 int getIntData(int index);
139 RealType getRealData(int index);
140 Vector3d getVectorData(int index);
141 potVec getPotVecData(int index);
142 Mat3x3d getMatrixData(int index);
143 std::vector<RealType> getArrayData(int index);
144
145 int getIntAverage(int index);
146 RealType getRealAverage(int index);
147 Vector3d getVectorAverage(int index);
148 potVec getPotVecAverage(int index);
149 Mat3x3d getMatrixAverage(int index);
150 std::vector<RealType> getArrayAverage(int index);
151
152 int getIntError(int index);
153 RealType getRealError(int index);
154 Vector3d getVectorError(int index);
155 potVec getPotVecError(int index);
156 Mat3x3d getMatrixError(int index);
157 std::vector<RealType> getArrayError(int index);
158
159 private:
160 SimInfo* info_ {nullptr};
161 void init();
162 bool isInit_;
163 std::vector<StatsData> data_;
164 StatsBitSet statsMask_;
165 StatsMapType statsMap_;
166 };
167} // namespace OpenMD
168
169#endif
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Definition SimInfo.hpp:93
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.