ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/brains/Snapshot.hpp
Revision: 1764
Committed: Tue Jul 3 18:32:27 2012 UTC (12 years, 10 months ago) by gezelter
File size: 11004 byte(s)
Log Message:
Refactored Snapshot and Stats to use the Accumulator classes.  Collected
a number of methods into Thermo that belonged there.

File Contents

# User Rev Content
1 gezelter 507 /*
2 gezelter 246 * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3 tim 122 *
4 gezelter 246 * The University of Notre Dame grants you ("Licensee") a
5     * non-exclusive, royalty free, license to use, modify and
6     * redistribute this software in source and binary code form, provided
7     * that the following conditions are met:
8     *
9 gezelter 1390 * 1. Redistributions of source code must retain the above copyright
10 gezelter 246 * notice, this list of conditions and the following disclaimer.
11     *
12 gezelter 1390 * 2. Redistributions in binary form must reproduce the above copyright
13 gezelter 246 * notice, this list of conditions and the following disclaimer in the
14     * documentation and/or other materials provided with the
15     * distribution.
16     *
17     * This software is provided "AS IS," without a warranty of any
18     * kind. All express or implied conditions, representations and
19     * warranties, including any implied warranty of merchantability,
20     * fitness for a particular purpose or non-infringement, are hereby
21     * excluded. The University of Notre Dame and its licensors shall not
22     * be liable for any damages suffered by licensee as a result of
23     * using, modifying or distributing the software or its
24     * derivatives. In no event will the University of Notre Dame or its
25     * licensors be liable for any lost revenue, profit or data, or for
26     * direct, indirect, special, consequential, incidental or punitive
27     * damages, however caused and regardless of the theory of liability,
28     * arising out of the use of or inability to use software, even if the
29     * University of Notre Dame has been advised of the possibility of
30     * such damages.
31 gezelter 1390 *
32     * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
33     * research, please cite the appropriate papers when you publish your
34     * work. Good starting points are:
35     *
36     * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
37     * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
38     * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).
39 gezelter 1665 * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010).
40     * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41 tim 122 */
42 gezelter 246
43 tim 122 #ifndef BRAINS_SNAPSHOT_HPP
44     #define BRAINS_SNAPSHOT_HPP
45 tim 137
46     #include <vector>
47    
48 tim 155 #include "brains/DataStorage.hpp"
49 gezelter 1757 #include "nonbonded/NonBondedInteraction.hpp"
50 gezelter 246 #include "brains/Stats.hpp"
51 tim 137
52 gezelter 1764 using namespace std;
53 gezelter 1390 namespace OpenMD{
54 tim 122
55 gezelter 1760 /**
56     * FrameData is a structure for holding system-wide dynamic data
57     * about the simulation.
58     */
59    
60 gezelter 1715 struct FrameData {
61 gezelter 1760 int id; /**< identification number of the snapshot */
62     RealType currentTime; /**< current time */
63     Mat3x3d hmat; /**< axes of the periodic box in matrix form */
64     Mat3x3d invHmat; /**< the inverse of the Hmat matrix */
65     bool orthoRhombic; /**< is this an orthorhombic periodic box? */
66     RealType totalEnergy; /**< total energy of this frame */
67 gezelter 1764 RealType translationalKinetic; /**< translational kinetic energy of this frame */
68     RealType rotationalKinetic; /**< rotational kinetic energy of this frame */
69 gezelter 1760 RealType kineticEnergy; /**< kinetic energy of this frame */
70     RealType potentialEnergy; /**< potential energy of this frame */
71 gezelter 1757 RealType shortRangePotential; /**< short-range contributions to the potential*/
72 gezelter 1760 RealType longRangePotential; /**< long-range contributions to the potential */
73     RealType bondPotential; /**< bonded contribution to the potential */
74     RealType bendPotential; /**< angle-bending contribution to the potential */
75     RealType torsionPotential; /**< dihedral (torsion angle) contribution to the potential */
76     RealType inversionPotential; /**< inversion (planarity) contribution to the potential */
77     potVec lrPotentials; /**< breakdown of long-range potentials by family */
78     potVec excludedPotentials; /**< breakdown of excluded potentials by family */
79     RealType restraintPotential; /**< potential energy of restraints */
80     RealType rawPotential; /**< unrestrained potential energy (when restraints are applied) */
81 gezelter 1764 RealType volume; /**< total volume of this frame */
82     RealType pressure; /**< pressure of this frame */
83 gezelter 1760 RealType temperature; /**< temperature of this frame */
84 gezelter 1764 pair<RealType, RealType> thermostat; /**< thermostat variables */
85 gezelter 1715 RealType electronicTemperature; /**< temperature of the electronic degrees of freedom */
86 gezelter 1764 pair<RealType, RealType> electronicThermostat; /**< thermostat variables for electronic degrees of freedom */
87     Mat3x3d barostat; /**< barostat matrix */
88 gezelter 1760 Vector3d COM; /**< location of system center of mass */
89     Vector3d COMvel; /**< system center of mass velocity */
90     Vector3d COMw; /**< system center of mass angular velocity */
91 gezelter 1764 Mat3x3d inertiaTensor; /**< inertia tensor for entire system */
92     RealType gyrationalVolume; /**< gyrational volume for entire system */
93     RealType hullVolume; /**< hull volume for entire system */
94 gezelter 1760 Mat3x3d stressTensor; /**< stress tensor */
95     Mat3x3d pressureTensor; /**< pressure tensor */
96     Vector3d systemDipole; /**< total system dipole moment */
97     Vector3d conductiveHeatFlux; /**< heat flux vector (conductive only) */
98 gezelter 1764 Vector3d convectiveHeatFlux; /**< heat flux vector (convective only) */
99     RealType conservedQuantity; /**< anything conserved by the integrator */
100 gezelter 1715 };
101    
102    
103 gezelter 507 /**
104 gezelter 1760 * @class Snapshot
105     * @brief The Snapshot class is a repository storing dynamic data during a
106     * Simulation. Every Snapshot contains FrameData (for global information)
107     * as well as DataStorage (one for Atoms, one for RigidBodies, and one for
108     * CutoffGroups).
109 gezelter 507 */
110     class Snapshot {
111 gezelter 1760
112     public:
113 gezelter 1764 Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups);
114     Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups, int storageLayout);
115 gezelter 507 /** Returns the id of this Snapshot */
116 gezelter 1764 int getID();
117 gezelter 507 /** Sets the id of this Snapshot */
118 gezelter 1764 void setID(int id);
119 tim 137
120 gezelter 1764 /** sets the state of the computed properties to false */
121     void clearDerivedProperties();
122 tim 152
123 gezelter 1764 int getSize();
124 gezelter 507 /** Returns the number of atoms */
125 gezelter 1764 int getNumberOfAtoms();
126 gezelter 507 /** Returns the number of rigid bodies */
127 gezelter 1764 int getNumberOfRigidBodies();
128 gezelter 1544 /** Returns the number of rigid bodies */
129 gezelter 1764 int getNumberOfCutoffGroups();
130 gezelter 1544
131 gezelter 507 /** Returns the H-Matrix */
132 gezelter 1764 Mat3x3d getHmat();
133 gezelter 507 /** Sets the H-Matrix */
134 gezelter 1764 void setHmat(const Mat3x3d& m);
135     /** Returns the inverse H-Matrix */
136     Mat3x3d getInvHmat();
137 gezelter 246
138 gezelter 1764 RealType getVolume();
139     void setVolume(const RealType vol);
140 tim 152
141 gezelter 1764 /** Wrapping the vector according to periodic boundary condition*/
142     void wrapVector(Vector3d& v);
143 chuckv 1302
144 gezelter 1562 /** Scaling a vector to multiples of the periodic box */
145     Vector3d scaleVector(Vector3d &v);
146    
147 gezelter 1764 void setCOM(const Vector3d &com);
148     void setCOMvel(const Vector3d &comVel);
149     void setCOMw(const Vector3d &comw);
150 gezelter 1562
151 gezelter 1104 Vector3d getCOM();
152     Vector3d getCOMvel();
153     Vector3d getCOMw();
154 gezelter 246
155 gezelter 1764 RealType getTime();
156     void increaseTime(const RealType dt);
157     void setTime(const RealType time);
158 tim 152
159 gezelter 1764 void setBondPotential(const RealType bp);
160     void setBendPotential(const RealType bp);
161     void setTorsionPotential(const RealType tp);
162     void setInversionPotential(const RealType ip);
163     RealType getBondPotential();
164     RealType getBendPotential();
165     RealType getTorsionPotential();
166     RealType getInversionPotential();
167 tim 152
168 gezelter 1764 RealType getShortRangePotential();
169 tim 152
170 gezelter 1764 void setLongRangePotential(const potVec lrPot);
171     RealType getLongRangePotential();
172     potVec getLongRangePotentials();
173 gezelter 1760
174 gezelter 1764 void setExcludedPotentials(const potVec exPot);
175     potVec getExcludedPotentials();
176    
177     void setRestraintPotential(const RealType rp);
178     RealType getRestraintPotential();
179 gezelter 1760
180 gezelter 1764 void setRawPotential(const RealType rp);
181     RealType getRawPotential();
182 gezelter 1760
183 gezelter 1764 RealType getPotentialEnergy();
184     RealType getKineticEnergy();
185     RealType getTranslationalKineticEnergy();
186     RealType getRotationalKineticEnergy();
187     void setKineticEnergy(const RealType ke);
188     void setTranslationalKineticEnergy(const RealType tke);
189     void setRotationalKineticEnergy(const RealType rke);
190     RealType getTotalEnergy();
191     void setTotalEnergy(const RealType te);
192     RealType getConservedQuantity();
193     void setConservedQuantity(const RealType cq);
194     RealType getTemperature();
195     void setTemperature(const RealType temp);
196     RealType getElectronicTemperature();
197     void setElectronicTemperature(const RealType eTemp);
198     RealType getPressure();
199     void setPressure(const RealType pressure);
200 gezelter 1760
201 gezelter 1764 Mat3x3d getPressureTensor();
202     void setPressureTensor(const Mat3x3d& pressureTensor);
203 gezelter 1760
204 gezelter 1764 Mat3x3d getStressTensor();
205     void setStressTensor(const Mat3x3d& stressTensor);
206 gezelter 1760
207 gezelter 1764 Vector3d getConductiveHeatFlux();
208     void setConductiveHeatFlux(const Vector3d& chf);
209 gezelter 1760
210 gezelter 1764 Vector3d getConvectiveHeatFlux();
211     void setConvectiveHeatFlux(const Vector3d& chf);
212 gezelter 1760
213 gezelter 1764 Vector3d getHeatFlux();
214 gezelter 1760
215 gezelter 1764 Vector3d getSystemDipole();
216     void setSystemDipole(const Vector3d& bd);
217 gezelter 1760
218 gezelter 1764 pair<RealType, RealType> getThermostat();
219     void setThermostat(const pair<RealType, RealType>& thermostat);
220 gezelter 1760
221 gezelter 1764 pair<RealType, RealType> getElectronicThermostat();
222     void setElectronicThermostat(const pair<RealType, RealType>& eThermostat);
223 gezelter 246
224 gezelter 1764 Mat3x3d getBarostat();
225     void setBarostat(const Mat3x3d& barostat);
226 gezelter 1021
227 gezelter 1764 Mat3x3d getInertiaTensor();
228     void setInertiaTensor(const Mat3x3d& inertiaTensor);
229 gezelter 1715
230 gezelter 1764 RealType getGyrationalVolume();
231     void setGyrationalVolume(const RealType gv);
232 gezelter 1715
233 gezelter 1764 RealType getHullVolume();
234     void setHullVolume(const RealType hv);
235    
236     void setOrthoTolerance(RealType orthoTolerance);
237 gezelter 1715
238 gezelter 507 DataStorage atomData;
239     DataStorage rigidbodyData;
240 gezelter 1540 DataStorage cgData;
241 gezelter 1764 FrameData frameData;
242 gezelter 1540
243 gezelter 1764 bool hasTotalEnergy;
244     bool hasTranslationalKineticEnergy;
245     bool hasRotationalKineticEnergy;
246     bool hasKineticEnergy;
247     bool hasShortRangePotential;
248     bool hasLongRangePotential;
249     bool hasPotentialEnergy;
250     bool hasVolume;
251     bool hasPressure;
252     bool hasTemperature;
253     bool hasElectronicTemperature;
254     bool hasCOM;
255     bool hasCOMvel;
256     bool hasCOMw;
257     bool hasPressureTensor;
258     bool hasSystemDipole;
259     bool hasConvectiveHeatFlux;
260     bool hasInertiaTensor;
261     bool hasGyrationalVolume;
262     bool hasHullVolume;
263     bool hasConservedQuantity;
264    
265 gezelter 507 private:
266 gezelter 1021 RealType orthoTolerance_;
267 gezelter 1764
268 gezelter 507 };
269 tim 122
270 gezelter 507 typedef DataStorage (Snapshot::*DataStoragePointer);
271 tim 122 }
272     #endif //BRAINS_SNAPSHOT_HPP

Properties

Name Value
svn:keywords Author Id Revision Date