OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
ConstraintElem.hpp
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#ifndef CONSTRAINTS_CONTRAINTELEM_HPP
46#define CONSTRAINTS_CONTRAINTELEM_HPP
47
48#include <memory>
49
51#include "utils/GenericData.hpp"
52#include "utils/simError.h"
53
54namespace OpenMD {
55
56 /**
57 * @class ConstraintElem ConstraintElem.hpp "constraints/ConstraintElem.hpp"
58 * An adapter class of StuntDouble which is used at constraint algorithm
59 */
60
62 public:
63 ConstraintElem(StuntDouble* sd) : sd_(sd) {
64 std::shared_ptr<GenericData> movedData = sd_->getPropertyByName("Moved");
65 if (movedData != nullptr) { // if generic data with keyword "moved"
66 // exists, assign it to moved_
67 moved_ = std::dynamic_pointer_cast<BoolGenericData>(movedData);
68 if (moved_ == nullptr) {
69 snprintf(
70 painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
71 "Generic Data with keyword Moved exists, however, it can not "
72 "be casted to a BoolGenericData.\n");
73 painCave.isFatal = 1;
74 ;
75 simError();
76 }
77 } else { // if generic data with keyword "moved" does not exist, create
78 // it
79 moved_ = std::make_shared<BoolGenericData>("Moved");
80 sd_->addProperty(moved_);
81 }
82
83 std::shared_ptr<GenericData> movingData =
84 sd_->getPropertyByName("Moving");
85 if (movingData != nullptr) {
86 moving_ = std::dynamic_pointer_cast<BoolGenericData>(movingData);
87 if (moving_ == nullptr) {
88 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
89 "Generic Data with keyword Moving exists, however, it can "
90 "not be casted to a BoolGenericData.\n");
91 painCave.isFatal = 1;
92 ;
93 simError();
94 }
95 } else {
96 moving_ = std::make_shared<BoolGenericData>("Moving");
97 sd_->addProperty(moving_);
98 }
99 }
100
101 bool getMoved() { return moved_->getData(); }
102 void setMoved(bool moved) { moved_->setData(moved); }
103
104 bool getMoving() { return moving_->getData(); }
105 void setMoving(bool moving) { moving_->setData(moving); }
106
107 StuntDouble* getStuntDouble() { return sd_; }
108
109 /**
110 * Returns the global index of this stuntRealType.
111 * @return the global index of this stuntdouble
112 */
113 int getGlobalIndex() { return sd_->getGlobalIndex(); }
114
115 /**
116 * Sets the global index of this stuntRealType.
117 * @param index new global index to be set
118 */
119 void setGlobalIndex(int index) { sd_->setGlobalIndex(index); }
120
121 /**
122 * Returns the local index of this stuntdouble
123 * @return the local index of this stuntdouble
124 */
125 int getLocalIndex() { return sd_->getLocalIndex(); }
126
127 /**
128 * Sets the local index of this stuntdouble
129 * @param index new index to be set
130 */
131 void setLocalIndex(int index) { sd_->setLocalIndex(index); }
132
133 /**
134 * Sets the Snapshot Manager of this stuntdouble
135 */
137 sd_->setSnapshotManager(sman);
138 }
139
140 /**
141 * Tests if this stuntdouble is an atom
142 * @return true is this stuntdouble is an atom(or a directional atom),
143 * return false otherwise
144 */
145 bool isAtom() { return sd_->isAtom(); }
146
147 /**
148 * Tests if this stuntdouble is an directional atom
149 * @return true if this stuntdouble is an directional atom, return false
150 * otherwise
151 */
152 bool isDirectionalAtom() { return sd_->isDirectional(); }
153
154 /**
155 * Tests if this stuntdouble is a rigid body.
156 * @return true if this stuntdouble is a rigid body, otherwise return false
157 */
158 bool isRigidBody() { return sd_->isRigidBody(); }
159
160 /**
161 * Tests if this stuntdouble is a directional one.
162 * @return true is this stuntdouble is a directional atom or a rigid body,
163 * return false otherwise
164 */
165 bool isDirectional() { return sd_->isDirectional(); }
166
167 /**
168 * Returns the previous position of this stuntdouble
169 * @return the position of this stuntdouble
170 */
171 Vector3d getPrevPos() { return sd_->getPrevPos(); }
172
173 /**
174 * Returns the current position of this stuntdouble
175 * @return the position of this stuntdouble
176 */
177 Vector3d getPos() { return sd_->getPos(); }
178
179 /**
180 * Returns the position of this stuntdouble in specified snapshot
181 * @return the position of this stuntdouble
182 * @param snapshotNo
183 */
184 Vector3d getPos(int snapshotNo) { return sd_->getPos(snapshotNo); }
185
186 /**
187 * Sets the previous position of this stuntdouble
188 * @param pos new position
189 * @see #getPos
190 */
191 void setPrevPos(const Vector3d& pos) { sd_->setPrevPos(pos); }
192
193 /**
194 * Sets the current position of this stuntdouble
195 * @param pos new position
196 */
197 void setPos(const Vector3d& pos) { sd_->setPos(pos); }
198
199 /**
200 * Sets the position of this stuntdouble in specified snapshot
201 * @param pos position to be set
202 * @param snapshotNo
203 * @see #getPos
204 */
205 void setPos(const Vector3d& pos, int snapshotNo) {
206 sd_->setPos(pos, snapshotNo);
207 }
208
209 /**
210 * Returns the previous velocity of this stuntdouble
211 * @return the velocity of this stuntdouble
212 */
213 Vector3d getPrevVel() { return sd_->getPrevVel(); }
214
215 /**
216 * Returns the current velocity of this stuntdouble
217 * @return the velocity of this stuntdouble
218 */
219 Vector3d getVel() { return sd_->getVel(); }
220
221 /**
222 * Returns the velocity of this stuntdouble in specified snapshot
223 * @return the velocity of this stuntdouble
224 * @param snapshotNo
225 */
226
227 Vector3d getVel(int snapshotNo) { return sd_->getVel(snapshotNo); }
228
229 /**
230 * Sets the previous velocity of this stuntdouble
231 * @param vel new velocity
232 * @see #getVel
233 */
234 void setPrevVel(const Vector3d& vel) { sd_->setPrevVel(vel); }
235
236 /**
237 * Sets the current velocity of this stuntdouble
238 * @param vel new velocity
239 */
240 void setVel(const Vector3d& vel) { sd_->setVel(vel); }
241
242 /**
243 * Sets the velocity of this stuntdouble in specified snapshot
244 * @param vel velocity to be set
245 * @param snapshotNo
246 * @see #getVel
247 */
248 void setVel(const Vector3d& vel, int snapshotNo) {
249 sd_->setVel(vel, snapshotNo);
250 }
251
252 /**
253 * Returns the previous rotation matrix of this stuntdouble
254 * @return the rotation matrix of this stuntdouble
255 */
256 RotMat3x3d getPrevA() { return sd_->getPrevA(); }
257
258 /**
259 * Returns the current rotation matrix of this stuntdouble
260 * @return the rotation matrix of this stuntdouble
261 */
262 RotMat3x3d getA() { return sd_->getA(); }
263
264 /**
265 * Returns the rotation matrix of this stuntdouble in specified snapshot
266 *
267 * @return the rotation matrix of this stuntdouble
268 * @param snapshotNo
269 */
270 RotMat3x3d getA(int snapshotNo) { return sd_->getA(snapshotNo); }
271
272 /**
273 * Sets the previous rotation matrix of this stuntdouble
274 * @param a new rotation matrix
275 * @see #getA
276 */
277 void setPrevA(const RotMat3x3d& a) { sd_->setPrevA(a); }
278
279 /**
280 * Sets the current rotation matrix of this stuntdouble
281 * @param a new rotation matrix
282 */
283 void setA(const RotMat3x3d& a) { sd_->setA(a); }
284
285 /**
286 * Sets the rotation matrix of this stuntdouble in specified snapshot
287 * @param a rotation matrix to be set
288 * @param snapshotNo
289 * @see #getA
290 */
291 void setA(const RotMat3x3d& a, int snapshotNo) { sd_->setA(a, snapshotNo); }
292
293 /**
294 * Returns the previous angular momentum of this stuntdouble (body-fixed).
295 * @return the angular momentum of this stuntdouble
296 */
297 Vector3d getPrevJ() { return sd_->getPrevJ(); }
298
299 /**
300 * Returns the current angular momentum of this stuntdouble (body -fixed).
301 * @return the angular momentum of this stuntdouble
302 */
303 Vector3d getJ() { return sd_->getJ(); }
304
305 /**
306 * Returns the angular momentum of this stuntdouble in specified snapshot
307 * (body-fixed).
308 * @return the angular momentum of this stuntdouble
309 * @param snapshotNo
310 */
311 Vector3d getJ(int snapshotNo) { return sd_->getJ(snapshotNo); }
312
313 /**
314 * Sets the previous angular momentum of this stuntdouble (body-fixed).
315 * @param angMom new angular momentum
316 * @see #getJ
317 */
318 void setPrevJ(const Vector3d& angMom) { sd_->setPrevJ(angMom); }
319
320 /**
321 * Sets the current angular momentum of this stuntdouble (body-fixed).
322 * @param angMom new angular momentum
323 */
324 void setJ(const Vector3d& angMom) { sd_->setJ(angMom); }
325
326 /**
327 * Sets the angular momentum of this stuntdouble in specified
328 * snapshot(body-fixed).
329 * @param angMom angular momentum to be set
330 * @param snapshotNo
331 * @see #getJ
332 */
333 void setJ(const Vector3d& angMom, int snapshotNo) {
334 sd_->setJ(angMom, snapshotNo);
335 }
336
337 /**
338 * Returns the previous quaternion of this stuntdouble
339 * @return the quaternion of this stuntdouble
340 */
341 Quat4d getPrevQ() { return sd_->getPrevQ(); }
342
343 /**
344 * Returns the current quaternion of this stuntdouble
345 * @return the quaternion of this stuntdouble
346 */
347 Quat4d getQ() { return sd_->getQ(); }
348
349 /**
350 * Returns the quaternion of this stuntdouble in specified snapshot
351 * @return the quaternion of this stuntdouble
352 * @param snapshotNo
353 */
354 Quat4d getQ(int snapshotNo) { return sd_->getQ(snapshotNo); }
355
356 /**
357 * Sets the previous quaternion of this stuntdouble
358 * @param q new quaternion
359 * @note actual storage data is rotation matrix
360 */
361 void setPrevQ(const Quat4d& q) { sd_->setPrevQ(q); }
362
363 /**
364 * Sets the current quaternion of this stuntdouble
365 * @param q new quaternion
366 * @note actual storage data is rotation matrix
367 */
368 void setQ(const Quat4d& q) { sd_->setQ(q); }
369
370 /**
371 * Sets the quaternion of this stuntdouble in specified snapshot
372 *
373 * @param q quaternion to be set
374 * @param snapshotNo
375 * @note actual storage data is rotation matrix
376 */
377 void setQ(const Quat4d& q, int snapshotNo) { sd_->setQ(q, snapshotNo); }
378
379 /**
380 * Returns the previous euler angles of this stuntdouble
381 * @return the euler angles of this stuntdouble
382 */
383 Vector3d getPrevEuler() { return sd_->getPrevEuler(); }
384
385 /**
386 * Returns the current euler angles of this stuntdouble
387 * @return the euler angles of this stuntdouble
388 */
389 Vector3d getEuler() { return sd_->getEuler(); }
390
391 /**
392 * Returns the euler angles of this stuntdouble in specified snapshot.
393 * @return the euler angles of this stuntdouble
394 * @param snapshotNo
395 */
396 Vector3d getEuler(int snapshotNo) { return sd_->getEuler(snapshotNo); }
397
398 /**
399 * Sets the previous euler angles of this stuntRealType.
400 * @param euler new euler angles
401 * @see #getEuler
402 * @note actual storage data is rotation matrix
403 */
404 void setPrevEuler(const Vector3d& euler) { sd_->setPrevEuler(euler); }
405
406 /**
407 * Sets the current euler angles of this stuntdouble
408 * @param euler new euler angles
409 */
410 void setEuler(const Vector3d& euler) { sd_->setEuler(euler); }
411
412 /**
413 * Sets the euler angles of this stuntdouble in specified snapshot
414 *
415 * @param euler euler angles to be set
416 * @param snapshotNo
417 * @note actual storage data is rotation matrix
418 */
419 void setEuler(const Vector3d& euler, int snapshotNo) {
420 sd_->setEuler(euler, snapshotNo);
421 }
422
423 /**
424 * Returns the previous dipole vector of this stuntDouble
425 * @return the dipole vector of this stuntDouble
426 */
428
429 /**
430 * Returns the current dipole vector of this stuntDouble
431 * @return the dipole vector of this stuntDouble
432 */
433 Vector3d getDipole() { return sd_->getDipole(); }
434
435 /**
436 * Returns the dipole vector of this stuntDouble in specified snapshot
437 *
438 * @return the dipole vector of this stuntDouble
439 * @param snapshotNo
440 */
441 Vector3d getDipole(int snapshotNo) { return sd_->getDipole(snapshotNo); }
442
443 /**
444 * Returns the previous quadrupole tensor of this stuntDouble
445 * @return the quadrupole tensor of this stuntDouble
446 */
448
449 /**
450 * Returns the current quadrupole tensor of this stuntDouble
451 * @return the quadrupole tensor of this stuntDouble
452 */
454
455 /**
456 * Returns the quadrupole tensor of this stuntDouble in specified snapshot
457 *
458 * @return the quadrupole tensor of this stuntDouble
459 * @param snapshotNo
460 */
461 Mat3x3d getQuadrupole(int snapshotNo) {
462 return sd_->getQuadrupole(snapshotNo);
463 }
464
465 /**
466 * Returns the previous force of this stuntdouble
467 * @return the force of this stuntdouble
468 */
469 Vector3d getPrevFrc() { return sd_->getPrevFrc(); }
470
471 /**
472 * Returns the current force of this stuntdouble
473 * @return the force of this stuntdouble
474 */
475 Vector3d getFrc() { return sd_->getFrc(); }
476
477 /**
478 * Returns the force of this stuntdouble in specified snapshot
479 *
480 * @return the force of this stuntdouble
481 * @param snapshotNo
482 */
483 Vector3d getFrc(int snapshotNo) { return sd_->getFrc(snapshotNo); }
484
485 /**
486 * Sets the previous force of this stuntdouble
487 *
488 * @param frc new force
489 * @see #getFrc
490 */
491 void setPrevFrc(const Vector3d& frc) { sd_->setPrevFrc(frc); }
492
493 /**
494 * Sets the current force of this stuntdouble
495 * @param frc new force
496 */
497 void setFrc(const Vector3d& frc) { sd_->setFrc(frc); }
498
499 /**
500 * Sets the force of this stuntdouble in specified snapshot
501 *
502 * @param frc force to be set
503 * @param snapshotNo
504 * @see #getFrc
505 */
506 void setFrc(const Vector3d& frc, int snapshotNo) {
507 sd_->setFrc(frc, snapshotNo);
508 }
509
510 /**
511 * Adds force into the previous force of this stuntdouble
512 *
513 * @param frc new force
514 * @see #getFrc
515 */
516 void addPrevFrc(const Vector3d& frc) { sd_->addPrevFrc(frc); }
517
518 /**
519 * Adds force into the current force of this stuntdouble
520 * @param frc new force
521 */
522 void addFrc(const Vector3d& frc) { sd_->addFrc(frc); }
523
524 /**
525 * Adds force into the force of this stuntdouble in specified snapshot
526 *
527 * @param frc force to be set
528 * @param snapshotNo
529 * @see #getFrc
530 */
531 void addFrc(const Vector3d& frc, int snapshotNo) {
532 sd_->addFrc(frc, snapshotNo);
533 }
534
535 /**
536 * Returns the previous torque of this stuntdouble
537 * @return the torque of this stuntdouble
538 */
539 Vector3d getPrevTrq() { return sd_->getPrevTrq(); }
540
541 /**
542 * Returns the current torque of this stuntdouble
543 * @return the torque of this stuntdouble
544 */
545 Vector3d getTrq() { return sd_->getTrq(); }
546
547 /**
548 * Returns the torque of this stuntdouble in specified snapshot
549 *
550 * @return the torque of this stuntdouble
551 * @param snapshotNo
552 */
553 Vector3d getTrq(int snapshotNo) { return sd_->getTrq(snapshotNo); }
554
555 /**
556 * Sets the previous torque of this stuntdouble
557 *
558 * @param trq new torque
559 * @see #getTrq
560 */
561 void setPrevTrq(const Vector3d& trq) { sd_->setPrevTrq(trq); }
562
563 /**
564 * Sets the current torque of this stuntdouble
565 * @param trq new torque
566 */
567 void setTrq(const Vector3d& trq) { sd_->setTrq(trq); }
568
569 /**
570 * Sets the torque of this stuntdouble in specified snapshot
571 *
572 * @param trq torque to be set
573 * @param snapshotNo
574 * @see #getTrq
575 */
576 void setTrq(const Vector3d& trq, int snapshotNo) {
577 sd_->setTrq(trq, snapshotNo);
578 }
579
580 /**
581 * Adds torque into the previous torque of this stuntdouble
582 *
583 * @param trq new torque
584 * @see #getTrq
585 */
586 void addPrevTrq(const Vector3d& trq) { sd_->addPrevTrq(trq); }
587
588 /**
589 * Adds torque into the current torque of this stuntdouble
590 * @param trq new torque
591 */
592 void addTrq(const Vector3d& trq) { sd_->addTrq(trq); }
593
594 /**
595 * Adds torque into the torque of this stuntdouble in specified snapshot
596 *
597 * @param trq torque to be add
598 * @param snapshotNo
599 * @see #getTrq
600 */
601 void addTrq(const Vector3d& trq, int snapshotNo) {
602 sd_->addTrq(trq, snapshotNo);
603 }
604
605 /** Set the force of this stuntdouble to zero */
607 /**
608 * Returns the inertia tensor of this stuntdouble
609 * @return the inertia tensor of this stuntdouble
610 */
611 Mat3x3d getI() { return sd_->getI(); }
612
613 /**
614 * Returns the gradient of this stuntdouble
615 * @return the gradient of this stuntdouble
616 */
617 std::vector<RealType> getGrad() { return sd_->getGrad(); }
618
619 /**
620 * Tests the if this stuntdouble is a linear rigidbody
621 *
622 * @return true if this stuntdouble is a linear rigidbody, otherwise return
623 * false
624 * @note atom and directional atom will always return false
625 *
626 * @see #linearAxis
627 */
628 bool isLinear() { return sd_->isLinear(); }
629
630 /**
631 * Returns the linear axis of the rigidbody, atom and directional atom will
632 * always return -1
633 *
634 * @return the linear axis of the rigidbody
635 *
636 * @see #isLinear
637 */
638 int linearAxis() { return sd_->linearAxis(); }
639
640 /** Returns the mass of this stuntdouble */
641 RealType getMass() { return sd_->getMass(); }
642
643 /**
644 * Sets the mass of this stuntdoulbe
645 * @param mass the mass to be set
646 */
647 void setMass(RealType mass) { sd_->setMass(mass); }
648
649 /** Returns the name of this stuntdouble */
650 std::string getType() { return sd_->getType(); }
651
652 /** Sets the name of this stuntRealType*/
653 void setType(const std::string& name) { sd_->setType(name); }
654
655 /**
656 * Converts a lab fixed vector to a body fixed vector.
657 * @return body fixed vector
658 * @param v lab fixed vector
659 */
660 Vector3d lab2Body(const Vector3d& v) { return sd_->lab2Body(v); }
661
662 /**
663 * Converts a body fixed vector to a lab fixed vector.
664 * @return corresponding lab fixed vector
665 * @param v body fixed vector
666 */
667 Vector3d body2Lab(const Vector3d& v) { return sd_->body2Lab(v); }
668 /**
669 * <p>
670 * The purpose of the Visitor Pattern is to encapsulate an operation that
671 * you want to perform on the elements of a data structure. In this way, you
672 * can change the operation being performed on a structure without the need
673 * of changing the classes of the elements that you are operating on. Using
674 * a Visitor pattern allows you to decouple the classes for the data
675 * structure and the algorithms used upon them
676 * </p>
677 * @param v visitor
678 */
679 void accept(BaseVisitor* v) { sd_->accept(v); }
680
681 // below functions are just forward functions
682 /**
683 * Adds property into property map
684 * @param genData GenericData to be added into PropertyMap
685 */
686 void addProperty(std::shared_ptr<GenericData> genData) {
687 sd_->addProperty(genData);
688 }
689
690 /**
691 * Removes property from PropertyMap by name
692 * @param propName the name of property to be removed
693 */
694 void removeProperty(const std::string& propName) {
695 sd_->removeProperty(propName);
696 }
697
698 /**
699 * Returns all names of properties
700 * @return all names of properties
701 */
702 std::vector<std::string> getPropertyNames() {
703 return sd_->getPropertyNames();
704 }
705
706 /**
707 * Returns all of the properties in PropertyMap
708 * @return all of the properties in PropertyMap
709 */
710 std::vector<std::shared_ptr<GenericData>> getProperties() {
711 return sd_->getProperties();
712 }
713
714 /**
715 * Returns property
716 * @param propName name of property
717 * @return a pointer point to property with propName. If no property named
718 * propName exists, return NULL
719 */
720 std::shared_ptr<GenericData> getPropertyByName(
721 const std::string& propName) {
722 return sd_->getPropertyByName(propName);
723 }
724
725 private:
726 StuntDouble* sd_;
727 std::shared_ptr<BoolGenericData> moved_;
728 std::shared_ptr<BoolGenericData> moving_;
729 };
730} // namespace OpenMD
731
732#endif
An adapter class of StuntDouble which is used at constraint algorithm.
void removeProperty(const std::string &propName)
Removes property from PropertyMap by name.
void setJ(const Vector3d &angMom, int snapshotNo)
Sets the angular momentum of this stuntdouble in specified snapshot(body-fixed).
void setEuler(const Vector3d &euler)
Sets the current euler angles of this stuntdouble.
void zeroForcesAndTorques()
Set the force of this stuntdouble to zero.
Vector3d getJ(int snapshotNo)
Returns the angular momentum of this stuntdouble in specified snapshot (body-fixed).
void setFrc(const Vector3d &frc)
Sets the current force of this stuntdouble.
Quat4d getQ(int snapshotNo)
Returns the quaternion of this stuntdouble in specified snapshot.
void setPrevVel(const Vector3d &vel)
Sets the previous velocity of this stuntdouble.
void setPos(const Vector3d &pos)
Sets the current position of this stuntdouble.
void setEuler(const Vector3d &euler, int snapshotNo)
Sets the euler angles of this stuntdouble in specified snapshot.
Vector3d getPrevVel()
Returns the previous velocity of this stuntdouble.
void setTrq(const Vector3d &trq, int snapshotNo)
Sets the torque of this stuntdouble in specified snapshot.
void setPrevA(const RotMat3x3d &a)
Sets the previous rotation matrix of this stuntdouble.
std::string getType()
Returns the name of this stuntdouble.
void addTrq(const Vector3d &trq, int snapshotNo)
Adds torque into the torque of this stuntdouble in specified snapshot.
Vector3d getPrevPos()
Returns the previous position of this stuntdouble.
int linearAxis()
Returns the linear axis of the rigidbody, atom and directional atom will always return -1.
void setType(const std::string &name)
Sets the name of this stuntRealType.
void setLocalIndex(int index)
Sets the local index of this stuntdouble.
Vector3d getPrevTrq()
Returns the previous torque of this stuntdouble.
RotMat3x3d getA(int snapshotNo)
Returns the rotation matrix of this stuntdouble in specified snapshot.
RotMat3x3d getA()
Returns the current rotation matrix of this stuntdouble.
Vector3d getPrevEuler()
Returns the previous euler angles of this stuntdouble.
std::vector< RealType > getGrad()
Returns the gradient of this stuntdouble.
Quat4d getQ()
Returns the current quaternion of this stuntdouble.
Vector3d getTrq()
Returns the current torque of this stuntdouble.
void setPrevFrc(const Vector3d &frc)
Sets the previous force of this stuntdouble.
void accept(BaseVisitor *v)
Vector3d getPos(int snapshotNo)
Returns the position of this stuntdouble in specified snapshot.
void setGlobalIndex(int index)
Sets the global index of this stuntRealType.
std::vector< std::string > getPropertyNames()
Returns all names of properties.
Vector3d getPos()
Returns the current position of this stuntdouble.
void setPrevEuler(const Vector3d &euler)
Sets the previous euler angles of this stuntRealType.
Mat3x3d getQuadrupole()
Returns the current quadrupole tensor of this stuntDouble.
Vector3d getPrevJ()
Returns the previous angular momentum of this stuntdouble (body-fixed).
Vector3d getJ()
Returns the current angular momentum of this stuntdouble (body -fixed).
void setPrevPos(const Vector3d &pos)
Sets the previous position of this stuntdouble.
Vector3d lab2Body(const Vector3d &v)
Converts a lab fixed vector to a body fixed vector.
int getLocalIndex()
Returns the local index of this stuntdouble.
void addFrc(const Vector3d &frc, int snapshotNo)
Adds force into the force of this stuntdouble in specified snapshot.
void addPrevTrq(const Vector3d &trq)
Adds torque into the previous torque of this stuntdouble.
Vector3d getVel(int snapshotNo)
Returns the velocity of this stuntdouble in specified snapshot.
int getGlobalIndex()
Returns the global index of this stuntRealType.
RotMat3x3d getPrevA()
Returns the previous rotation matrix of this stuntdouble.
bool isDirectionalAtom()
Tests if this stuntdouble is an directional atom.
Vector3d getVel()
Returns the current velocity of this stuntdouble.
std::vector< std::shared_ptr< GenericData > > getProperties()
Returns all of the properties in PropertyMap.
Vector3d getPrevDipole()
Returns the previous dipole vector of this stuntDouble.
Mat3x3d getI()
Returns the inertia tensor of this stuntdouble.
bool isLinear()
Tests the if this stuntdouble is a linear rigidbody.
void setTrq(const Vector3d &trq)
Sets the current torque of this stuntdouble.
RealType getMass()
Returns the mass of this stuntdouble.
bool isDirectional()
Tests if this stuntdouble is a directional one.
void setSnapshotManager(SnapshotManager *sman)
Sets the Snapshot Manager of this stuntdouble.
void setPos(const Vector3d &pos, int snapshotNo)
Sets the position of this stuntdouble in specified snapshot.
Mat3x3d getPrevQuadrupole()
Returns the previous quadrupole tensor of this stuntDouble.
void setVel(const Vector3d &vel)
Sets the current velocity of this stuntdouble.
void setPrevJ(const Vector3d &angMom)
Sets the previous angular momentum of this stuntdouble (body-fixed).
void addPrevFrc(const Vector3d &frc)
Adds force into the previous force of this stuntdouble.
void setMass(RealType mass)
Sets the mass of this stuntdoulbe.
Vector3d body2Lab(const Vector3d &v)
Converts a body fixed vector to a lab fixed vector.
void setPrevTrq(const Vector3d &trq)
Sets the previous torque of this stuntdouble.
Vector3d getDipole()
Returns the current dipole vector of this stuntDouble.
Vector3d getTrq(int snapshotNo)
Returns the torque of this stuntdouble in specified snapshot.
std::shared_ptr< GenericData > getPropertyByName(const std::string &propName)
Returns property.
void addProperty(std::shared_ptr< GenericData > genData)
Adds property into property map.
void setPrevQ(const Quat4d &q)
Sets the previous quaternion of this stuntdouble.
bool isRigidBody()
Tests if this stuntdouble is a rigid body.
Vector3d getPrevFrc()
Returns the previous force of this stuntdouble.
void addFrc(const Vector3d &frc)
Adds force into the current force of this stuntdouble.
Vector3d getFrc(int snapshotNo)
Returns the force of this stuntdouble in specified snapshot.
void setFrc(const Vector3d &frc, int snapshotNo)
Sets the force of this stuntdouble in specified snapshot.
Vector3d getFrc()
Returns the current force of this stuntdouble.
Vector3d getEuler()
Returns the current euler angles of this stuntdouble.
void addTrq(const Vector3d &trq)
Adds torque into the current torque of this stuntdouble.
void setQ(const Quat4d &q, int snapshotNo)
Sets the quaternion of this stuntdouble in specified snapshot.
Quat4d getPrevQ()
Returns the previous quaternion of this stuntdouble.
void setQ(const Quat4d &q)
Sets the current quaternion of this stuntdouble.
Vector3d getDipole(int snapshotNo)
Returns the dipole vector of this stuntDouble in specified snapshot.
Vector3d getEuler(int snapshotNo)
Returns the euler angles of this stuntdouble in specified snapshot.
Mat3x3d getQuadrupole(int snapshotNo)
Returns the quadrupole tensor of this stuntDouble in specified snapshot.
void setVel(const Vector3d &vel, int snapshotNo)
Sets the velocity of this stuntdouble in specified snapshot.
void setA(const RotMat3x3d &a, int snapshotNo)
Sets the rotation matrix of this stuntdouble in specified snapshot.
bool isAtom()
Tests if this stuntdouble is an atom.
void setJ(const Vector3d &angMom)
Sets the current angular momentum of this stuntdouble (body-fixed).
void setA(const RotMat3x3d &a)
Sets the current rotation matrix of this stuntdouble.
Quaternion is a sort of a higher-level complex number.
SnapshotManager class is an abstract class which maintains a series of snapshots.
"Don't move, or you're dead! Stand up! Captain, we've got them!"
Quat4d getQ()
Returns the current quaternion of this stuntDouble.
Mat3x3d getPrevQuadrupole()
Returns the previous quadrupole tensor of this stuntDouble.
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 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.
RotMat3x3d getA()
Returns the current rotation matrix of this stuntDouble.
Vector3d getVel()
Returns the current velocity of this stuntDouble.
virtual void setA(const RotMat3x3d &a)
Sets the current rotation matrix of this stuntDouble.
virtual void accept(BaseVisitor *v)=0
int linearAxis()
Returns the linear axis of the rigidbody, atom and directional atom will always return -1.
Vector3d getEuler()
Returns the current euler angles of this stuntDouble.
Vector3d getPrevJ()
Returns the previous angular momentum of this stuntDouble (body-fixed).
RealType getMass()
Returns the mass of this stuntDouble.
void setPrevVel(const Vector3d &vel)
Sets the previous velocity of this stuntDouble.
Mat3x3d getQuadrupole()
Returns the current quadrupole tensor of this stuntDouble.
Vector3d getPrevDipole()
Returns the previous dipole vector of this stuntDouble.
std::vector< std::shared_ptr< GenericData > > getProperties()
Returns all of the properties in PropertyMap.
std::shared_ptr< GenericData > getPropertyByName(const std::string &propName)
Returns property.
virtual Mat3x3d getI()=0
Returns the inertia tensor of this stuntDouble.
void addProperty(std::shared_ptr< GenericData > genData)
Adds property into property map.
virtual std::string getType()=0
Returns the name of this stuntDouble.
bool isLinear()
Tests the if this stuntDouble is a linear rigidbody.
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 setPos(const Vector3d &pos)
Sets the current position of this stuntDouble.
Vector3d getDipole()
Returns the current dipole vector of this stuntDouble.
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.
void setGlobalIndex(int index)
Sets the global index of this stuntDouble.
Vector3d getPrevFrc()
Returns the previous force of this stuntDouble.
Quat4d getPrevQ()
Returns the previous quaternion of this stuntDouble.
void setSnapshotManager(SnapshotManager *sman)
Sets the Snapshot Manager of this stuntDouble.
std::vector< std::string > getPropertyNames()
Returns all names of properties.
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.
bool isRigidBody()
Tests if this stuntDouble is a rigid body.
Vector3d getJ()
Returns the current angular momentum of this stuntDouble (body -fixed).
int getGlobalIndex()
Returns the global index of this stuntDouble.
bool isAtom()
Tests if this stuntDouble is an atom.
Vector3d getPrevPos()
Returns the previous position 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 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.
virtual void setType(const std::string &)
Sets the name 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).
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 setLocalIndex(int index)
Sets the local index 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 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.