45#include "types/PolarizableAdapter.hpp"
50#include "utils/simError.h"
54 bool PolarizableAdapter::isPolarizable() {
58 PolarizableAtypeParameters PolarizableAdapter::getPolarizableParam() {
59 if (!isPolarizable()) {
60 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
61 "PolarizableAdapter::getPolarizableParam was passed an atomType "
63 "\tthat does not appear to be a polarizable atom.\n",
64 at_->getName().c_str());
65 painCave.severity = OPENMD_ERROR;
71 if (data ==
nullptr) {
73 painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
74 "PolarizableAdapter::getPolarizableParam could not find polarizable\n"
75 "\tparameters for atomType %s.\n",
76 at_->getName().c_str());
77 painCave.severity = OPENMD_ERROR;
82 std::shared_ptr<PolarizableAtypeData> polData =
83 std::dynamic_pointer_cast<PolarizableAtypeData>(data);
84 if (polData ==
nullptr) {
85 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
86 "PolarizableAdapter::getPolarizableParam could not convert\n"
87 "\tGenericData to PolarizableAtypeData for atom type %s\n",
88 at_->getName().c_str());
89 painCave.severity = OPENMD_ERROR;
94 return polData->getData();
97 RealType PolarizableAdapter::getPolarizability() {
98 PolarizableAtypeParameters polParam = getPolarizableParam();
99 return polParam.polarizability;
102 void PolarizableAdapter::makePolarizable(RealType polarizability) {
105 PolarizableAtypeParameters polParam {};
106 polParam.polarizability = polarizability;
109 std::make_shared<PolarizableAtypeData>(PolTypeID, polParam));
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.