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