45#include "types/FixedChargeAdapter.hpp"
50#include "utils/simError.h"
54 bool FixedChargeAdapter::isFixedCharge() {
58 FixedChargeAtypeParameters FixedChargeAdapter::getFixedChargeParam() {
59 if (!isFixedCharge()) {
60 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
61 "FixedChargeAdapter::getFixedChargeParam was passed an atomType "
63 "\tthat does not appear to be a fixed charge atom.\n",
64 at_->getName().c_str());
65 painCave.severity = OPENMD_ERROR;
71 if (data ==
nullptr) {
72 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
73 "FixedChargeAdapter::getFixedChargeParam could not find fixed "
75 "\tparameters for atomType %s.\n",
76 at_->getName().c_str());
77 painCave.severity = OPENMD_ERROR;
82 std::shared_ptr<FixedChargeAtypeData> fcData =
83 std::dynamic_pointer_cast<FixedChargeAtypeData>(data);
84 if (fcData ==
nullptr) {
85 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
86 "FixedChargeAdapter::getFixedChargeParam could not convert\n"
87 "\tGenericData to FixedChargeAtypeData for atom type %s\n",
88 at_->getName().c_str());
89 painCave.severity = OPENMD_ERROR;
94 return fcData->getData();
97 RealType FixedChargeAdapter::getCharge() {
98 FixedChargeAtypeParameters fcParam = getFixedChargeParam();
99 return fcParam.charge;
102 void FixedChargeAdapter::makeFixedCharge(RealType charge) {
105 FixedChargeAtypeParameters fcParam {};
106 fcParam.charge = charge;
108 at_->
addProperty(std::make_shared<FixedChargeAtypeData>(FCtypeID, fcParam));
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.