45#include "types/StickyAdapter.hpp"
50#include "utils/simError.h"
54 bool StickyAdapter::isSticky() {
return at_->
hasProperty(StickyTypeID); }
56 StickyAtypeParameters StickyAdapter::getStickyParam() {
58 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
59 "StickyAdapter::getStickyParam was passed an atomType (%s)\n"
60 "\tthat does not appear to be a Sticky atom.\n",
61 at_->getName().c_str());
62 painCave.severity = OPENMD_ERROR;
68 if (data ==
nullptr) {
69 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
70 "StickyAdapter::getStickyParam could not find Sticky\n"
71 "\tparameters for atomType %s.\n",
72 at_->getName().c_str());
73 painCave.severity = OPENMD_ERROR;
78 std::shared_ptr<StickyAtypeData> stickyData =
79 std::dynamic_pointer_cast<StickyAtypeData>(data);
80 if (stickyData ==
nullptr) {
81 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
82 "StickyAdapter::getStickyParam could not convert\n"
83 "\tGenericData to StickyAtypeData for atom type %s\n",
84 at_->getName().c_str());
85 painCave.severity = OPENMD_ERROR;
90 return stickyData->getData();
93 bool StickyAdapter::isStickyPower() {
95 StickyAtypeParameters stickyParam = getStickyParam();
96 return stickyParam.isPower;
101 RealType StickyAdapter::getW0() {
102 StickyAtypeParameters stickyParam = getStickyParam();
103 return stickyParam.w0;
106 RealType StickyAdapter::getV0() {
107 StickyAtypeParameters stickyParam = getStickyParam();
108 return stickyParam.v0;
111 RealType StickyAdapter::getV0p() {
112 StickyAtypeParameters stickyParam = getStickyParam();
113 return stickyParam.v0p;
116 RealType StickyAdapter::getRl() {
117 StickyAtypeParameters stickyParam = getStickyParam();
118 return stickyParam.rl;
121 RealType StickyAdapter::getRu() {
122 StickyAtypeParameters stickyParam = getStickyParam();
123 return stickyParam.ru;
126 RealType StickyAdapter::getRlp() {
127 StickyAtypeParameters stickyParam = getStickyParam();
128 return stickyParam.rlp;
131 RealType StickyAdapter::getRup() {
132 StickyAtypeParameters stickyParam = getStickyParam();
133 return stickyParam.rup;
136 void StickyAdapter::makeSticky(RealType w0, RealType v0, RealType v0p,
137 RealType rl, RealType ru, RealType rlp,
138 RealType rup,
bool isPower) {
141 StickyAtypeParameters stickyParam {};
144 stickyParam.v0p = v0p;
147 stickyParam.rlp = rlp;
148 stickyParam.rup = rup;
149 stickyParam.isPower = isPower;
152 std::make_shared<StickyAtypeData>(StickyTypeID, stickyParam));
std::shared_ptr< GenericData > getPropertyByName(const string &propName)
Returns property.
void removeProperty(const string &propName)
Removes property from PropertyMap by name.
bool hasProperty(const string &propName)
Checks if property is in this PropertyMap.
void addProperty(std::shared_ptr< GenericData > genData)
Adds property into property map.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.