48#include "types/SuttonChenAdapter.hpp"
53#include "utils/simError.h"
57 bool SuttonChenAdapter::isSuttonChen() {
return at_->hasProperty(SCtypeID); }
60 if (!isSuttonChen()) {
62 painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
63 "SuttonChenAdapter::getSuttonChenParam was passed an atomType (%s)\n"
64 "\tthat does not appear to be a Sutton-Chen atom.\n",
65 at_->getName().c_str());
66 painCave.severity = OPENMD_ERROR;
71 std::shared_ptr<GenericData> data = at_->getPropertyByName(SCtypeID);
72 if (data ==
nullptr) {
74 painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
75 "SuttonChenAdapter::getSuttonChenParam could not find Sutton-Chen\n"
76 "\tparameters for atomType %s.\n",
77 at_->getName().c_str());
78 painCave.severity = OPENMD_ERROR;
83 std::shared_ptr<SCAtypeData> scData =
84 std::dynamic_pointer_cast<SCAtypeData>(data);
85 if (scData ==
nullptr) {
86 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
87 "SuttonChenAdapter::getSuttonChenParam could not convert\n"
88 "\tGenericData to SCAtypeData for atom type %s\n",
89 at_->getName().c_str());
90 painCave.severity = OPENMD_ERROR;
95 return scData->getData();
98 RealType SuttonChenAdapter::getC() {
99 SCAtypeParameters scParam = getSuttonChenParam();
103 RealType SuttonChenAdapter::getM() {
104 SCAtypeParameters scParam = getSuttonChenParam();
108 RealType SuttonChenAdapter::getN() {
109 SCAtypeParameters scParam = getSuttonChenParam();
113 RealType SuttonChenAdapter::getAlpha() {
114 SCAtypeParameters scParam = getSuttonChenParam();
115 return scParam.alpha;
118 RealType SuttonChenAdapter::getEpsilon() {
119 SCAtypeParameters scParam = getSuttonChenParam();
120 return scParam.epsilon;
123 void SuttonChenAdapter::makeSuttonChen(RealType c, RealType m, RealType n,
124 RealType alpha, RealType epsilon) {
125 if (isSuttonChen()) { at_->removeProperty(SCtypeID); }
127 SCAtypeParameters scParam {};
131 scParam.alpha = alpha;
132 scParam.epsilon = epsilon;
134 at_->addProperty(std::make_shared<SCAtypeData>(SCtypeID, scParam));
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.