OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
Snapshot.cpp
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 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/**
46 * @file Snapshot.cpp
47 * @author tlin
48 * @date 11/11/2004
49 * @version 1.0
50 */
51
52#include "brains/Snapshot.hpp"
53
54#include <cstdio>
55
56#include "utils/Utility.hpp"
57#include "utils/simError.h"
58
59namespace OpenMD {
60
61 Snapshot::Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups,
62 bool usePBC) :
63 atomData(nAtoms),
64 rigidbodyData(nRigidbodies),
65 cgData(nCutoffGroups, DataStorage::dslPosition), orthoTolerance_(1e-6) {
66 frameData.id = -1;
67 frameData.currentTime = 0;
68 frameData.hmat = Mat3x3d(0.0);
69 frameData.invHmat = Mat3x3d(0.0);
70 frameData.orthoRhombic = false;
71 frameData.usePBC = usePBC;
72 frameData.bondPotential = 0.0;
73 frameData.bendPotential = 0.0;
74 frameData.torsionPotential = 0.0;
75 frameData.inversionPotential = 0.0;
76 frameData.lrPotentials = potVec(0.0);
77 frameData.surfacePotential = 0.0;
78 frameData.reciprocalPotential = 0.0;
79 frameData.selfPotentials = potVec(0.0);
80 frameData.excludedPotentials = potVec(0.0);
81 frameData.restraintPotential = 0.0;
82 frameData.rawPotential = 0.0;
83 frameData.xyArea = 0.0;
84 frameData.xzArea = 0.0;
85 frameData.yzArea = 0.0;
86 frameData.volume = 0.0;
87 frameData.thermostat = make_pair(0.0, 0.0);
88 frameData.electronicThermostat = make_pair(0.0, 0.0);
89 frameData.barostat = Mat3x3d(0.0);
90 frameData.virialTensor = Mat3x3d(0.0);
91 frameData.conductiveHeatFlux = Vector3d(0.0, 0.0, 0.0);
92 frameData.spfData = std::make_shared<SPFData>();
93 clearDerivedProperties();
94 }
95
96 Snapshot::Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups,
97 int atomStorageLayout, int rigidBodyStorageLayout,
98 int cutoffGroupStorageLayout, bool usePBC) :
99 atomData(nAtoms, atomStorageLayout),
100 rigidbodyData(nRigidbodies, rigidBodyStorageLayout),
101 cgData(nCutoffGroups, cutoffGroupStorageLayout), orthoTolerance_(1e-6) {
102 frameData.id = -1;
103 frameData.currentTime = 0;
104 frameData.hmat = Mat3x3d(0.0);
105 frameData.invHmat = Mat3x3d(0.0);
106 frameData.bBox = Mat3x3d(0.0);
107 frameData.invBbox = Mat3x3d(0.0);
108 frameData.orthoRhombic = false;
109 frameData.usePBC = usePBC;
110 frameData.bondPotential = 0.0;
111 frameData.bendPotential = 0.0;
112 frameData.torsionPotential = 0.0;
113 frameData.inversionPotential = 0.0;
114 frameData.lrPotentials = potVec(0.0);
115 frameData.surfacePotential = 0.0;
116 frameData.reciprocalPotential = 0.0;
117 frameData.selfPotentials = potVec(0.0);
118 frameData.excludedPotentials = potVec(0.0);
119 frameData.restraintPotential = 0.0;
120 frameData.rawPotential = 0.0;
121 frameData.xyArea = 0.0;
122 frameData.xzArea = 0.0;
123 frameData.yzArea = 0.0;
124 frameData.volume = 0.0;
125 frameData.thermostat = make_pair(0.0, 0.0);
126 frameData.electronicThermostat = make_pair(0.0, 0.0);
127 frameData.barostat = Mat3x3d(0.0);
128 frameData.virialTensor = Mat3x3d(0.0);
129 frameData.conductiveHeatFlux = Vector3d(0.0, 0.0, 0.0);
130 frameData.spfData = std::make_shared<SPFData>();
131
132 clearDerivedProperties();
133 }
134
135 void Snapshot::clearDerivedProperties() {
136 frameData.totalEnergy = 0.0;
137 frameData.translationalKinetic = 0.0;
138 frameData.rotationalKinetic = 0.0;
139 frameData.electronicKinetic = 0.0;
140 frameData.kineticEnergy = 0.0;
141 frameData.potentialEnergy = 0.0;
142 frameData.shortRangePotential = 0.0;
143 frameData.longRangePotential = 0.0;
144 frameData.excludedPotential = 0.0;
145 frameData.selfPotential = 0.0;
146 frameData.pressure = 0.0;
147 frameData.temperature = 0.0;
148 frameData.pressureTensor = Mat3x3d(0.0);
149 frameData.systemDipole = Vector3d(0.0);
150 frameData.systemQuadrupole = Mat3x3d(0.0);
151 frameData.convectiveHeatFlux = Vector3d(0.0, 0.0, 0.0);
152 frameData.electronicTemperature = 0.0;
153 frameData.netCharge = 0.0;
154 frameData.chargeMomentum = 0.0;
155 frameData.COM = V3Zero;
156 frameData.COMvel = V3Zero;
157 frameData.COMw = V3Zero;
158
159 hasTotalEnergy = false;
160 hasTranslationalKineticEnergy = false;
161 hasRotationalKineticEnergy = false;
162 hasElectronicKineticEnergy = false;
163 hasKineticEnergy = false;
164 hasShortRangePotential = false;
165 hasLongRangePotential = false;
166 hasExcludedPotential = false;
167 hasSelfPotential = false;
168 hasPotentialEnergy = false;
169 hasXYarea = false;
170 hasXZarea = false;
171 hasYZarea = false;
172 hasVolume = false;
173 hasPressure = false;
174 hasTemperature = false;
175 hasElectronicTemperature = false;
176 hasNetCharge = false;
177 hasChargeMomentum = false;
178 hasCOM = false;
179 hasCOMvel = false;
180 hasCOMw = false;
181 hasPressureTensor = false;
182 hasSystemDipole = false;
183 hasSystemQuadrupole = false;
184 hasConvectiveHeatFlux = false;
185 hasInertiaTensor = false;
186 hasGyrationalVolume = false;
187 hasHullVolume = false;
188 hasBoundingBox = false;
189 }
190
191 /** Returns the id of this Snapshot */
192 int Snapshot::getID() { return frameData.id; }
193
194 /** Sets the id of this Snapshot */
195 void Snapshot::setID(int id) { frameData.id = id; }
196
197 int Snapshot::getSize() {
198 return atomData.getSize() + rigidbodyData.getSize();
199 }
200
201 /** Returns the number of atoms */
202 int Snapshot::getNumberOfAtoms() { return atomData.getSize(); }
203
204 /** Returns the number of rigid bodies */
205 int Snapshot::getNumberOfRigidBodies() { return rigidbodyData.getSize(); }
206
207 /** Returns the number of rigid bodies */
208 int Snapshot::getNumberOfCutoffGroups() { return cgData.getSize(); }
209
210 /** Returns the number of bytes in a FrameData structure */
211 int Snapshot::getFrameDataSize() { return sizeof(FrameData); }
212
213 /** Returns the H-Matrix */
214 Mat3x3d Snapshot::getHmat() { return frameData.hmat; }
215
216 /** Sets the H-Matrix */
217 void Snapshot::setHmat(const Mat3x3d& m) {
218 hasVolume = false;
219 frameData.hmat = m;
220 frameData.invHmat = frameData.hmat.inverse();
221
222 // determine whether the box is orthoTolerance or not
223 bool oldOrthoRhombic = frameData.orthoRhombic;
224
225 RealType smallDiag = fabs(frameData.hmat(0, 0));
226 if (smallDiag > fabs(frameData.hmat(1, 1)))
227 smallDiag = fabs(frameData.hmat(1, 1));
228 if (smallDiag > fabs(frameData.hmat(2, 2)))
229 smallDiag = fabs(frameData.hmat(2, 2));
230 RealType tol = smallDiag * orthoTolerance_;
231
232 frameData.orthoRhombic = true;
233
234 for (int i = 0; i < 3; i++) {
235 for (int j = 0; j < 3; j++) {
236 if (i != j) {
237 if (frameData.orthoRhombic) {
238 if (fabs(frameData.hmat(i, j)) >= tol)
239 frameData.orthoRhombic = false;
240 }
241 }
242 }
243 }
244
245 if (oldOrthoRhombic != frameData.orthoRhombic) {
246 // It is finally time to suppress these warnings once and for
247 // all. They were annoying and not very informative.
248
249 // if( frameData.orthoRhombic ) {
250 // snprintf( painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
251 // "OpenMD is switching from the default Non-Orthorhombic\n"
252 // "\tto the faster Orthorhombic periodic boundary
253 // computations.\n"
254 // "\tThis is usually a good thing, but if you want the\n"
255 // "\tNon-Orthorhombic computations, make the orthoBoxTolerance\n"
256 // "\tvariable ( currently set to %G ) smaller.\n",
257 // orthoTolerance_);
258 // painCave.severity = OPENMD_INFO;
259 // simError();
260 // }
261 // else {
262 // snprintf( painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
263 // "OpenMD is switching from the faster Orthorhombic to the
264 // more\n"
265 // "\tflexible Non-Orthorhombic periodic boundary computations.\n"
266 // "\tThis is usually because the box has deformed under\n"
267 // "\tNPTf integration. If you want to live on the edge with\n"
268 // "\tthe Orthorhombic computations, make the orthoBoxTolerance\n"
269 // "\tvariable ( currently set to %G ) larger.\n",
270 // orthoTolerance_);
271 // painCave.severity = OPENMD_WARNING;
272 // simError();
273 // }
274 }
275 }
276
277 /** Returns the inverse H-Matrix */
278 Mat3x3d Snapshot::getInvHmat() { return frameData.invHmat; }
279
280 /** Returns the Bounding Box */
281 Mat3x3d Snapshot::getBoundingBox() { return frameData.bBox; }
282
283 /** Sets the Bounding Box */
284 void Snapshot::setBoundingBox(const Mat3x3d& m) {
285 frameData.bBox = m;
286 frameData.invBbox = frameData.bBox.inverse();
287 hasBoundingBox = true;
288 }
289
290 /** Returns the inverse Bounding Box */
291 Mat3x3d Snapshot::getInvBoundingBox() { return frameData.invBbox; }
292
293 RealType Snapshot::getXYarea() {
294 if (!hasXYarea) {
295 Vector3d x = frameData.hmat.getColumn(0);
296 Vector3d y = frameData.hmat.getColumn(1);
297 frameData.xyArea = cross(x, y).length();
298 hasXYarea = true;
299 }
300 return frameData.xyArea;
301 }
302
303 RealType Snapshot::getXZarea() {
304 if (!hasXZarea) {
305 Vector3d x = frameData.hmat.getColumn(0);
306 Vector3d z = frameData.hmat.getColumn(2);
307 frameData.xzArea = cross(x, z).length();
308 hasXZarea = true;
309 }
310 return frameData.xzArea;
311 }
312
313 RealType Snapshot::getYZarea() {
314 if (!hasYZarea) {
315 Vector3d y = frameData.hmat.getColumn(1);
316 Vector3d z = frameData.hmat.getColumn(2);
317 frameData.yzArea = cross(y, z).length();
318 hasYZarea = true;
319 }
320 return frameData.yzArea;
321 }
322
323 RealType Snapshot::getVolume() {
324 if (!hasVolume) {
325 frameData.volume = frameData.hmat.determinant();
326 hasVolume = true;
327 }
328 return frameData.volume;
329 }
330
331 void Snapshot::setVolume(RealType vol) {
332 hasVolume = true;
333 frameData.volume = vol;
334 }
335
336 /** Wrap a vector according to periodic boundary conditions */
337 void Snapshot::wrapVector(Vector3d& pos) {
338 if (!frameData.usePBC) return;
339
340 if (!frameData.orthoRhombic) {
341 Vector3d scaled = frameData.invHmat * pos;
342 for (int i = 0; i < 3; i++) {
343 scaled[i] -= roundMe(scaled[i]);
344 }
345 // calc the wrapped real coordinates from the wrapped scaled coordinates
346 pos = frameData.hmat * scaled;
347 } else {
348 RealType scaled;
349 for (int i = 0; i < 3; i++) {
350 scaled = pos[i] * frameData.invHmat(i, i);
351 scaled -= roundMe(scaled);
352 pos[i] = scaled * frameData.hmat(i, i);
353 }
354 }
355 }
356
357 /** Scaling a vector to multiples of the periodic box */
358 inline Vector3d Snapshot::scaleVector(Vector3d& pos) {
359 Vector3d scaled;
360
361 if (!frameData.orthoRhombic)
362 scaled = frameData.invHmat * pos;
363 else {
364 // calc the scaled coordinates.
365 for (int i = 0; i < 3; i++)
366 scaled[i] = pos[i] * frameData.invHmat(i, i);
367 }
368
369 return scaled;
370 }
371
372 void Snapshot::setCOM(const Vector3d& com) {
373 frameData.COM = com;
374 hasCOM = true;
375 }
376
377 void Snapshot::setCOMvel(const Vector3d& comVel) {
378 frameData.COMvel = comVel;
379 hasCOMvel = true;
380 }
381
382 void Snapshot::setCOMw(const Vector3d& comw) {
383 frameData.COMw = comw;
384 hasCOMw = true;
385 }
386
387 Vector3d Snapshot::getCOM() { return frameData.COM; }
388
389 Vector3d Snapshot::getCOMvel() { return frameData.COMvel; }
390
391 Vector3d Snapshot::getCOMw() { return frameData.COMw; }
392
393 RealType Snapshot::getTime() { return frameData.currentTime; }
394
395 void Snapshot::increaseTime(RealType dt) { setTime(getTime() + dt); }
396
397 void Snapshot::setTime(RealType time) { frameData.currentTime = time; }
398
399 void Snapshot::setBondPotential(RealType bp) {
400 frameData.bondPotential = bp;
401 hasShortRangePotential = false;
402 hasPotentialEnergy = false;
403 hasTotalEnergy = false;
404 }
405
406 void Snapshot::setBendPotential(RealType bp) {
407 frameData.bendPotential = bp;
408 hasShortRangePotential = false;
409 hasPotentialEnergy = false;
410 hasTotalEnergy = false;
411 }
412
413 void Snapshot::setTorsionPotential(RealType tp) {
414 frameData.torsionPotential = tp;
415 hasShortRangePotential = false;
416 hasPotentialEnergy = false;
417 hasTotalEnergy = false;
418 }
419
420 void Snapshot::setInversionPotential(RealType ip) {
421 frameData.inversionPotential = ip;
422 hasShortRangePotential = false;
423 hasPotentialEnergy = false;
424 hasTotalEnergy = false;
425 }
426
427 RealType Snapshot::getBondPotential() { return frameData.bondPotential; }
428
429 RealType Snapshot::getBendPotential() { return frameData.bendPotential; }
430
431 RealType Snapshot::getTorsionPotential() {
432 return frameData.torsionPotential;
433 }
434
435 RealType Snapshot::getInversionPotential() {
436 return frameData.inversionPotential;
437 }
438
439 RealType Snapshot::getShortRangePotential() {
440 if (!hasShortRangePotential) {
441 frameData.shortRangePotential = frameData.bondPotential;
442 frameData.shortRangePotential += frameData.bendPotential;
443 frameData.shortRangePotential += frameData.torsionPotential;
444 frameData.shortRangePotential += frameData.inversionPotential;
445 hasShortRangePotential = true;
446 hasPotentialEnergy = false;
447 hasTotalEnergy = false;
448 }
449 return frameData.shortRangePotential;
450 }
451
452 void Snapshot::setSurfacePotential(RealType sp) {
453 frameData.surfacePotential = sp;
454 hasLongRangePotential = false;
455 hasPotentialEnergy = false;
456 hasTotalEnergy = false;
457 }
458
459 RealType Snapshot::getSurfacePotential() {
460 return frameData.surfacePotential;
461 }
462
463 void Snapshot::setReciprocalPotential(RealType rp) {
464 frameData.reciprocalPotential = rp;
465 hasLongRangePotential = false;
466 hasPotentialEnergy = false;
467 }
468
469 RealType Snapshot::getReciprocalPotential() {
470 return frameData.reciprocalPotential;
471 }
472
473 void Snapshot::setSelfPotentials(potVec sp) {
474 frameData.selfPotentials = sp;
475 hasSelfPotential = false;
476 hasPotentialEnergy = false;
477 hasTotalEnergy = false;
478 }
479
480 potVec Snapshot::getSelfPotentials() { return frameData.selfPotentials; }
481
482 RealType Snapshot::getSelfPotential() {
483 if (!hasSelfPotential) {
484 for (int i = 0; i < N_INTERACTION_FAMILIES; i++) {
485 frameData.selfPotential += frameData.selfPotentials[i];
486 }
487 hasSelfPotential = true;
488 hasPotentialEnergy = false;
489 hasTotalEnergy = false;
490 }
491 return frameData.selfPotential;
492 }
493
494 void Snapshot::setLongRangePotentials(potVec lrPot) {
495 frameData.lrPotentials = lrPot;
496 hasLongRangePotential = false;
497 hasPotentialEnergy = false;
498 hasTotalEnergy = false;
499 }
500
501 RealType Snapshot::getLongRangePotential() {
502 if (!hasLongRangePotential) {
503 for (int i = 0; i < N_INTERACTION_FAMILIES; i++) {
504 frameData.longRangePotential += frameData.lrPotentials[i];
505 }
506 frameData.longRangePotential += frameData.reciprocalPotential;
507 frameData.longRangePotential += frameData.surfacePotential;
508 hasLongRangePotential = true;
509 hasPotentialEnergy = false;
510 hasTotalEnergy = false;
511 }
512 return frameData.longRangePotential;
513 }
514
515 potVec Snapshot::getLongRangePotentials() { return frameData.lrPotentials; }
516
517 RealType Snapshot::getPotentialEnergy() {
518 if (!hasPotentialEnergy) {
519 frameData.potentialEnergy = this->getLongRangePotential();
520 frameData.potentialEnergy += this->getShortRangePotential();
521 frameData.potentialEnergy += this->getSelfPotential();
522 frameData.potentialEnergy += this->getExcludedPotential();
523 hasPotentialEnergy = true;
524 hasTotalEnergy = false;
525 }
526 return frameData.potentialEnergy;
527 }
528
529 void Snapshot::setPotentialEnergy(const RealType pe) {
530 frameData.potentialEnergy = pe;
531 hasPotentialEnergy = true;
532 hasTotalEnergy = false;
533 }
534
535 void Snapshot::setExcludedPotentials(potVec exPot) {
536 frameData.excludedPotentials = exPot;
537 hasExcludedPotential = false;
538 hasPotentialEnergy = false;
539 hasTotalEnergy = false;
540 }
541
542 potVec Snapshot::getExcludedPotentials() {
543 return frameData.excludedPotentials;
544 }
545
546 RealType Snapshot::getExcludedPotential() {
547 if (!hasExcludedPotential) {
548 for (int i = 0; i < N_INTERACTION_FAMILIES; i++) {
549 frameData.excludedPotential += frameData.excludedPotentials[i];
550 }
551 hasExcludedPotential = true;
552 hasPotentialEnergy = false;
553 hasTotalEnergy = false;
554 }
555 return frameData.excludedPotential;
556 }
557
558 void Snapshot::setRestraintPotential(RealType rp) {
559 frameData.restraintPotential = rp;
560 }
561
562 RealType Snapshot::getRestraintPotential() {
563 return frameData.restraintPotential;
564 }
565
566 void Snapshot::setRawPotential(RealType rp) { frameData.rawPotential = rp; }
567
568 RealType Snapshot::getRawPotential() { return frameData.rawPotential; }
569
570 void Snapshot::setSelectionPotentials(potVec selPot) {
571 frameData.selectionPotentials = selPot;
572 }
573
574 potVec Snapshot::getSelectionPotentials() {
575 return frameData.selectionPotentials;
576 }
577
578 RealType Snapshot::getTranslationalKineticEnergy() {
579 return frameData.translationalKinetic;
580 }
581
582 RealType Snapshot::getRotationalKineticEnergy() {
583 return frameData.rotationalKinetic;
584 }
585
586 RealType Snapshot::getElectronicKineticEnergy() {
587 return frameData.electronicKinetic;
588 }
589
590 RealType Snapshot::getKineticEnergy() { return frameData.kineticEnergy; }
591
592 void Snapshot::setTranslationalKineticEnergy(RealType tke) {
593 frameData.translationalKinetic = tke;
594 hasTranslationalKineticEnergy = true;
595 hasKineticEnergy = false;
596 hasTotalEnergy = false;
597 }
598
599 void Snapshot::setRotationalKineticEnergy(RealType rke) {
600 frameData.rotationalKinetic = rke;
601 hasRotationalKineticEnergy = true;
602 hasKineticEnergy = false;
603 hasTotalEnergy = false;
604 }
605
606 void Snapshot::setElectronicKineticEnergy(RealType eke) {
607 frameData.electronicKinetic = eke;
608 hasElectronicKineticEnergy = true;
609 hasKineticEnergy = false;
610 hasTotalEnergy = false;
611 }
612
613 void Snapshot::setKineticEnergy(RealType ke) {
614 frameData.kineticEnergy = ke;
615 hasKineticEnergy = true;
616 hasTotalEnergy = false;
617 }
618
619 RealType Snapshot::getTotalEnergy() { return frameData.totalEnergy; }
620
621 void Snapshot::setTotalEnergy(RealType te) {
622 frameData.totalEnergy = te;
623 hasTotalEnergy = true;
624 }
625
626 RealType Snapshot::getConservedQuantity() {
627 return frameData.conservedQuantity;
628 }
629
630 void Snapshot::setConservedQuantity(RealType cq) {
631 frameData.conservedQuantity = cq;
632 }
633
634 RealType Snapshot::getTemperature() { return frameData.temperature; }
635
636 void Snapshot::setTemperature(RealType temp) {
637 hasTemperature = true;
638 frameData.temperature = temp;
639 }
640
641 RealType Snapshot::getElectronicTemperature() {
642 return frameData.electronicTemperature;
643 }
644
645 void Snapshot::setElectronicTemperature(RealType eTemp) {
646 hasElectronicTemperature = true;
647 frameData.electronicTemperature = eTemp;
648 }
649
650 RealType Snapshot::getNetCharge() { return frameData.netCharge; }
651
652 void Snapshot::setNetCharge(RealType nChg) {
653 hasNetCharge = true;
654 frameData.netCharge = nChg;
655 }
656
657 RealType Snapshot::getChargeMomentum() { return frameData.chargeMomentum; }
658
659 void Snapshot::setChargeMomentum(RealType cMom) {
660 hasChargeMomentum = true;
661 frameData.chargeMomentum = cMom;
662 }
663
664 RealType Snapshot::getPressure() { return frameData.pressure; }
665
666 void Snapshot::setPressure(RealType pressure) {
667 hasPressure = true;
668 frameData.pressure = pressure;
669 }
670
671 Mat3x3d Snapshot::getPressureTensor() { return frameData.pressureTensor; }
672
673 void Snapshot::setPressureTensor(const Mat3x3d& pressureTensor) {
674 hasPressureTensor = true;
675 frameData.pressureTensor = pressureTensor;
676 }
677
678 void Snapshot::setVirialTensor(const Mat3x3d& virialTensor) {
679 frameData.virialTensor = virialTensor;
680 }
681
682 Mat3x3d Snapshot::getVirialTensor() { return frameData.virialTensor; }
683
684 void Snapshot::setConductiveHeatFlux(const Vector3d& chf) {
685 frameData.conductiveHeatFlux = chf;
686 }
687
688 Vector3d Snapshot::getConductiveHeatFlux() {
689 return frameData.conductiveHeatFlux;
690 }
691
692 Vector3d Snapshot::getConvectiveHeatFlux() {
693 return frameData.convectiveHeatFlux;
694 }
695
696 void Snapshot::setConvectiveHeatFlux(const Vector3d& chf) {
697 hasConvectiveHeatFlux = true;
698 frameData.convectiveHeatFlux = chf;
699 }
700
701 Vector3d Snapshot::getHeatFlux() {
702 // BE CAREFUL WITH UNITS
703 return getConductiveHeatFlux() + getConvectiveHeatFlux();
704 }
705
706 Vector3d Snapshot::getSystemDipole() { return frameData.systemDipole; }
707
708 void Snapshot::setSystemDipole(const Vector3d& bd) {
709 hasSystemDipole = true;
710 frameData.systemDipole = bd;
711 }
712
713 Mat3x3d Snapshot::getSystemQuadrupole() { return frameData.systemQuadrupole; }
714
715 void Snapshot::setSystemQuadrupole(const Mat3x3d& bq) {
716 hasSystemQuadrupole = true;
717 frameData.systemQuadrupole = bq;
718 }
719
720 void Snapshot::setThermostat(const pair<RealType, RealType>& thermostat) {
721 frameData.thermostat = thermostat;
722 }
723
724 pair<RealType, RealType> Snapshot::getThermostat() {
725 return frameData.thermostat;
726 }
727
728 void Snapshot::setElectronicThermostat(
729 const pair<RealType, RealType>& eTherm) {
730 frameData.electronicThermostat = eTherm;
731 }
732
733 pair<RealType, RealType> Snapshot::getElectronicThermostat() {
734 return frameData.electronicThermostat;
735 }
736
737 void Snapshot::setBarostat(const Mat3x3d& barostat) {
738 frameData.barostat = barostat;
739 }
740
741 Mat3x3d Snapshot::getBarostat() { return frameData.barostat; }
742
743 void Snapshot::setSPFData(std::shared_ptr<SPFData> data) {
744 frameData.spfData = data;
745 }
746
747 std::shared_ptr<SPFData> Snapshot::getSPFData() { return frameData.spfData; }
748
749 void Snapshot::setInertiaTensor(const Mat3x3d& inertiaTensor) {
750 frameData.inertiaTensor = inertiaTensor;
751 hasInertiaTensor = true;
752 }
753
754 Mat3x3d Snapshot::getInertiaTensor() { return frameData.inertiaTensor; }
755
756 void Snapshot::setGyrationalVolume(const RealType gyrationalVolume) {
757 frameData.gyrationalVolume = gyrationalVolume;
758 hasGyrationalVolume = true;
759 }
760
761 RealType Snapshot::getGyrationalVolume() {
762 return frameData.gyrationalVolume;
763 }
764
765 void Snapshot::setHullVolume(const RealType hullVolume) {
766 frameData.hullVolume = hullVolume;
767 hasHullVolume = true;
768 }
769
770 RealType Snapshot::getHullVolume() { return frameData.hullVolume; }
771
772 void Snapshot::setOrthoTolerance(RealType ot) { orthoTolerance_ = ot; }
773} // namespace OpenMD
SquareMatrix3< Real > inverse() const
Sets the value of this matrix to the inverse of itself.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Vector3< Real > cross(const Vector3< Real > &v1, const Vector3< Real > &v2)
Returns the cross product of two Vectors.
Definition Vector3.hpp:136
FrameData is a structure for holding system-wide dynamic data about the simulation.
Definition Snapshot.hpp:67