ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/brains/Snapshot.hpp
(Generate patch)

Comparing trunk/src/brains/Snapshot.hpp (file contents):
Revision 146 by tim, Fri Oct 22 23:09:57 2004 UTC vs.
Revision 1925 by gezelter, Wed Aug 7 15:24:16 2013 UTC

# Line 1 | Line 1
1   /*
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.
2 > * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3   *
4 + * 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 + * 1. Redistributions of source code must retain the above copyright
10 + *    notice, this list of conditions and the following disclaimer.
11 + *
12 + * 2. Redistributions in binary form must reproduce the above copyright
13 + *    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 + *
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, 234107 (2008).          
39 + * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 + * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
25
26 /**
27  * @file Snapshot.hpp
28  * @author tlin
29  * @date 10/20/2004
30  * @time 23:56am
31  * @version 1.0
32  */
42    
43   #ifndef BRAINS_SNAPSHOT_HPP
44   #define BRAINS_SNAPSHOT_HPP
45  
46   #include <vector>
47  
48 < #include "math/Vector3.hpp"
49 < #include "math/SquareMatrix3.hpp"
48 > #include "brains/DataStorage.hpp"
49 > #include "nonbonded/NonBondedInteraction.hpp"
50 > #include "brains/Stats.hpp"
51  
52   using namespace std;
53 + namespace OpenMD{
54  
55 < namespace oopse{
55 >  /**
56 >   * FrameData is a structure for holding system-wide dynamic data
57 >   * about the simulation.
58 >   */
59 >  
60 >  struct FrameData {
61 >    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 >    Mat3x3d  bBox;                /**< axes of a bounding box in matrix form */
66 >    Mat3x3d  invBbox;             /**< the inverse of the bounding box */
67 >    bool     orthoRhombic;        /**< is this an orthorhombic periodic box? */
68 >    RealType totalEnergy;         /**< total energy of this frame */
69 >    RealType translationalKinetic; /**< translational kinetic energy of this frame */
70 >    RealType rotationalKinetic;   /**< rotational kinetic energy of this frame */
71 >    RealType kineticEnergy;       /**< kinetic energy of this frame */
72 >    RealType potentialEnergy;     /**< potential energy of this frame */
73 >    RealType shortRangePotential; /**< short-range contributions to the potential*/
74 >    RealType longRangePotential;  /**< long-range contributions to the potential */
75 >    RealType reciprocalPotential; /**< reciprocal-space contributions to the potential */
76 >    RealType bondPotential;       /**< bonded contribution to the potential */
77 >    RealType bendPotential;       /**< angle-bending contribution to the potential */
78 >    RealType torsionPotential;    /**< dihedral (torsion angle) contribution to the potential */
79 >    RealType inversionPotential;  /**< inversion (planarity) contribution to the potential */
80 >    potVec   lrPotentials;        /**< breakdown of long-range potentials by family */
81 >    potVec   excludedPotentials;  /**< breakdown of excluded potentials by family */
82 >    RealType restraintPotential;  /**< potential energy of restraints */
83 >    RealType rawPotential;        /**< unrestrained potential energy (when restraints are applied) */
84 >    RealType xyArea;              /**< XY area of this frame */
85 >    RealType volume;              /**< total volume of this frame */
86 >    RealType pressure;            /**< pressure of this frame */
87 >    RealType temperature;         /**< temperature of this frame */
88 >    pair<RealType, RealType> thermostat;    /**< thermostat variables */
89 >    RealType electronicTemperature; /**< temperature of the electronic degrees of freedom */
90 >    pair<RealType, RealType> electronicThermostat; /**< thermostat variables for electronic degrees of freedom */
91 >    Mat3x3d  barostat;            /**< barostat matrix */
92 >    Vector3d COM;                 /**< location of system center of mass */
93 >    Vector3d COMvel;              /**< system center of mass velocity */
94 >    Vector3d COMw;                /**< system center of mass angular velocity */
95 >    Mat3x3d  inertiaTensor;       /**< inertia tensor for entire system */
96 >    RealType gyrationalVolume;    /**< gyrational volume for entire system */
97 >    RealType hullVolume;          /**< hull volume for entire system */
98 >    Mat3x3d  stressTensor;        /**< stress tensor */
99 >    Mat3x3d  pressureTensor;      /**< pressure tensor */
100 >    Vector3d systemDipole;        /**< total system dipole moment */
101 >    Vector3d conductiveHeatFlux;  /**< heat flux vector (conductive only) */
102 >    Vector3d convectiveHeatFlux;  /**< heat flux vector (convective only) */
103 >    RealType conservedQuantity;   /**< anything conserved by the integrator */
104 >  };
105  
46    //forward declaration
47    class Snapshot;
48    class SnapshotManager;
106  
107 <    /**
108 <     * @struct DataStorage
109 <     * @brief
110 <     */
111 <    class DataStorage {
112 <        public:
113 <            DataStorage() {};
114 <            DataStorage(size_t size);
58 <            void resize(size_t size);
59 <            void reserve(size_t size);
60 <            
61 <        //friend Snapshot;
62 <        //friend SnapshotManager;
63 <        //private:
64 <            vector<Vector3d> position;               /** position array */
65 <            vector<Vector3d> velocity;               /** velocity array */
66 <            vector<RotMat3x3d> Amat;            /** rotation matrix array */
67 <            vector<Vector3d> angularMomentum;/** velocity array */
68 <            vector<Vector3d> ul;                /** the lab frame unit vector array*/
69 <            vector<double> zAngle;              /** z -angle array */        
70 <            vector<Vector3d> force;               /** force array */
71 <            vector<Vector3d> torque;               /** torque array */
107 >  /**
108 >   * @class Snapshot
109 >   * @brief The Snapshot class is a repository storing dynamic data during a
110 >   * Simulation.  Every Snapshot contains FrameData (for global information)
111 >   * as well as DataStorage (one for Atoms, one for RigidBodies, and one for
112 >   * CutoffGroups).
113 >   */
114 >  class Snapshot {
115  
116 <    };
116 >  public:            
117 >    Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups);
118 >    Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups, int storageLayout);    
119 >    /** Returns the id of this Snapshot */
120 >    int      getID();
121 >    /** Sets the id of this Snapshot */
122 >    void     setID(int id);
123  
124 <    /**
125 <     * @class Snapshot Snapshot.hpp "brains/Snapshot.hpp"
126 <     * @brief Snapshot class is a repository class for storing dynamic data during
127 <     *  Simulation
128 <     * Every snapshot class will contain one DataStorage  for atoms and one DataStorage
129 <     *  for rigid bodies.
130 <     * @see SimData
131 <     */
132 <    class Snapshot {
133 <        public:
124 >    /** sets the state of the computed properties to false */
125 >    void     clearDerivedProperties();
126 >
127 >    int      getSize();
128 >    /** Returns the number of atoms */
129 >    int      getNumberOfAtoms();
130 >    /** Returns the number of rigid bodies */
131 >    int      getNumberOfRigidBodies();
132 >    /** Returns the number of rigid bodies */
133 >    int      getNumberOfCutoffGroups();
134 >
135 >    /** Returns the H-Matrix */
136 >    Mat3x3d  getHmat();
137 >    /** Sets the H-Matrix */
138 >    void     setHmat(const Mat3x3d& m);
139 >    /** Returns the inverse H-Matrix */
140 >    Mat3x3d  getInvHmat();
141 >
142 >    /** Returns the Bounding Box */
143 >    Mat3x3d  getBoundingBox();
144 >    /** Sets the Bounding Box */
145 >    void     setBoundingBox(const Mat3x3d& m);
146 >    /** Returns the inverse Bounding Box*/
147 >    Mat3x3d  getInvBoundingBox();
148              
149 <            Snapshot() {}
150 <            Snapshot(int i) {
149 >    RealType getVolume();
150 >    RealType getXYarea();
151 >    void     setVolume(const RealType vol);
152  
153 <            }
153 >    /** Wrapping the vector according to periodic boundary condition*/
154 >    void     wrapVector(Vector3d& v);
155  
156 <            Snapshot(const Snapshot& s);
156 >    /** Scaling a vector to multiples of the periodic box */
157 >    Vector3d scaleVector(Vector3d &v);
158  
159 <            Snapshot& operator =(const Snapshot& s);
159 >    void     setCOM(const Vector3d &com);
160 >    void     setCOMvel(const Vector3d &comVel);
161 >    void     setCOMw(const Vector3d &comw);
162 >
163 >    Vector3d getCOM();
164 >    Vector3d getCOMvel();
165 >    Vector3d getCOMw();
166              
167 <            /** Returns the id of this Snapshot */
168 <            int getID() {
169 <                return id_;
98 <            }
167 >    RealType getTime();
168 >    void     increaseTime(const RealType dt);
169 >    void     setTime(const RealType time);
170  
171 <            /** Sets the id of this Snapshot */
172 <            void setID(int id) {
173 <                id_ = id;
174 <            }
171 >    void     setBondPotential(const RealType bp);
172 >    void     setBendPotential(const RealType bp);
173 >    void     setTorsionPotential(const RealType tp);
174 >    void     setInversionPotential(const RealType ip);
175 >    RealType getBondPotential();
176 >    RealType getBendPotential();
177 >    RealType getTorsionPotential();
178 >    RealType getInversionPotential();
179  
180 <            //template<typename T>
106 <            //static typename T::ElemPointerType getArrayPointer(vector<T>& v) {
107 <            //    return v[0]->getArrayPointer();
108 <            //}
180 >    RealType getShortRangePotential();
181  
182 <            static double* getArrayPointer(vector<Vector3d>& v) {
183 <                assert(v.size() > 0);
184 <                return v[0].getArrayPointer();
185 <            }
182 >    void     setLongRangePotential(const potVec lrPot);
183 >    RealType getLongRangePotential();
184 >    potVec   getLongRangePotentials();
185 >
186 >    void     setReciprocalPotential(const RealType rp);
187 >    RealType getReciprocalPotential();
188 >    
189 >    void     setExcludedPotentials(const potVec exPot);
190 >    potVec   getExcludedPotentials();
191 >  
192 >    void     setRestraintPotential(const RealType rp);
193 >    RealType getRestraintPotential();
194 >
195 >    void     setRawPotential(const RealType rp);
196 >    RealType getRawPotential();
197 >
198 >    RealType getPotentialEnergy();
199 >    RealType getKineticEnergy();
200 >    RealType getTranslationalKineticEnergy();
201 >    RealType getRotationalKineticEnergy();
202 >    void     setKineticEnergy(const RealType ke);
203 >    void     setTranslationalKineticEnergy(const RealType tke);
204 >    void     setRotationalKineticEnergy(const RealType rke);
205 >    RealType getTotalEnergy();
206 >    void     setTotalEnergy(const RealType te);
207 >    RealType getConservedQuantity();
208 >    void     setConservedQuantity(const RealType cq);
209 >    RealType getTemperature();
210 >    void     setTemperature(const RealType temp);
211 >    RealType getElectronicTemperature();
212 >    void     setElectronicTemperature(const RealType eTemp);
213 >    RealType getPressure();
214 >    void     setPressure(const RealType pressure);
215 >
216 >    Mat3x3d  getPressureTensor();
217 >    void     setPressureTensor(const Mat3x3d& pressureTensor);
218 >
219 >    Mat3x3d  getStressTensor();
220 >    void     setStressTensor(const Mat3x3d& stressTensor);
221 >
222 >    Vector3d getConductiveHeatFlux();
223 >    void     setConductiveHeatFlux(const Vector3d& chf);
224 >
225 >    Vector3d getConvectiveHeatFlux();
226 >    void     setConvectiveHeatFlux(const Vector3d& chf);
227 >
228 >    Vector3d getHeatFlux();
229 >    
230 >    Vector3d getSystemDipole();
231 >    void     setSystemDipole(const Vector3d& bd);
232 >
233 >    pair<RealType, RealType> getThermostat();
234 >    void setThermostat(const pair<RealType, RealType>& thermostat);
235 >
236 >    pair<RealType, RealType> getElectronicThermostat();
237 >    void setElectronicThermostat(const pair<RealType, RealType>& eThermostat);
238              
239 <            static double* getArrayPointer(vector<RotMat3x3d>& v) {
240 <                assert(v.size() > 0);
117 <                return v[0].getArrayPointer();
118 <            }
119 <            
120 <            static double* getArrayPointer(vector<double>& v) {
121 <                assert(v.size() > 0);
122 <                return &(v[0]);
123 <            }
124 <            
125 <            /** */
126 <            void resize(size_t size);
239 >    Mat3x3d  getBarostat();
240 >    void     setBarostat(const Mat3x3d& barostat);
241  
242 +    Mat3x3d  getInertiaTensor();
243 +    void     setInertiaTensor(const Mat3x3d& inertiaTensor);
244  
245 <            /** */
246 <            void reserve(size_t size);
245 >    RealType getGyrationalVolume();
246 >    void     setGyrationalVolume(const RealType gv);
247  
248 <            DataStorage atomData;
249 <            DataStorage rigidbodyData;
248 >    RealType getHullVolume();
249 >    void     setHullVolume(const RealType hv);
250 >    
251 >    void     setOrthoTolerance(RealType orthoTolerance);
252  
253 <            friend class SnapshotManager;
254 <        private:
253 >    DataStorage atomData;
254 >    DataStorage rigidbodyData;
255 >    DataStorage cgData;
256 >    FrameData   frameData;
257  
258 <            int id_; /**< identification number of the snapshot */
259 <    };
258 >    bool hasTotalEnergy;        
259 >    bool hasTranslationalKineticEnergy;    
260 >    bool hasRotationalKineticEnergy;    
261 >    bool hasKineticEnergy;    
262 >    bool hasShortRangePotential;
263 >    bool hasLongRangePotential;
264 >    bool hasPotentialEnergy;    
265 >    bool hasXYarea;
266 >    bool hasVolume;        
267 >    bool hasPressure;      
268 >    bool hasTemperature;    
269 >    bool hasElectronicTemperature;
270 >    bool hasCOM;            
271 >    bool hasCOMvel;
272 >    bool hasCOMw;
273 >    bool hasPressureTensor;    
274 >    bool hasSystemDipole;    
275 >    bool hasConvectiveHeatFlux;
276 >    bool hasInertiaTensor;
277 >    bool hasGyrationalVolume;
278 >    bool hasHullVolume;
279 >    bool hasConservedQuantity;
280 >    bool hasBoundingBox;
281  
282 <    typedef DataStorage* (Snapshot::*DataStoragePointer);
282 >  private:
283 >    RealType orthoTolerance_;
284 >    
285 >  };
286 >
287 >  typedef DataStorage (Snapshot::*DataStoragePointer);
288   }
289   #endif //BRAINS_SNAPSHOT_HPP

Comparing trunk/src/brains/Snapshot.hpp (property svn:keywords):
Revision 146 by tim, Fri Oct 22 23:09:57 2004 UTC vs.
Revision 1925 by gezelter, Wed Aug 7 15:24:16 2013 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines