| 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 | < | * [4]  Vardeman & Gezelter, in progress (2009). | 
| 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 |  | */ | 
| 42 |  |  | 
| 42 | – | /** | 
| 43 | – | * @file Snapshot.hpp | 
| 44 | – | * @author tlin | 
| 45 | – | * @date 10/20/2004 | 
| 46 | – | * @time 23:56am | 
| 47 | – | * @version 1.0 | 
| 48 | – | */ | 
| 49 | – |  | 
| 43 |  | #ifndef BRAINS_SNAPSHOT_HPP | 
| 44 |  | #define BRAINS_SNAPSHOT_HPP | 
| 45 |  |  | 
| 46 |  | #include <vector> | 
| 47 |  |  | 
| 48 |  | #include "brains/DataStorage.hpp" | 
| 49 | + | #include "nonbonded/NonBondedInteraction.hpp" | 
| 50 |  | #include "brains/Stats.hpp" | 
| 57 | – | #include "UseTheForce/DarkSide/simulation_interface.h" | 
| 51 |  |  | 
| 52 | < |  | 
| 52 | > | using namespace std; | 
| 53 |  | namespace OpenMD{ | 
| 54 |  |  | 
| 55 |  | /** | 
| 56 | < | * @class Snapshot Snapshot.hpp "brains/Snapshot.hpp" | 
| 57 | < | * @brief Snapshot class is a repository class for storing dynamic data during | 
| 65 | < | *  Simulation | 
| 66 | < | * Every snapshot class will contain one DataStorage  for atoms and one DataStorage | 
| 67 | < | *  for rigid bodies. | 
| 56 | > | * FrameData is a structure for holding system-wide dynamic data | 
| 57 | > | * about the simulation. | 
| 58 |  | */ | 
| 59 | < | class Snapshot { | 
| 60 | < | public: | 
| 61 | < |  | 
| 62 | < | Snapshot(int nAtoms, int nRigidbodies) : atomData(nAtoms), | 
| 63 | < | rigidbodyData(nRigidbodies), | 
| 64 | < | currentTime_(0), | 
| 65 | < | orthoTolerance_(1e-6), | 
| 66 | < | orthoRhombic_(0), | 
| 67 | < | chi_(0.0), | 
| 68 | < | integralOfChiDt_(0.0), | 
| 69 | < | eta_(0.0), id_(-1), | 
| 70 | < | hasCOM_(false), hasVolume_(false), volume_(0.0) { | 
| 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 |  |  | 
| 82 | – | } | 
| 106 |  |  | 
| 107 | < | Snapshot(int nAtoms, int nRigidbodies, int storageLayout) | 
| 108 | < | : atomData(nAtoms, storageLayout), | 
| 109 | < | rigidbodyData(nRigidbodies, storageLayout), | 
| 110 | < | currentTime_(0), orthoTolerance_(1e-6), orthoRhombic_(0), chi_(0.0), | 
| 111 | < | integralOfChiDt_(0.0), eta_(0.0), id_(-1), hasCOM_(false), hasVolume_(false),volume_(0.0)  { | 
| 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 | < | } | 
| 117 | < |  | 
| 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() { | 
| 94 | < | return id_; | 
| 95 | < | } | 
| 96 | < |  | 
| 120 | > | int      getID(); | 
| 121 |  | /** Sets the id of this Snapshot */ | 
| 122 | < | void setID(int id) { | 
| 99 | < | id_ = id; | 
| 100 | < | } | 
| 122 | > | void     setID(int id); | 
| 123 |  |  | 
| 124 | < | int getSize() { | 
| 125 | < | return atomData.getSize() + rigidbodyData.getSize(); | 
| 104 | < | } | 
| 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() { | 
| 108 | < | return atomData.getSize(); | 
| 109 | < | } | 
| 110 | < |  | 
| 129 | > | int      getNumberOfAtoms(); | 
| 130 |  | /** Returns the number of rigid bodies */ | 
| 131 | < | int getNumberOfRigidBodies() { | 
| 132 | < | return rigidbodyData.getSize(); | 
| 133 | < | } | 
| 131 | > | int      getNumberOfRigidBodies(); | 
| 132 | > | /** Returns the number of rigid bodies */ | 
| 133 | > | int      getNumberOfCutoffGroups(); | 
| 134 | > | /** Returns the number of bytes in a FrameData structure */ | 
| 135 | > | static int getFrameDataSize(); | 
| 136 |  |  | 
| 137 |  | /** Returns the H-Matrix */ | 
| 138 | < | Mat3x3d getHmat() { | 
| 118 | < | return hmat_; | 
| 119 | < | } | 
| 120 | < |  | 
| 138 | > | Mat3x3d  getHmat(); | 
| 139 |  | /** Sets the H-Matrix */ | 
| 140 | < | void setHmat(const Mat3x3d& m); | 
| 140 | > | void     setHmat(const Mat3x3d& m); | 
| 141 | > | /** Returns the inverse H-Matrix */ | 
| 142 | > | Mat3x3d  getInvHmat(); | 
| 143 | > |  | 
| 144 | > | /** Returns the Bounding Box */ | 
| 145 | > | Mat3x3d  getBoundingBox(); | 
| 146 | > | /** Sets the Bounding Box */ | 
| 147 | > | void     setBoundingBox(const Mat3x3d& m); | 
| 148 | > | /** Returns the inverse Bounding Box*/ | 
| 149 | > | Mat3x3d  getInvBoundingBox(); | 
| 150 |  |  | 
| 151 | < | RealType getVolume() { | 
| 152 | < | if (hasVolume_){ | 
| 153 | < | return volume_; | 
| 127 | < | }else{ | 
| 128 | < | return hmat_.determinant(); | 
| 129 | < | } | 
| 130 | < | } | 
| 151 | > | RealType getVolume(); | 
| 152 | > | RealType getXYarea(); | 
| 153 | > | void     setVolume(const RealType vol); | 
| 154 |  |  | 
| 155 | < | void setVolume(RealType volume){ | 
| 156 | < | hasVolume_=true; | 
| 134 | < | volume_ = volume; | 
| 135 | < | } | 
| 155 | > | /** Wrapping the vector according to periodic boundary condition*/ | 
| 156 | > | void     wrapVector(Vector3d& v); | 
| 157 |  |  | 
| 158 | < | /** Returns the inverse H-Matrix */ | 
| 159 | < | Mat3x3d getInvHmat() { | 
| 139 | < | return invHmat_; | 
| 140 | < | } | 
| 158 | > | /** Scaling a vector to multiples of the periodic box */ | 
| 159 | > | Vector3d scaleVector(Vector3d &v); | 
| 160 |  |  | 
| 161 | < | /** Wrapping the vector according to periodic boundary condition*/ | 
| 162 | < | void wrapVector(Vector3d& v); | 
| 161 | > | void     setCOM(const Vector3d &com); | 
| 162 | > | void     setCOMvel(const Vector3d &comVel); | 
| 163 | > | void     setCOMw(const Vector3d &comw); | 
| 164 | > |  | 
| 165 |  | Vector3d getCOM(); | 
| 166 |  | Vector3d getCOMvel(); | 
| 167 |  | Vector3d getCOMw(); | 
| 168 |  |  | 
| 169 | < | RealType getTime() { | 
| 170 | < | return currentTime_; | 
| 171 | < | } | 
| 151 | < |  | 
| 152 | < | void increaseTime(RealType dt) { | 
| 153 | < | setTime(getTime() + dt); | 
| 154 | < | } | 
| 169 | > | RealType getTime(); | 
| 170 | > | void     increaseTime(const RealType dt); | 
| 171 | > | void     setTime(const RealType time); | 
| 172 |  |  | 
| 173 | < | void setTime(RealType time) { | 
| 174 | < | currentTime_ =time; | 
| 175 | < | //time at statData is redundant | 
| 176 | < | statData[Stats::TIME] = currentTime_; | 
| 177 | < | } | 
| 173 | > | void     setBondPotential(const RealType bp); | 
| 174 | > | void     setBendPotential(const RealType bp); | 
| 175 | > | void     setTorsionPotential(const RealType tp); | 
| 176 | > | void     setInversionPotential(const RealType ip); | 
| 177 | > | RealType getBondPotential(); | 
| 178 | > | RealType getBendPotential(); | 
| 179 | > | RealType getTorsionPotential(); | 
| 180 | > | RealType getInversionPotential(); | 
| 181 |  |  | 
| 182 | < | RealType getChi() { | 
| 163 | < | return chi_; | 
| 164 | < | } | 
| 182 | > | RealType getShortRangePotential(); | 
| 183 |  |  | 
| 184 | < | void setChi(RealType chi) { | 
| 185 | < | chi_ = chi; | 
| 186 | < | } | 
| 184 | > | void     setLongRangePotential(const potVec lrPot); | 
| 185 | > | RealType getLongRangePotential(); | 
| 186 | > | potVec   getLongRangePotentials(); | 
| 187 |  |  | 
| 188 | < | RealType getIntegralOfChiDt() { | 
| 189 | < | return integralOfChiDt_; | 
| 190 | < | } | 
| 188 | > | void     setReciprocalPotential(const RealType rp); | 
| 189 | > | RealType getReciprocalPotential(); | 
| 190 | > |  | 
| 191 | > | void     setExcludedPotentials(const potVec exPot); | 
| 192 | > | potVec   getExcludedPotentials(); | 
| 193 | > |  | 
| 194 | > | void     setRestraintPotential(const RealType rp); | 
| 195 | > | RealType getRestraintPotential(); | 
| 196 |  |  | 
| 197 | < | void setIntegralOfChiDt(RealType integralOfChiDt) { | 
| 198 | < | integralOfChiDt_ = integralOfChiDt; | 
| 176 | < | } | 
| 177 | < |  | 
| 197 | > | void     setRawPotential(const RealType rp); | 
| 198 | > | RealType getRawPotential(); | 
| 199 |  |  | 
| 200 | < | void setOrthoTolerance(RealType orthoTolerance) { | 
| 201 | < | orthoTolerance_ = orthoTolerance; | 
| 202 | < | } | 
| 200 | > | RealType getPotentialEnergy(); | 
| 201 | > | RealType getKineticEnergy(); | 
| 202 | > | RealType getTranslationalKineticEnergy(); | 
| 203 | > | RealType getRotationalKineticEnergy(); | 
| 204 | > | void     setKineticEnergy(const RealType ke); | 
| 205 | > | void     setTranslationalKineticEnergy(const RealType tke); | 
| 206 | > | void     setRotationalKineticEnergy(const RealType rke); | 
| 207 | > | RealType getTotalEnergy(); | 
| 208 | > | void     setTotalEnergy(const RealType te); | 
| 209 | > | RealType getConservedQuantity(); | 
| 210 | > | void     setConservedQuantity(const RealType cq); | 
| 211 | > | RealType getTemperature(); | 
| 212 | > | void     setTemperature(const RealType temp); | 
| 213 | > | RealType getElectronicTemperature(); | 
| 214 | > | void     setElectronicTemperature(const RealType eTemp); | 
| 215 | > | RealType getPressure(); | 
| 216 | > | void     setPressure(const RealType pressure); | 
| 217 |  |  | 
| 218 | < | Mat3x3d getEta() { | 
| 219 | < | return eta_; | 
| 185 | < | } | 
| 218 | > | Mat3x3d  getPressureTensor(); | 
| 219 | > | void     setPressureTensor(const Mat3x3d& pressureTensor); | 
| 220 |  |  | 
| 221 | < | void setEta(const Mat3x3d& eta) { | 
| 222 | < | eta_ = eta; | 
| 189 | < | } | 
| 221 | > | Mat3x3d  getStressTensor(); | 
| 222 | > | void     setStressTensor(const Mat3x3d& stressTensor); | 
| 223 |  |  | 
| 224 | < | bool hasCOM() { | 
| 225 | < | return hasCOM_; | 
| 193 | < | } | 
| 224 | > | Vector3d getConductiveHeatFlux(); | 
| 225 | > | void     setConductiveHeatFlux(const Vector3d& chf); | 
| 226 |  |  | 
| 227 | < | void setCOMprops(const Vector3d& COM, const Vector3d& COMvel, const Vector3d& COMw) { | 
| 228 | < | COM_ = COM; | 
| 229 | < | COMvel_ = COMvel; | 
| 230 | < | COMw_ = COMw; | 
| 231 | < | hasCOM_ = true; | 
| 232 | < | } | 
| 233 | < |  | 
| 227 | > | Vector3d getConvectiveHeatFlux(); | 
| 228 | > | void     setConvectiveHeatFlux(const Vector3d& chf); | 
| 229 | > |  | 
| 230 | > | Vector3d getHeatFlux(); | 
| 231 | > |  | 
| 232 | > | Vector3d getSystemDipole(); | 
| 233 | > | void     setSystemDipole(const Vector3d& bd); | 
| 234 | > |  | 
| 235 | > | pair<RealType, RealType> getThermostat(); | 
| 236 | > | void setThermostat(const pair<RealType, RealType>& thermostat); | 
| 237 | > |  | 
| 238 | > | pair<RealType, RealType> getElectronicThermostat(); | 
| 239 | > | void setElectronicThermostat(const pair<RealType, RealType>& eThermostat); | 
| 240 | > |  | 
| 241 | > | Mat3x3d  getBarostat(); | 
| 242 | > | void     setBarostat(const Mat3x3d& barostat); | 
| 243 | > |  | 
| 244 | > | Mat3x3d  getInertiaTensor(); | 
| 245 | > | void     setInertiaTensor(const Mat3x3d& inertiaTensor); | 
| 246 | > |  | 
| 247 | > | RealType getGyrationalVolume(); | 
| 248 | > | void     setGyrationalVolume(const RealType gv); | 
| 249 | > |  | 
| 250 | > | RealType getHullVolume(); | 
| 251 | > | void     setHullVolume(const RealType hv); | 
| 252 | > |  | 
| 253 | > | void     setOrthoTolerance(RealType orthoTolerance); | 
| 254 | > |  | 
| 255 |  | DataStorage atomData; | 
| 256 |  | DataStorage rigidbodyData; | 
| 257 | < | Stats statData; | 
| 258 | < |  | 
| 206 | < | private: | 
| 207 | < | RealType currentTime_; | 
| 257 | > | DataStorage cgData; | 
| 258 | > | FrameData   frameData; | 
| 259 |  |  | 
| 260 | < | Mat3x3d hmat_; | 
| 261 | < | Mat3x3d invHmat_; | 
| 262 | < | RealType orthoTolerance_; | 
| 263 | < | int orthoRhombic_; | 
| 264 | < | RealType volume_; | 
| 260 | > | bool hasTotalEnergy; | 
| 261 | > | bool hasTranslationalKineticEnergy; | 
| 262 | > | bool hasRotationalKineticEnergy; | 
| 263 | > | bool hasKineticEnergy; | 
| 264 | > | bool hasShortRangePotential; | 
| 265 | > | bool hasLongRangePotential; | 
| 266 | > | bool hasPotentialEnergy; | 
| 267 | > | bool hasXYarea; | 
| 268 | > | bool hasVolume; | 
| 269 | > | bool hasPressure; | 
| 270 | > | bool hasTemperature; | 
| 271 | > | bool hasElectronicTemperature; | 
| 272 | > | bool hasCOM; | 
| 273 | > | bool hasCOMvel; | 
| 274 | > | bool hasCOMw; | 
| 275 | > | bool hasPressureTensor; | 
| 276 | > | bool hasSystemDipole; | 
| 277 | > | bool hasConvectiveHeatFlux; | 
| 278 | > | bool hasInertiaTensor; | 
| 279 | > | bool hasGyrationalVolume; | 
| 280 | > | bool hasHullVolume; | 
| 281 | > | bool hasConservedQuantity; | 
| 282 | > | bool hasBoundingBox; | 
| 283 |  |  | 
| 284 | < | RealType chi_; | 
| 285 | < | RealType integralOfChiDt_; | 
| 286 | < | Mat3x3d eta_; | 
| 218 | < | Vector3d COM_; | 
| 219 | < | Vector3d COMvel_; | 
| 220 | < | Vector3d COMw_; | 
| 221 | < | int id_; /**< identification number of the snapshot */ | 
| 222 | < | bool hasCOM_; | 
| 223 | < | bool hasVolume_; | 
| 224 | < |  | 
| 284 | > | private: | 
| 285 | > | RealType orthoTolerance_; | 
| 286 | > |  | 
| 287 |  | }; | 
| 288 |  |  | 
| 289 |  | typedef DataStorage (Snapshot::*DataStoragePointer); |