45#include "types/LennardJonesAdapter.hpp"
50#include "utils/simError.h"
54 bool LennardJonesAdapter::isLennardJones() {
58 LJAtypeParameters LennardJonesAdapter::getLJParam() {
59 if (!isLennardJones()) {
60 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
61 "LennardJonesAdapter::getLJParam was passed an atomType (%s)\n"
62 "\tthat does not appear to be a Lennard-Jones atom.\n",
63 at_->getName().c_str());
64 painCave.severity = OPENMD_ERROR;
70 if (data ==
nullptr) {
71 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
72 "LennardJonesAdapter::getLJParam could not find Lennard-Jones\n"
73 "\tparameters for atomType %s.\n",
74 at_->getName().c_str());
75 painCave.severity = OPENMD_ERROR;
80 std::shared_ptr<LJAtypeData> ljData =
81 std::dynamic_pointer_cast<LJAtypeData>(data);
82 if (ljData ==
nullptr) {
83 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
84 "LennardJonesAdapter::getLJParam could not convert\n"
85 "\tGenericData to LJAtypeData for atom type %s\n",
86 at_->getName().c_str());
87 painCave.severity = OPENMD_ERROR;
92 return ljData->getData();
95 RealType LennardJonesAdapter::getSigma() {
96 LJAtypeParameters ljParam = getLJParam();
100 RealType LennardJonesAdapter::getEpsilon() {
101 LJAtypeParameters ljParam = getLJParam();
102 return ljParam.epsilon;
105 bool LennardJonesAdapter::isSoft() {
106 LJAtypeParameters ljParam = getLJParam();
107 return ljParam.isSoft;
110 void LennardJonesAdapter::makeLennardJones(RealType sigma, RealType epsilon,
114 LJAtypeParameters ljParam {};
115 ljParam.epsilon = epsilon;
116 ljParam.sigma = sigma;
117 ljParam.isSoft = isSoft;
119 at_->
addProperty(std::make_shared<LJAtypeData>(LJtypeID, ljParam));
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.