OpenMD 3.2
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
StuntDouble.hpp
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 following paper when you publish your work:
33 *
34 * [1] Drisko et al., J. Open Source Softw. 9, 7004 (2024).
35 *
36 * Good starting points for code and simulation methodology are:
37 *
38 * [2] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
39 * [3] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
40 * [4] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).
41 * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
42 * [6] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012).
43 * [7] Lamichhane, Gezelter & Newman, J. Chem. Phys. 141, 134109 (2014).
44 * [8] Bhattarai, Newman & Gezelter, Phys. Rev. B 99, 094106 (2019).
45 * [9] Drisko & Gezelter, J. Chem. Theory Comput. 20, 4986-4997 (2024).
46 */
47
48/**
49 * @file StuntDouble.hpp
50 * @author tlin
51 * @date 10/22/2004
52 * @version 1.0
53 */
54
55#ifndef PRIMITIVES_STUNTDOUBLE_HPP
56#define PRIMITIVES_STUNTDOUBLE_HPP
57
58#include <memory>
59#include <vector>
60
61#include "brains/Snapshot.hpp"
63#include "math/Quaternion.hpp"
65#include "math/Vector3.hpp"
66#include "utils/PropertyMap.hpp"
67#include "visitors/BaseVisitor.hpp"
68
69namespace OpenMD {
70
71 /**
72 * @class StuntDouble StuntDouble.hpp "Primitives/StuntDouble.hpp"
73 * @brief
74 * "Don't move, or you're dead! Stand up! Captain, we've got them!"
75 *
76 * "Spectacular stunt, my friends, but all for naught. Turn around
77 * please. Ha. What a pity. What a pity. So, Princess, you thought
78 * you could outwit the imperious forces of...."
79 *
80 * "You idiots! These are not them. You've captured their stunt
81 * doubles! Search the area. Find them! Find them!"
82 *
83 * StuntDouble is a very strange idea. A StuntDouble stands in for
84 * some object that can be manipulated by the Integrators or
85 * Minimizers. Some of the manipulable objects are Atoms, some are
86 * DirectionalAtoms, and some are RigidBodies. StuntDouble
87 * provides an interface for the Integrators and Minimizers to use,
88 * and does some preliminary sanity checking so that the program
89 * doesn't try to do something stupid like torque an Atom (The
90 * quotes above are from Spaceballs...)
91 *
92 * @note the dynamic data of stuntDouble will be stored outside of the class
93 */
94 class StuntDouble {
95 public:
96 enum ObjectType { otAtom, otDAtom, otRigidBody };
97
98 virtual ~StuntDouble() = default;
99
100 /**
101 * Returns the global index of this stuntDouble.
102 * @return the global index of this stuntDouble
103 */
104 int getGlobalIndex() { return globalIndex_; }
105
106 /**
107 * Sets the global index of this stuntDouble.
108 * @param index new global index to be set
109 */
110 void setGlobalIndex(int index) { globalIndex_ = index; }
111
112 /**
113 * Returns the local index of this stuntDouble
114 * @return the local index of this stuntDouble
115 */
116 int getLocalIndex() { return localIndex_; }
117
118 /**
119 * Sets the local index of this stuntDouble
120 * @param index new index to be set
121 */
122 void setLocalIndex(int index) { localIndex_ = index; }
123
124 int getGlobalIntegrableObjectIndex() {
125 return globalIntegrableObjectIndex_;
126 }
127
128 void setGlobalIntegrableObjectIndex(int index) {
129 globalIntegrableObjectIndex_ = index;
130 }
131
132 /**
133 * Sets the Snapshot Manager of this stuntDouble
134 */
135 void setSnapshotManager(SnapshotManager* sman) { snapshotMan_ = sman; }
136
137 /**
138 * Tests if this stuntDouble is an atom
139 * @return true is this stuntDouble is an atom(or a directional atom),
140 * return false otherwise
141 */
142 bool isAtom() { return objType_ == otAtom || objType_ == otDAtom; }
143
144 /**
145 * Tests if this stuntDouble is an directional atom
146 * @return true if this stuntDouble is an directional atom, return false
147 * otherwise
148 */
149 bool isDirectionalAtom() { return objType_ == otDAtom; }
150
151 /**
152 * Tests if this stuntDouble is a rigid body.
153 * @return true if this stuntDouble is a rigid body, otherwise return false
154 */
155 bool isRigidBody() { return objType_ == otRigidBody; }
156
157 /**
158 * Tests if this stuntDouble is a directional one.
159 * @return true is this stuntDouble is a directional atom or a rigid body,
160 * return false otherwise
161 */
163
164 /**
165 * Freezes out all velocity, angular velocity, forces and torques
166 * on this StuntDouble. Also computes the number of frozen degrees
167 * of freedom.
168 * @return the total number of frozen degrees of freedom
169 */
170 int freeze() {
171 int fdf = 3;
172
173 setVel(V3Zero);
174 setFrc(V3Zero);
175 if (isDirectional()) {
176 setJ(V3Zero);
177 setTrq(V3Zero);
178 if (isLinear())
179 fdf += 2;
180 else
181 fdf += 3;
182 }
183 return fdf;
184 }
185
186 /**
187 * Returns the previous position of this stuntDouble
188 * @return the position of this stuntDouble
189 */
190 Vector3d getPrevPos() {
191 return ((snapshotMan_->getPrevSnapshot())->*storage_)
192 .position[localIndex_];
193 }
194
195 /**
196 * Returns the current position of this stuntDouble
197 * @return the position of this stuntDouble
198 */
199 Vector3d getPos() {
200 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
201 .position[localIndex_];
202 }
203
204 /**
205 * Returns the position of this stuntDouble in specified snapshot
206 * @return the position of this stuntDouble
207 * @param snapshotNo
208 */
209 Vector3d getPos(int snapshotNo) {
210 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
211 .position[localIndex_];
212 }
213
214 /**
215 * Sets the previous position of this stuntDouble
216 * @param pos new position
217 * @see #getPos
218 */
219 void setPrevPos(const Vector3d& pos) {
220 ((snapshotMan_->getPrevSnapshot())->*storage_).position[localIndex_] =
221 pos;
222 }
223
224 /**
225 * Sets the current position of this stuntDouble
226 * @param pos new position
227 */
228 void setPos(const Vector3d& pos) {
229 DataStorage& data = snapshotMan_->getCurrentSnapshot()->*storage_;
230 data.position[localIndex_] = pos;
231 //((snapshotMan_->getCurrentSnapshot())->*storage_).position[localIndex_]
232 //= pos;
233 }
234
235 /**
236 * Sets the position of this stuntDouble in specified snapshot
237 * @param pos position to be set
238 * @param snapshotNo
239 * @see #getPos
240 */
241 void setPos(const Vector3d& pos, int snapshotNo) {
242 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
243 .position[localIndex_] = pos;
244 }
245
246 /**
247 * Returns the previous velocity of this stuntDouble
248 * @return the velocity of this stuntDouble
249 */
250 Vector3d getPrevVel() {
251 return ((snapshotMan_->getPrevSnapshot())->*storage_)
252 .velocity[localIndex_];
253 }
254
255 /**
256 * Returns the current velocity of this stuntDouble
257 * @return the velocity of this stuntDouble
258 */
259 Vector3d getVel() {
260 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
261 .velocity[localIndex_];
262 }
263
264 /**
265 * Returns the velocity of this stuntDouble in specified snapshot
266 * @return the velocity of this stuntDouble
267 * @param snapshotNo
268 */
269 Vector3d getVel(int snapshotNo) {
270 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
271 .velocity[localIndex_];
272 }
273
274 Vector3d getVel(Snapshot* snapshot) {
275 return (snapshot->*storage_).velocity[localIndex_];
276 }
277
278 /**
279 * Sets the previous velocity of this stuntDouble
280 * @param vel new velocity
281 * @see #getVel
282 */
283 void setPrevVel(const Vector3d& vel) {
284 ((snapshotMan_->getPrevSnapshot())->*storage_).velocity[localIndex_] =
285 vel;
286 }
287
288 /**
289 * Sets the current velocity of this stuntDouble
290 * @param vel new velocity
291 */
292 void setVel(const Vector3d& vel) {
293 ((snapshotMan_->getCurrentSnapshot())->*storage_).velocity[localIndex_] =
294 vel;
295 }
296
297 /**
298 * Sets the velocity of this stuntDouble in specified snapshot
299 * @param vel velocity to be set
300 * @param snapshotNo
301 * @see #getVel
302 */
303 void setVel(const Vector3d& vel, int snapshotNo) {
304 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
305 .velocity[localIndex_] = vel;
306 }
307
308 /**
309 * Returns the previous rotation matrix of this stuntDouble
310 * @return the rotation matrix of this stuntDouble
311 */
312 RotMat3x3d getPrevA() {
313 return ((snapshotMan_->getPrevSnapshot())->*storage_).aMat[localIndex_];
314 }
315
316 /**
317 * Returns the current rotation matrix of this stuntDouble
318 * @return the rotation matrix of this stuntDouble
319 */
320 RotMat3x3d getA() {
321 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
322 .aMat[localIndex_];
323 }
324
325 /**
326 * Returns the rotation matrix of this stuntDouble in specified snapshot
327 *
328 * @return the rotation matrix of this stuntDouble
329 * @param snapshotNo
330 */
331 RotMat3x3d getA(int snapshotNo) {
332 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
333 .aMat[localIndex_];
334 }
335
336 /**
337 * Sets the previous rotation matrix of this stuntDouble
338 * @param a new rotation matrix
339 * @see #getA
340 */
341 virtual void setPrevA(const RotMat3x3d& a) {
342 ((snapshotMan_->getPrevSnapshot())->*storage_).aMat[localIndex_] = a;
343 }
344
345 /**
346 * Sets the current rotation matrix of this stuntDouble
347 * @param a new rotation matrix
348 */
349 virtual void setA(const RotMat3x3d& a) {
350 ((snapshotMan_->getCurrentSnapshot())->*storage_).aMat[localIndex_] = a;
351 }
352
353 /**
354 * Sets the rotation matrix of this stuntDouble in specified snapshot
355 * @param a rotation matrix to be set
356 * @param snapshotNo
357 * @see #getA
358 */
359 virtual void setA(const RotMat3x3d& a, int snapshotNo) {
360 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).aMat[localIndex_] =
361 a;
362 }
363
364 /**
365 * Returns the previous angular momentum of this stuntDouble (body-fixed).
366 * @return the angular momentum of this stuntDouble
367 */
368 Vector3d getPrevJ() {
369 return ((snapshotMan_->getPrevSnapshot())->*storage_)
370 .angularMomentum[localIndex_];
371 }
372
373 /**
374 * Returns the current angular momentum of this stuntDouble (body -fixed).
375 * @return the angular momentum of this stuntDouble
376 */
377 Vector3d getJ() {
378 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
379 .angularMomentum[localIndex_];
380 }
381
382 /**
383 * Returns the angular momentum of this stuntDouble in specified snapshot
384 * (body-fixed).
385 * @return the angular momentum of this stuntDouble
386 * @param snapshotNo
387 */
388 Vector3d getJ(int snapshotNo) {
389 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
390 .angularMomentum[localIndex_];
391 }
392
393 /**
394 * Sets the previous angular momentum of this stuntDouble (body-fixed).
395 * @param angMom new angular momentum
396 * @see #getJ
397 */
398 void setPrevJ(const Vector3d& angMom) {
399 ((snapshotMan_->getPrevSnapshot())->*storage_)
400 .angularMomentum[localIndex_] = angMom;
401 }
402
403 /**
404 * Sets the current angular momentum of this stuntDouble (body-fixed).
405 * @param angMom new angular momentum
406 */
407 void setJ(const Vector3d& angMom) {
408 ((snapshotMan_->getCurrentSnapshot())->*storage_)
409 .angularMomentum[localIndex_] = angMom;
410 }
411
412 /**
413 * Sets the angular momentum of this stuntDouble in specified
414 * snapshot(body-fixed).
415 * @param angMom angular momentum to be set
416 * @param snapshotNo
417 * @see #getJ
418 */
419 void setJ(const Vector3d& angMom, int snapshotNo) {
420 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
421 .angularMomentum[localIndex_] = angMom;
422 }
423
424 /**
425 * Returns system Center of Mass for stuntDouble frame from snapshot
426 *
427 */
428 Vector3d getCOM() { return (snapshotMan_->getCurrentSnapshot())->getCOM(); }
429
430 /**
431 * Returns system Center of Mass velocity for stuntDouble frame from
432 * snapshot
433 */
434 Vector3d getCOMvel() {
435 return (snapshotMan_->getCurrentSnapshot())->getCOMvel();
436 }
437
438 /**
439 * Returns system Center of Mass angular momentum for stuntDouble frame from
440 * snapshot
441 */
442 Vector3d getCOMw() {
443 return (snapshotMan_->getCurrentSnapshot())->getCOMw();
444 }
445
446 /**
447 * Returns system Center of Mass for stuntDouble frame from snapshot
448 */
449 Vector3d getCOM(int snapshotNo) {
450 return (snapshotMan_->getSnapshot(snapshotNo))->getCOM();
451 }
452
453 /**
454 * Returns system Center of Mass velocity for stuntDouble frame from
455 * snapshot
456 */
457 Vector3d getCOMvel(int snapshotNo) {
458 return (snapshotMan_->getSnapshot(snapshotNo))->getCOMvel();
459 }
460
461 /**
462 * Returns system Center of Mass angular momentum for stuntDouble frame from
463 * snapshot
464 */
465 Vector3d getCOMw(int snapshotNo) {
466 return (snapshotMan_->getSnapshot(snapshotNo))->getCOMw();
467 }
468
469 /**
470 * Returns the previous quaternion of this stuntDouble
471 * @return the quaternion of this stuntDouble
472 */
473 Quat4d getPrevQ() {
474 return ((snapshotMan_->getPrevSnapshot())->*storage_)
475 .aMat[localIndex_]
476 .toQuaternion();
477 }
478
479 /**
480 * Returns the current quaternion of this stuntDouble
481 * @return the quaternion of this stuntDouble
482 */
483 Quat4d getQ() {
484 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
485 .aMat[localIndex_]
486 .toQuaternion();
487 }
488
489 /**
490 * Returns the quaternion of this stuntDouble in specified snapshot
491 * @return the quaternion of this stuntDouble
492 * @param snapshotNo
493 */
494 Quat4d getQ(int snapshotNo) {
495 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
496 .aMat[localIndex_]
497 .toQuaternion();
498 }
499
500 /**
501 * Sets the previous quaternion of this stuntDouble
502 * @param q new quaternion
503 * @note actual storage data is rotation matrix
504 */
505 void setPrevQ(const Quat4d& q) { setPrevA(q); }
506
507 /**
508 * Sets the current quaternion of this stuntDouble
509 * @param q new quaternion
510 * @note actual storage data is rotation matrix
511 */
512 void setQ(const Quat4d& q) { setA(q); }
513
514 /**
515 * Sets the quaternion of this stuntDouble in specified snapshot
516 *
517 * @param q quaternion to be set
518 * @param snapshotNo
519 * @note actual storage data is rotation matrix
520 */
521 void setQ(const Quat4d& q, int snapshotNo) { setA(q, snapshotNo); }
522
523 /**
524 * Returns the previous euler angles of this stuntDouble
525 * @return the euler angles of this stuntDouble
526 */
527 Vector3d getPrevEuler() {
528 return ((snapshotMan_->getPrevSnapshot())->*storage_)
529 .aMat[localIndex_]
530 .toEulerAngles();
531 }
532
533 /**
534 * Returns the current euler angles of this stuntDouble
535 * @return the euler angles of this stuntDouble
536 */
537 Vector3d getEuler() {
538 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
539 .aMat[localIndex_]
540 .toEulerAngles();
541 }
542
543 /**
544 * Returns the euler angles of this stuntDouble in specified snapshot.
545 * @return the euler angles of this stuntDouble
546 * @param snapshotNo
547 */
548 Vector3d getEuler(int snapshotNo) {
549 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
550 .aMat[localIndex_]
551 .toEulerAngles();
552 }
553
554 /**
555 * Sets the previous euler angles of this stuntDouble.
556 * @param euler new euler angles
557 * @see #getEuler
558 * @note actual storage data is rotation matrix
559 */
560 void setPrevEuler(const Vector3d& euler) {
561 ((snapshotMan_->getPrevSnapshot())->*storage_)
562 .aMat[localIndex_]
563 .setupRotMat(euler);
564 }
565
566 /**
567 * Sets the current euler angles of this stuntDouble
568 * @param euler new euler angles
569 */
570 void setEuler(const Vector3d& euler) {
571 ((snapshotMan_->getCurrentSnapshot())->*storage_)
572 .aMat[localIndex_]
573 .setupRotMat(euler);
574 }
575
576 /**
577 * Sets the euler angles of this stuntDouble in specified snapshot
578 *
579 * @param euler euler angles to be set
580 * @param snapshotNo
581 * @note actual storage data is rotation matrix
582 */
583 void setEuler(const Vector3d& euler, int snapshotNo) {
584 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
585 .aMat[localIndex_]
586 .setupRotMat(euler);
587 }
588
589 /**
590 * Returns the previous dipole vector of this stuntDouble
591 * @return the dipole vector of this stuntDouble
592 */
593 Vector3d getPrevDipole() {
594 return ((snapshotMan_->getPrevSnapshot())->*storage_).dipole[localIndex_];
595 }
596
597 /**
598 * Returns the current dipole vector of this stuntDouble
599 * @return the dipole vector of this stuntDouble
600 */
601 Vector3d getDipole() {
602 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
603 .dipole[localIndex_];
604 }
605
606 /**
607 * Returns the dipole vector of this stuntDouble in specified snapshot
608 *
609 * @return the dipole vector of this stuntDouble
610 * @param snapshotNo
611 */
612 Vector3d getDipole(int snapshotNo) {
613 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
614 .dipole[localIndex_];
615 }
616
617 /**
618 * Returns the previous quadrupole tensor of this stuntDouble
619 * @return the quadrupole tensor of this stuntDouble
620 */
622 return ((snapshotMan_->getPrevSnapshot())->*storage_)
623 .quadrupole[localIndex_];
624 }
625
626 /**
627 * Returns the current quadrupole tensor of this stuntDouble
628 * @return the quadrupole tensor of this stuntDouble
629 */
630 Mat3x3d getQuadrupole() {
631 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
632 .quadrupole[localIndex_];
633 }
634
635 /**
636 * Returns the quadrupole tensor of this stuntDouble in specified snapshot
637 *
638 * @return the quadrupole tensor of this stuntDouble
639 * @param snapshotNo
640 */
641 Mat3x3d getQuadrupole(int snapshotNo) {
642 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
643 .quadrupole[localIndex_];
644 }
645
646 /**
647 * Returns the previous force of this stuntDouble
648 * @return the force of this stuntDouble
649 */
650 Vector3d getPrevFrc() {
651 return ((snapshotMan_->getPrevSnapshot())->*storage_).force[localIndex_];
652 }
653
654 /**
655 * Returns the current force of this stuntDouble
656 * @return the force of this stuntDouble
657 */
658 Vector3d getFrc() {
659 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
660 .force[localIndex_];
661 }
662
663 /**
664 * Returns the force of this stuntDouble in specified snapshot
665 *
666 * @return the force of this stuntDouble
667 * @param snapshotNo
668 */
669 Vector3d getFrc(int snapshotNo) {
670 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
671 .force[localIndex_];
672 }
673
674 /**
675 * Sets the previous force of this stuntDouble
676 *
677 * @param frc new force
678 * @see #getFrc
679 */
680 void setPrevFrc(const Vector3d& frc) {
681 ((snapshotMan_->getPrevSnapshot())->*storage_).force[localIndex_] = frc;
682 }
683
684 /**
685 * Sets the current force of this stuntDouble
686 * @param frc new force
687 */
688 void setFrc(const Vector3d& frc) {
689 ((snapshotMan_->getCurrentSnapshot())->*storage_).force[localIndex_] =
690 frc;
691 }
692
693 /**
694 * Sets the force of this stuntDouble in specified snapshot
695 *
696 * @param frc force to be set
697 * @param snapshotNo
698 * @see #getFrc
699 */
700 void setFrc(const Vector3d& frc, int snapshotNo) {
701 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).force[localIndex_] =
702 frc;
703 }
704
705 /**
706 * Adds force into the previous force of this stuntDouble
707 *
708 * @param frc new force
709 * @see #getFrc
710 */
711 void addPrevFrc(const Vector3d& frc) {
712 ((snapshotMan_->getPrevSnapshot())->*storage_).force[localIndex_] += frc;
713 }
714
715 /**
716 * Adds force into the current force of this stuntDouble
717 * @param frc new force
718 */
719 void addFrc(const Vector3d& frc) {
720 ((snapshotMan_->getCurrentSnapshot())->*storage_).force[localIndex_] +=
721 frc;
722 }
723
724 /**
725 * Adds force into the force of this stuntDouble in specified snapshot
726 *
727 * @param frc force to be set
728 * @param snapshotNo
729 * @see #getFrc
730 */
731 void addFrc(const Vector3d& frc, int snapshotNo) {
732 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).force[localIndex_] +=
733 frc;
734 }
735
736 /**
737 * Returns the previous torque of this stuntDouble
738 * @return the torque of this stuntDouble
739 */
740 Vector3d getPrevTrq() {
741 return ((snapshotMan_->getPrevSnapshot())->*storage_).torque[localIndex_];
742 }
743
744 /**
745 * Returns the current torque of this stuntDouble
746 * @return the torque of this stuntDouble
747 */
748 Vector3d getTrq() {
749 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
750 .torque[localIndex_];
751 }
752
753 /**
754 * Returns the torque of this stuntDouble in specified snapshot
755 *
756 * @return the torque of this stuntDouble
757 * @param snapshotNo
758 */
759 Vector3d getTrq(int snapshotNo) {
760 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
761 .torque[localIndex_];
762 }
763
764 /**
765 * Sets the previous torque of this stuntDouble
766 *
767 * @param trq new torque
768 * @see #getTrq
769 */
770 void setPrevTrq(const Vector3d& trq) {
771 ((snapshotMan_->getPrevSnapshot())->*storage_).torque[localIndex_] = trq;
772 }
773
774 /**
775 * Sets the current torque of this stuntDouble
776 * @param trq new torque
777 */
778 void setTrq(const Vector3d& trq) {
779 ((snapshotMan_->getCurrentSnapshot())->*storage_).torque[localIndex_] =
780 trq;
781 }
782
783 /**
784 * Sets the torque of this stuntDouble in specified snapshot
785 *
786 * @param trq torque to be set
787 * @param snapshotNo
788 * @see #getTrq
789 */
790 void setTrq(const Vector3d& trq, int snapshotNo) {
791 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).torque[localIndex_] =
792 trq;
793 }
794
795 /**
796 * Adds torque into the previous torque of this stuntDouble
797 *
798 * @param trq new torque
799 * @see #getTrq
800 */
801 void addPrevTrq(const Vector3d& trq) {
802 ((snapshotMan_->getPrevSnapshot())->*storage_).torque[localIndex_] += trq;
803 }
804
805 /**
806 * Adds torque into the current torque of this stuntDouble
807 * @param trq new torque
808 */
809 void addTrq(const Vector3d& trq) {
810 ((snapshotMan_->getCurrentSnapshot())->*storage_).torque[localIndex_] +=
811 trq;
812 }
813
814 /**
815 * Adds torque into the torque of this stuntDouble in specified snapshot
816 *
817 * @param trq torque to be add
818 * @param snapshotNo
819 * @see #getTrq
820 */
821 void addTrq(const Vector3d& trq, int snapshotNo) {
822 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
823 .torque[localIndex_] += trq;
824 }
825
826 /**
827 * Returns the previous particlePot of this stuntDouble
828 * @return the particlePot of this stuntDouble
829 */
831 return ((snapshotMan_->getPrevSnapshot())->*storage_)
832 .particlePot[localIndex_];
833 }
834
835 /**
836 * Returns the current particlePot of this stuntDouble
837 * @return the particlePot of this stuntDouble
838 */
839 RealType getParticlePot() {
840 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
841 .particlePot[localIndex_];
842 }
843
844 /**
845 * Returns the particlePot of this stuntDouble in specified snapshot
846 *
847 * @return the particlePot of this stuntDouble
848 * @param snapshotNo
849 */
850 RealType getParticlePot(int snapshotNo) {
851 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
852 .particlePot[localIndex_];
853 }
854
855 /**
856 * Sets the previous particlePot of this stuntDouble
857 *
858 * @param particlePot new particlePot
859 * @see #getParticlePot
860 */
861 void setPrevParticlePot(const RealType& particlePot) {
862 ((snapshotMan_->getPrevSnapshot())->*storage_).particlePot[localIndex_] =
863 particlePot;
864 }
865
866 /**
867 * Sets the current particlePot of this stuntDouble
868 * @param particlePot new particlePot
869 */
870 void setParticlePot(const RealType& particlePot) {
871 ((snapshotMan_->getCurrentSnapshot())->*storage_)
872 .particlePot[localIndex_] = particlePot;
873 }
874
875 /**
876 * Sets the particlePot of this stuntDouble in specified snapshot
877 *
878 * @param particlePot particlePot to be set
879 * @param snapshotNo
880 * @see #getParticlePot
881 */
882 void setParticlePot(const RealType& particlePot, int snapshotNo) {
883 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
884 .particlePot[localIndex_] = particlePot;
885 }
886
887 /**
888 * Adds particlePot into the previous particlePot of this stuntDouble
889 *
890 * @param particlePot new particlePot
891 * @see #getParticlePot
892 */
893 void addPrevParticlePot(const RealType& particlePot) {
894 ((snapshotMan_->getPrevSnapshot())->*storage_).particlePot[localIndex_] +=
895 particlePot;
896 }
897
898 /**
899 * Adds particlePot into the current particlePot of this stuntDouble
900 * @param particlePot new particlePot
901 */
902 void addParticlePot(const RealType& particlePot) {
903 ((snapshotMan_->getCurrentSnapshot())->*storage_)
904 .particlePot[localIndex_] += particlePot;
905 }
906
907 /**
908 * Adds particlePot into the particlePot of this stuntDouble in specified
909 * snapshot
910 *
911 * @param particlePot particlePot to be add
912 * @param snapshotNo
913 * @see #getParticlePot
914 */
915 void addParticlePot(const RealType& particlePot, int snapshotNo) {
916 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
917 .particlePot[localIndex_] += particlePot;
918 }
919
920 /**
921 * Returns the previous fluctuating charge of this stuntDouble
922 * @return the fluctuating charge of this stuntDouble
923 */
924 RealType getPrevFlucQPos() {
925 return ((snapshotMan_->getPrevSnapshot())->*storage_)
926 .flucQPos[localIndex_];
927 }
928
929 /**
930 * Returns the current fluctuating charge of this stuntDouble
931 * @return the fluctuating charge of this stuntDouble
932 */
933 RealType getFlucQPos() {
934 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
935 .flucQPos[localIndex_];
936 }
937
938 /**
939 * Returns the fluctuating charge of this stuntDouble in specified snapshot
940 * @return the fluctuating charge of this stuntDouble
941 * @param snapshotNo
942 */
943 RealType getFlucQPos(int snapshotNo) {
944 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
945 .flucQPos[localIndex_];
946 }
947
948 /**
949 * Sets the previous fluctuating charge of this stuntDouble
950 * @param charge new fluctuating charge
951 * @see #getFlucQPos
952 */
953 void setPrevFlucQPos(RealType charge) {
954 ((snapshotMan_->getPrevSnapshot())->*storage_).flucQPos[localIndex_] =
955 charge;
956 }
957
958 /**
959 * Sets the current fluctuating charge of this stuntDouble
960 * @param charge new fluctuating charge
961 */
962 void setFlucQPos(RealType charge) {
963 ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQPos[localIndex_] =
964 charge;
965 }
966
967 /**
968 * Sets the fluctuating charge of this stuntDouble in specified snapshot
969 * @param charge fluctuating charge to be set
970 * @param snapshotNo
971 * @see #getFlucQPos
972 */
973 void setFlucQPos(RealType charge, int snapshotNo) {
974 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
975 .flucQPos[localIndex_] = charge;
976 }
977
978 /**
979 * Adds fluctuating charge into the previous fluctuating charge of this
980 * stuntDouble
981 * @param charge new fluctuating charge
982 * @see #getFlucQPos
983 */
984 void addPrevFlucQPos(RealType charge) {
985 ((snapshotMan_->getPrevSnapshot())->*storage_).flucQPos[localIndex_] +=
986 charge;
987 }
988
989 /**
990 * Adds fluctuating charge into the current fluctuating charge of this
991 * stuntDouble
992 * @param charge new fluctuating charge
993 */
994 void addFlucQPos(RealType charge) {
995 ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQPos[localIndex_] +=
996 charge;
997 }
998
999 /**
1000 * Adds fluctuating charge into the fluctuating charge of this stuntDouble
1001 * in specified snapshot
1002 * @param charge fluctuating charge to be add
1003 * @param snapshotNo
1004 * @see #getFlucQPos
1005 */
1006 void addFlucQPos(RealType charge, int snapshotNo) {
1007 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1008 .flucQPos[localIndex_] += charge;
1009 }
1010
1011 /**
1012 * Returns the previous charge velocity of this stuntDouble
1013 * @return the charge velocity of this stuntDouble
1014 */
1015 RealType getPrevFlucQVel() {
1016 return ((snapshotMan_->getPrevSnapshot())->*storage_)
1017 .flucQVel[localIndex_];
1018 }
1019
1020 /**
1021 * Returns the current charge velocity of this stuntDouble
1022 * @return the charge velocity of this stuntDouble
1023 */
1024 RealType getFlucQVel() {
1025 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
1026 .flucQVel[localIndex_];
1027 }
1028
1029 /**
1030 * Returns the charge velocity of this stuntDouble in specified snapshot
1031 * @return the charge velocity of this stuntDouble
1032 * @param snapshotNo
1033 */
1034 RealType getFlucQVel(int snapshotNo) {
1035 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1036 .flucQVel[localIndex_];
1037 }
1038
1039 /**
1040 * Sets the previous charge velocity of this stuntDouble
1041 * @param cvel new charge velocity
1042 * @see #getFlucQVel
1043 */
1044 void setPrevFlucQVel(RealType cvel) {
1045 ((snapshotMan_->getPrevSnapshot())->*storage_).flucQVel[localIndex_] =
1046 cvel;
1047 }
1048
1049 /**
1050 * Sets the current charge velocity of this stuntDouble
1051 * @param cvel new charge velocity
1052 */
1053 void setFlucQVel(RealType cvel) {
1054 ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQVel[localIndex_] =
1055 cvel;
1056 }
1057
1058 /**
1059 * Sets the charge velocity of this stuntDouble in specified snapshot
1060 * @param cvel charge velocity to be set
1061 * @param snapshotNo
1062 * @see #getFlucQVel
1063 */
1064 void setFlucQVel(RealType cvel, int snapshotNo) {
1065 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1066 .flucQVel[localIndex_] = cvel;
1067 }
1068
1069 /**
1070 * Adds charge velocity into the previous charge velocity of this
1071 * stuntDouble
1072 * @param cvel new charge velocity
1073 * @see #getFlucQVel
1074 */
1075 void addPrevFlucQVel(RealType cvel) {
1076 ((snapshotMan_->getPrevSnapshot())->*storage_).flucQVel[localIndex_] +=
1077 cvel;
1078 }
1079
1080 /**
1081 * Adds charge velocity into the current charge velocity of this stuntDouble
1082 * @param cvel new charge velocity
1083 */
1084 void addFlucQVel(RealType cvel) {
1085 ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQVel[localIndex_] +=
1086 cvel;
1087 }
1088
1089 /**
1090 * Adds charge velocity into the charge velocity of this stuntDouble in
1091 * specified snapshot
1092 * @param cvel charge velocity to be add
1093 * @param snapshotNo
1094 * @see #getFlucQVel
1095 */
1096 void addFlucQVel(RealType cvel, int snapshotNo) {
1097 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1098 .flucQVel[localIndex_] += cvel;
1099 }
1100
1101 /**
1102 * Returns the previous charge force of this stuntDouble
1103 * @return the charge force of this stuntDouble
1104 */
1105 RealType getPrevFlucQFrc() {
1106 return ((snapshotMan_->getPrevSnapshot())->*storage_)
1107 .flucQFrc[localIndex_];
1108 }
1109
1110 /**
1111 * Returns the current charge force of this stuntDouble
1112 * @return the charge force of this stuntDouble
1113 */
1114 RealType getFlucQFrc() {
1115 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
1116 .flucQFrc[localIndex_];
1117 }
1118
1119 /**
1120 * Returns the charge force of this stuntDouble in specified snapshot
1121 * @return the charge force of this stuntDouble
1122 * @param snapshotNo
1123 */
1124 RealType getFlucQFrc(int snapshotNo) {
1125 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1126 .flucQFrc[localIndex_];
1127 }
1128
1129 /**
1130 * Sets the previous charge force of this stuntDouble
1131 * @param cfrc new charge force
1132 * @see #getFlucQFrc
1133 */
1134 void setPrevFlucQFrc(RealType cfrc) {
1135 ((snapshotMan_->getPrevSnapshot())->*storage_).flucQFrc[localIndex_] =
1136 cfrc;
1137 }
1138
1139 /**
1140 * Sets the current charge force of this stuntDouble
1141 * @param cfrc new charge force
1142 */
1143 void setFlucQFrc(RealType cfrc) {
1144 ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQFrc[localIndex_] =
1145 cfrc;
1146 }
1147
1148 /**
1149 * Sets the charge force of this stuntDouble in specified snapshot
1150 * @param cfrc charge force to be set
1151 * @param snapshotNo
1152 * @see #getFlucQFrc
1153 */
1154 void setFlucQFrc(RealType cfrc, int snapshotNo) {
1155 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1156 .flucQFrc[localIndex_] = cfrc;
1157 }
1158
1159 /**
1160 * Adds charge force into the previous charge force of this stuntDouble
1161 * @param cfrc charge force to be added
1162 * @see #getFlucQFrc
1163 */
1164 void addPrevFlucQFrc(RealType cfrc) {
1165 ((snapshotMan_->getPrevSnapshot())->*storage_).flucQFrc[localIndex_] +=
1166 cfrc;
1167 }
1168
1169 /**
1170 * Adds charge force into the current charge force of this stuntDouble
1171 * @param cfrc charge force to be added
1172 */
1173 void addFlucQFrc(RealType cfrc) {
1174 ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQFrc[localIndex_] +=
1175 cfrc;
1176 }
1177
1178 /**
1179 * Adds charge force into the charge force of this stuntDouble in specified
1180 * snapshot
1181 * @param cfrc charge force to be added
1182 * @param snapshotNo
1183 * @see #getFlucQFrc
1184 */
1185 void addFlucQFrc(RealType cfrc, int snapshotNo) {
1186 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1187 .flucQFrc[localIndex_] += cfrc;
1188 }
1189
1190 /**
1191 * Returns the previous electric field of this stuntDouble
1192 * @return the electric field of this stuntDouble
1193 */
1195 return ((snapshotMan_->getPrevSnapshot())->*storage_)
1196 .electricField[localIndex_];
1197 }
1198
1199 /**
1200 * Returns the current electric field of this stuntDouble
1201 * @return the electric field of this stuntDouble
1202 */
1203 Vector3d getElectricField() {
1204 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
1205 .electricField[localIndex_];
1206 }
1207
1208 /**
1209 * Returns the electric field of this stuntDouble in specified snapshot
1210 * @return the electric field of this stuntDouble
1211 * @param snapshotNo
1212 */
1213 Vector3d getElectricField(int snapshotNo) {
1214 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1215 .electricField[localIndex_];
1216 }
1217
1218 /**
1219 * Sets the previous electric field of this stuntDouble
1220 * @param eField new electric field
1221 * @see #getElectricField
1222 */
1223 void setPrevElectricField(const Vector3d& eField) {
1224 ((snapshotMan_->getPrevSnapshot())->*storage_)
1225 .electricField[localIndex_] = eField;
1226 }
1227
1228 /**
1229 * Sets the current electric field of this stuntDouble
1230 * @param eField new electric field
1231 */
1232 void setElectricField(const Vector3d& eField) {
1233 ((snapshotMan_->getCurrentSnapshot())->*storage_)
1234 .electricField[localIndex_] = eField;
1235 }
1236
1237 /**
1238 * Sets the electric field of this stuntDouble in specified snapshot
1239 * @param eField electric field to be set
1240 * @param snapshotNo
1241 * @see #getElectricField
1242 */
1243 void setElectricField(const Vector3d& eField, int snapshotNo) {
1244 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1245 .electricField[localIndex_] = eField;
1246 }
1247
1248 /**
1249 * Adds electric field into the previous electric field of this
1250 * stuntDouble
1251 *
1252 * @param eField new electric field
1253 * @see #getElectricField
1254 */
1255 void addPrevElectricField(const Vector3d& eField) {
1256 ((snapshotMan_->getPrevSnapshot())->*storage_)
1257 .electricField[localIndex_] += eField;
1258 }
1259
1260 /**
1261 * Adds electric field into the current electric field of this stuntDouble
1262 * @param eField new electric field
1263 */
1264 void addElectricField(const Vector3d& eField) {
1265 ((snapshotMan_->getCurrentSnapshot())->*storage_)
1266 .electricField[localIndex_] += eField;
1267 }
1268
1269 /**
1270 * Adds electric field into the electric field of this stuntDouble in
1271 * specified snapshot
1272 *
1273 * @param eField electric field to be added
1274 * @param snapshotNo
1275 * @see #getElectricField
1276 */
1277 void addElectricField(const Vector3d& eField, int snapshotNo) {
1278 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1279 .electricField[localIndex_] += eField;
1280 }
1281
1282 /**
1283 * Returns the previous site potential of this stuntDouble
1284 * @return the site potential of this stuntDouble
1285 */
1287 return ((snapshotMan_->getPrevSnapshot())->*storage_)
1288 .sitePotential[localIndex_];
1289 }
1290
1291 /**
1292 * Returns the current site potential of this stuntDouble
1293 * @return the site potential of this stuntDouble
1294 */
1295 RealType getSitePotential() {
1296 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
1297 .sitePotential[localIndex_];
1298 }
1299
1300 /**
1301 * Returns the site potential of this stuntDouble in specified snapshot
1302 * @return the site potential of this stuntDouble
1303 * @param snapshotNo
1304 */
1305 RealType getSitePotential(int snapshotNo) {
1306 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1307 .sitePotential[localIndex_];
1308 }
1309
1310 /**
1311 * Sets the previous site potential of this stuntDouble
1312 * @param spot new site potential
1313 * @see #getSitePotential
1314 */
1315 void setPrevSitePotential(RealType spot) {
1316 ((snapshotMan_->getPrevSnapshot())->*storage_)
1317 .sitePotential[localIndex_] = spot;
1318 }
1319
1320 /**
1321 * Sets the current site potential of this stuntDouble
1322 * @param spot new site potential
1323 */
1324 void setSitePotential(RealType spot) {
1325 ((snapshotMan_->getCurrentSnapshot())->*storage_)
1326 .sitePotential[localIndex_] = spot;
1327 }
1328
1329 /**
1330 * Sets the site potential of this stuntDouble in specified snapshot
1331 * @param spot site potential to be set
1332 * @param snapshotNo
1333 * @see #getSitePotential
1334 */
1335 void setSitePotential(RealType spot, int snapshotNo) {
1336 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1337 .sitePotential[localIndex_] = spot;
1338 }
1339
1340 /**
1341 * Adds site potential into the previous charge force of this stuntDouble
1342 * @param spot site potential to be added
1343 * @see #getSitePotential
1344 */
1345 void addPrevSitePotential(RealType spot) {
1346 ((snapshotMan_->getPrevSnapshot())->*storage_)
1347 .sitePotential[localIndex_] += spot;
1348 }
1349
1350 /**
1351 * Adds site potential into the current charge force of this stuntDouble
1352 * @param spot site potential to be added
1353 */
1354 void addSitePotential(RealType spot) {
1355 ((snapshotMan_->getCurrentSnapshot())->*storage_)
1356 .sitePotential[localIndex_] += spot;
1357 }
1358
1359 /**
1360 * Adds site potential into the site potential of this stuntDouble in
1361 * specified snapshot
1362 * @param spot site potential to be added
1363 * @param snapshotNo
1364 * @see #getSitePotential
1365 */
1366 void addSitePotential(RealType spot, int snapshotNo) {
1367 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1368 .sitePotential[localIndex_] += spot;
1369 }
1370
1371 /**
1372 * Returns the previous density of this stuntDouble
1373 * @return the density of this stuntDouble
1374 */
1375 RealType getPrevDensity() {
1376 return ((snapshotMan_->getPrevSnapshot())->*storage_)
1377 .density[localIndex_];
1378 }
1379
1380 /**
1381 * Returns the current density of this stuntDouble
1382 * @return the density of this stuntDouble
1383 */
1384 RealType getDensity() {
1385 return ((snapshotMan_->getCurrentSnapshot())->*storage_)
1386 .density[localIndex_];
1387 }
1388
1389 /**
1390 * Returns the density of this stuntDouble in specified snapshot
1391 * @return the density of this stuntDouble
1392 * @param snapshotNo
1393 */
1394 RealType getDensity(int snapshotNo) {
1395 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1396 .density[localIndex_];
1397 }
1398
1399 /**
1400 * Sets the previous density of this stuntDouble
1401 * @param dens new density
1402 * @see #getDensity
1403 */
1404 void setPrevDensity(RealType dens) {
1405 ((snapshotMan_->getPrevSnapshot())->*storage_).density[localIndex_] =
1406 dens;
1407 }
1408
1409 /**
1410 * Sets the current density of this stuntDouble
1411 * @param dens new density
1412 */
1413 void setDensity(RealType dens) {
1414 ((snapshotMan_->getCurrentSnapshot())->*storage_).density[localIndex_] =
1415 dens;
1416 }
1417
1418 /**
1419 * Sets the density of this stuntDouble in specified snapshot
1420 * @param dens density to be set
1421 * @param snapshotNo
1422 * @see #getDensity
1423 */
1424 void setDensity(RealType dens, int snapshotNo) {
1425 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1426 .density[localIndex_] = dens;
1427 }
1428
1429 /**
1430 * Adds density into the previous charge force of this stuntDouble
1431 * @param dens density to be added
1432 * @see #getDensity
1433 */
1434 void addPrevDensity(RealType dens) {
1435 ((snapshotMan_->getPrevSnapshot())->*storage_).density[localIndex_] +=
1436 dens;
1437 }
1438
1439 /**
1440 * Adds density into the current charge force of this stuntDouble
1441 * @param dens density to be added
1442 */
1443 void addDensity(RealType dens) {
1444 ((snapshotMan_->getCurrentSnapshot())->*storage_).density[localIndex_] +=
1445 dens;
1446 }
1447
1448 /**
1449 * Adds density into the density of this stuntDouble in specified snapshot
1450 * @param dens density to be added
1451 * @param snapshotNo
1452 * @see #getDensity
1453 */
1454 void addDensity(RealType dens, int snapshotNo) {
1455 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_)
1456 .density[localIndex_] += dens;
1457 }
1458
1459 /**
1460 * Set the properties of this stuntDouble to zero
1461 */
1462 void zeroForcesAndTorques();
1463
1464 /**
1465 * Linearly combines the properties from two different snapshots
1466 *
1467 * @param snapA The properties from this snapshot are multiplied by \c multA
1468 * @param snapB The properties from this snapshot are multiplied by \c multB
1469 * @param multA Multiplier for the properties in \c snapA
1470 * @param multB Multiplier for the properties in \c snapB
1471 */
1472 void combineForcesAndTorques(Snapshot* snapA, Snapshot* snapB,
1473 RealType multA, RealType multB);
1474
1475 /**
1476 * Returns the inertia tensor of this stuntDouble
1477 * @return the inertia tensor of this stuntDouble
1478 */
1479 virtual Mat3x3d getI() = 0;
1480
1481 /**
1482 * Returns the gradient of this stuntDouble
1483 * @return the gradient of this stuntDouble
1484 */
1485 virtual std::vector<RealType> getGrad() = 0;
1486
1487 /**
1488 * Tests the if this stuntDouble is a linear rigidbody
1489 *
1490 * @return true if this stuntDouble is a linear rigidbody, otherwise
1491 * return false
1492 * @note atom and directional atom will always return false
1493 *
1494 * @see #linearAxis
1495 */
1496 bool isLinear() { return linear_; }
1497
1498 /**
1499 * Returns the linear axis of the rigidbody, atom and directional atom
1500 * will always return -1
1501 *
1502 * @return the linear axis of the rigidbody
1503 *
1504 * @see #isLinear
1505 */
1506 int linearAxis() { return linearAxis_; }
1507
1508 /** Returns the mass of this stuntDouble */
1509 RealType getMass() { return mass_; }
1510
1511 /**
1512 * Sets the mass of this stuntdoulbe
1513 * @param mass the mass to be set
1514 */
1515 void setMass(RealType mass) { mass_ = mass; }
1516
1517 /** Returns the name of this stuntDouble */
1518 virtual std::string getType() = 0;
1519
1520 /** Sets the name of this stuntDouble*/
1521 virtual void setType(const std::string&) {}
1522
1523 /**
1524 * Converts a lab fixed vector to a body fixed vector.
1525 * @return body fixed vector
1526 * @param v lab fixed vector
1527 */
1528 Vector3d lab2Body(const Vector3d& v) { return getA() * v; }
1529
1530 Vector3d lab2Body(const Vector3d& v, int frame) { return getA(frame) * v; }
1531
1532 /**
1533 * Converts a body fixed vector to a lab fixed vector.
1534 * @return corresponding lab fixed vector
1535 * @param v body fixed vector
1536 */
1537 Vector3d body2Lab(const Vector3d& v) { return getA().transpose() * v; }
1538
1539 Vector3d body2Lab(const Vector3d& v, int frame) {
1540 return getA(frame).transpose() * v;
1541 }
1542
1543 /**
1544 * <p>
1545 * The purpose of the Visitor Pattern is to encapsulate an
1546 * operation that you want to perform on the elements of a data
1547 * structure. In this way, you can change the operation being
1548 * performed on a structure without the need of changing the
1549 * classes of the elements that you are operating on. Using a
1550 * Visitor pattern allows you to decouple the classes for the data
1551 * structure and the algorithms used upon them
1552 * </p>
1553 * @param v visitor
1554 */
1555 virtual void accept(BaseVisitor* v) = 0;
1556
1557 // below functions are just forward functions
1558 /**
1559 * Adds property into property map
1560 * @param genData GenericData to be added into PropertyMap
1561 */
1562 void addProperty(std::shared_ptr<GenericData> genData);
1563
1564 /**
1565 * Removes property from PropertyMap by name
1566 * @param propName the name of property to be removed
1567 */
1568 void removeProperty(const std::string& propName);
1569
1570 /**
1571 * Returns all names of properties
1572 * @return all names of properties
1573 */
1574 std::vector<std::string> getPropertyNames();
1575
1576 /**
1577 * Returns all of the properties in PropertyMap
1578 * @return all of the properties in PropertyMap
1579 */
1580 std::vector<std::shared_ptr<GenericData>> getProperties();
1581
1582 /**
1583 * Returns property
1584 * @param propName name of property
1585 * @return a pointer point to property with propName. If no property named
1586 * propName exists, return NULL
1587 */
1588 std::shared_ptr<GenericData> getPropertyByName(const std::string& propName);
1589
1590 protected:
1591 StuntDouble(ObjectType objType, DataStoragePointer storage);
1592
1593 StuntDouble(const StuntDouble& sd);
1594 StuntDouble& operator=(const StuntDouble& sd);
1595
1596 ObjectType objType_;
1597 DataStoragePointer storage_;
1598 SnapshotManager* snapshotMan_;
1599
1600 bool linear_;
1601 int linearAxis_;
1602
1603 int globalIndex_;
1604 int globalIntegrableObjectIndex_;
1605 int localIndex_;
1606
1607 RealType mass_;
1608
1609 private:
1610 PropertyMap properties_;
1611 };
1612} // namespace OpenMD
1613
1614#endif // PRIMITIVES_STUNTDOUBLE_HPP
PropertyMap class maintains a list of GenericData.
The Snapshot class is a repository storing dynamic data during a Simulation.
Definition Snapshot.hpp:166
SnapshotManager class is an abstract class which maintains a series of snapshots.
void setFlucQVel(RealType cvel)
Sets the current charge velocity of this stuntDouble.
Quat4d getQ()
Returns the current quaternion of this stuntDouble.
Mat3x3d getPrevQuadrupole()
Returns the previous quadrupole tensor of this stuntDouble.
void addPrevFlucQFrc(RealType cfrc)
Adds charge force into the previous charge force of this stuntDouble.
RealType getPrevDensity()
Returns the previous density of this stuntDouble.
void combineForcesAndTorques(Snapshot *snapA, Snapshot *snapB, RealType multA, RealType multB)
Linearly combines the properties from two different snapshots.
void setPrevTrq(const Vector3d &trq)
Sets the previous torque of this stuntDouble.
void addPrevFrc(const Vector3d &frc)
Adds force into the previous force of this stuntDouble.
void setPrevEuler(const Vector3d &euler)
Sets the previous euler angles of this stuntDouble.
void zeroForcesAndTorques()
Set the properties of this stuntDouble to zero.
Vector3d getTrq()
Returns the current torque of this stuntDouble.
virtual void setPrevA(const RotMat3x3d &a)
Sets the previous rotation matrix of this stuntDouble.
RotMat3x3d getPrevA()
Returns the previous rotation matrix of this stuntDouble.
void addFlucQFrc(RealType cfrc)
Adds charge force into the current charge force of this stuntDouble.
void setPrevFrc(const Vector3d &frc)
Sets the previous force of this stuntDouble.
Vector3d getPrevVel()
Returns the previous velocity of this stuntDouble.
Vector3d lab2Body(const Vector3d &v)
Converts a lab fixed vector to a body fixed vector.
RealType getSitePotential(int snapshotNo)
Returns the site potential of this stuntDouble in specified snapshot.
void setPrevParticlePot(const RealType &particlePot)
Sets the previous particlePot of this stuntDouble.
RotMat3x3d getA()
Returns the current rotation matrix of this stuntDouble.
void addFlucQPos(RealType charge, int snapshotNo)
Adds fluctuating charge into the fluctuating charge of this stuntDouble in specified snapshot.
Vector3d getVel()
Returns the current velocity of this stuntDouble.
virtual void setA(const RotMat3x3d &a)
Sets the current rotation matrix of this stuntDouble.
void addElectricField(const Vector3d &eField)
Adds electric field into the current electric field of this stuntDouble.
virtual void accept(BaseVisitor *v)=0
void setElectricField(const Vector3d &eField, int snapshotNo)
Sets the electric field of this stuntDouble in specified snapshot.
Vector3d getVel(int snapshotNo)
Returns the velocity of this stuntDouble in specified snapshot.
Vector3d getJ(int snapshotNo)
Returns the angular momentum of this stuntDouble in specified snapshot (body-fixed).
int linearAxis()
Returns the linear axis of the rigidbody, atom and directional atom will always return -1.
Vector3d getEuler(int snapshotNo)
Returns the euler angles of this stuntDouble in specified snapshot.
Vector3d getEuler()
Returns the current euler angles of this stuntDouble.
Vector3d getElectricField(int snapshotNo)
Returns the electric field of this stuntDouble in specified snapshot.
void setPrevElectricField(const Vector3d &eField)
Sets the previous electric field of this stuntDouble.
RealType getFlucQVel(int snapshotNo)
Returns the charge velocity of this stuntDouble in specified snapshot.
Vector3d getPrevJ()
Returns the previous angular momentum of this stuntDouble (body-fixed).
void setDensity(RealType dens, int snapshotNo)
Sets the density of this stuntDouble in specified snapshot.
void addPrevFlucQVel(RealType cvel)
Adds charge velocity into the previous charge velocity of this stuntDouble.
void setParticlePot(const RealType &particlePot, int snapshotNo)
Sets the particlePot of this stuntDouble in specified snapshot.
RealType getMass()
Returns the mass of this stuntDouble.
void setEuler(const Vector3d &euler, int snapshotNo)
Sets the euler angles of this stuntDouble in specified snapshot.
void setPrevVel(const Vector3d &vel)
Sets the previous velocity of this stuntDouble.
Mat3x3d getQuadrupole()
Returns the current quadrupole tensor of this stuntDouble.
void addPrevDensity(RealType dens)
Adds density into the previous charge force of this stuntDouble.
Vector3d getPrevDipole()
Returns the previous dipole vector of this stuntDouble.
void addPrevParticlePot(const RealType &particlePot)
Adds particlePot into the previous particlePot of this stuntDouble.
std::vector< std::shared_ptr< GenericData > > getProperties()
Returns all of the properties in PropertyMap.
Vector3d getPos(int snapshotNo)
Returns the position of this stuntDouble in specified snapshot.
bool isDirectionalAtom()
Tests if this stuntDouble is an directional atom.
Vector3d getCOMvel(int snapshotNo)
Returns system Center of Mass velocity for stuntDouble frame from snapshot.
std::shared_ptr< GenericData > getPropertyByName(const std::string &propName)
Returns property.
virtual Mat3x3d getI()=0
Returns the inertia tensor of this stuntDouble.
void setPos(const Vector3d &pos, int snapshotNo)
Sets the position of this stuntDouble in specified snapshot.
void addProperty(std::shared_ptr< GenericData > genData)
Adds property into property map.
virtual std::string getType()=0
Returns the name of this stuntDouble.
void setQ(const Quat4d &q, int snapshotNo)
Sets the quaternion of this stuntDouble in specified snapshot.
void setFlucQPos(RealType charge)
Sets the current fluctuating charge of this stuntDouble.
Vector3d getCOMvel()
Returns system Center of Mass velocity for stuntDouble frame from snapshot.
bool isLinear()
Tests the if this stuntDouble is a linear rigidbody.
void setFrc(const Vector3d &frc, int snapshotNo)
Sets the force of this stuntDouble in specified snapshot.
void addDensity(RealType dens)
Adds density into the current charge force of this stuntDouble.
void setParticlePot(const RealType &particlePot)
Sets the current particlePot of this stuntDouble.
Vector3d getPos()
Returns the current position of this stuntDouble.
Vector3d body2Lab(const Vector3d &v)
Converts a body fixed vector to a lab fixed vector.
void setPrevFlucQFrc(RealType cfrc)
Sets the previous charge force of this stuntDouble.
RealType getFlucQFrc(int snapshotNo)
Returns the charge force of this stuntDouble in specified snapshot.
RealType getFlucQFrc()
Returns the current charge force of this stuntDouble.
void addPrevElectricField(const Vector3d &eField)
Adds electric field into the previous electric field of this stuntDouble.
RealType getFlucQPos(int snapshotNo)
Returns the fluctuating charge of this stuntDouble in specified snapshot.
void addFlucQVel(RealType cvel)
Adds charge velocity into the current charge velocity of this stuntDouble.
void setSitePotential(RealType spot)
Sets the current site potential of this stuntDouble.
RealType getFlucQPos()
Returns the current fluctuating charge of this stuntDouble.
void setPos(const Vector3d &pos)
Sets the current position of this stuntDouble.
Vector3d getDipole()
Returns the current dipole vector of this stuntDouble.
void addPrevSitePotential(RealType spot)
Adds site potential into the previous charge force of this stuntDouble.
RealType getPrevFlucQFrc()
Returns the previous charge force of this stuntDouble.
Vector3d getElectricField()
Returns the current electric field of this stuntDouble.
Vector3d getFrc(int snapshotNo)
Returns the force of this stuntDouble in specified snapshot.
void setJ(const Vector3d &angMom, int snapshotNo)
Sets the angular momentum of this stuntDouble in specified snapshot(body-fixed).
RealType getParticlePot(int snapshotNo)
Returns the particlePot of this stuntDouble in specified snapshot.
Vector3d getPrevTrq()
Returns the previous torque of this stuntDouble.
void setTrq(const Vector3d &trq)
Sets the current torque of this stuntDouble.
void addPrevTrq(const Vector3d &trq)
Adds torque into the previous torque of this stuntDouble.
Mat3x3d getQuadrupole(int snapshotNo)
Returns the quadrupole tensor of this stuntDouble in specified snapshot.
void setGlobalIndex(int index)
Sets the global index of this stuntDouble.
Vector3d getPrevFrc()
Returns the previous force of this stuntDouble.
Vector3d getCOM()
Returns system Center of Mass for stuntDouble frame from snapshot.
void addPrevFlucQPos(RealType charge)
Adds fluctuating charge into the previous fluctuating charge of this stuntDouble.
Quat4d getPrevQ()
Returns the previous quaternion of this stuntDouble.
void setSnapshotManager(SnapshotManager *sman)
Sets the Snapshot Manager of this stuntDouble.
RealType getParticlePot()
Returns the current particlePot of this stuntDouble.
Vector3d getCOM(int snapshotNo)
Returns system Center of Mass for stuntDouble frame from snapshot.
RealType getSitePotential()
Returns the current site potential of this stuntDouble.
RealType getDensity()
Returns the current density of this stuntDouble.
std::vector< std::string > getPropertyNames()
Returns all names of properties.
void setTrq(const Vector3d &trq, int snapshotNo)
Sets the torque of this stuntDouble in specified snapshot.
void setElectricField(const Vector3d &eField)
Sets the current electric field of this stuntDouble.
void setPrevFlucQPos(RealType charge)
Sets the previous fluctuating charge of this stuntDouble.
void setEuler(const Vector3d &euler)
Sets the current euler angles of this stuntDouble.
void removeProperty(const std::string &propName)
Removes property from PropertyMap by name.
void setVel(const Vector3d &vel)
Sets the current velocity of this stuntDouble.
void addTrq(const Vector3d &trq)
Adds torque into the current torque of this stuntDouble.
RealType getPrevParticlePot()
Returns the previous particlePot of this stuntDouble.
void addDensity(RealType dens, int snapshotNo)
Adds density into the density of this stuntDouble in specified snapshot.
Vector3d getCOMw()
Returns system Center of Mass angular momentum for stuntDouble frame from snapshot.
void setPrevDensity(RealType dens)
Sets the previous density of this stuntDouble.
void addParticlePot(const RealType &particlePot)
Adds particlePot into the current particlePot of this stuntDouble.
RealType getPrevSitePotential()
Returns the previous site potential of this stuntDouble.
bool isRigidBody()
Tests if this stuntDouble is a rigid body.
Vector3d getTrq(int snapshotNo)
Returns the torque of this stuntDouble in specified snapshot.
virtual void setA(const RotMat3x3d &a, int snapshotNo)
Sets the rotation matrix of this stuntDouble in specified snapshot.
Vector3d getJ()
Returns the current angular momentum of this stuntDouble (body -fixed).
Quat4d getQ(int snapshotNo)
Returns the quaternion of this stuntDouble in specified snapshot.
void setFlucQVel(RealType cvel, int snapshotNo)
Sets the charge velocity of this stuntDouble in specified snapshot.
int getGlobalIndex()
Returns the global index of this stuntDouble.
void addSitePotential(RealType spot, int snapshotNo)
Adds site potential into the site potential of this stuntDouble in specified snapshot.
RealType getDensity(int snapshotNo)
Returns the density of this stuntDouble in specified snapshot.
void setPrevSitePotential(RealType spot)
Sets the previous site potential of this stuntDouble.
bool isAtom()
Tests if this stuntDouble is an atom.
RealType getPrevFlucQPos()
Returns the previous fluctuating charge of this stuntDouble.
void addElectricField(const Vector3d &eField, int snapshotNo)
Adds electric field into the electric field of this stuntDouble in specified snapshot.
RotMat3x3d getA(int snapshotNo)
Returns the rotation matrix of this stuntDouble in specified snapshot.
void addParticlePot(const RealType &particlePot, int snapshotNo)
Adds particlePot into the particlePot of this stuntDouble in specified snapshot.
void addTrq(const Vector3d &trq, int snapshotNo)
Adds torque into the torque of this stuntDouble in specified snapshot.
Vector3d getCOMw(int snapshotNo)
Returns system Center of Mass angular momentum for stuntDouble frame from snapshot.
Vector3d getPrevPos()
Returns the previous position of this stuntDouble.
void setPrevFlucQVel(RealType cvel)
Sets the previous charge velocity of this stuntDouble.
void setQ(const Quat4d &q)
Sets the current quaternion of this stuntDouble.
Vector3d getPrevEuler()
Returns the previous euler angles of this stuntDouble.
bool isDirectional()
Tests if this stuntDouble is a directional one.
Vector3d getDipole(int snapshotNo)
Returns the dipole vector of this stuntDouble in specified snapshot.
int freeze()
Freezes out all velocity, angular velocity, forces and torques on this StuntDouble.
void addFlucQVel(RealType cvel, int snapshotNo)
Adds charge velocity into the charge velocity of this stuntDouble in specified snapshot.
RealType getPrevFlucQVel()
Returns the previous charge velocity of this stuntDouble.
Vector3d getFrc()
Returns the current force of this stuntDouble.
int getLocalIndex()
Returns the local index of this stuntDouble.
void setMass(RealType mass)
Sets the mass of this stuntdoulbe.
Vector3d getPrevElectricField()
Returns the previous electric field of this stuntDouble.
virtual void setType(const std::string &)
Sets the name of this stuntDouble.
void addSitePotential(RealType spot)
Adds site potential into the current charge force of this stuntDouble.
void setFrc(const Vector3d &frc)
Sets the current force of this stuntDouble.
void setJ(const Vector3d &angMom)
Sets the current angular momentum of this stuntDouble (body-fixed).
void setVel(const Vector3d &vel, int snapshotNo)
Sets the velocity of this stuntDouble in specified snapshot.
void setFlucQFrc(RealType cfrc)
Sets the current charge force of this stuntDouble.
virtual std::vector< RealType > getGrad()=0
Returns the gradient of this stuntDouble.
void setPrevJ(const Vector3d &angMom)
Sets the previous angular momentum of this stuntDouble (body-fixed).
void addFlucQPos(RealType charge)
Adds fluctuating charge into the current fluctuating charge of this stuntDouble.
RealType getFlucQVel()
Returns the current charge velocity of this stuntDouble.
void setFlucQFrc(RealType cfrc, int snapshotNo)
Sets the charge force of this stuntDouble in specified snapshot.
void setSitePotential(RealType spot, int snapshotNo)
Sets the site potential of this stuntDouble in specified snapshot.
void setLocalIndex(int index)
Sets the local index of this stuntDouble.
void setFlucQPos(RealType charge, int snapshotNo)
Sets the fluctuating charge of this stuntDouble in specified snapshot.
void setDensity(RealType dens)
Sets the current density of this stuntDouble.
void setPrevPos(const Vector3d &pos)
Sets the previous position of this stuntDouble.
void addFrc(const Vector3d &frc)
Adds force into the current force of this stuntDouble.
void addFlucQFrc(RealType cfrc, int snapshotNo)
Adds charge force into the charge force of this stuntDouble in specified snapshot.
void addFrc(const Vector3d &frc, int snapshotNo)
Adds force into the force of this stuntDouble in specified snapshot.
void setPrevQ(const Quat4d &q)
Sets the previous quaternion of this stuntDouble.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.