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