48#include "flucq/FluctuatingChargeForces.hpp"
54#include "math/RealSymmetricTridiagonal.hpp"
55#include "types/FluctuatingChargeAdapter.hpp"
59 FluctuatingChargeForces::FluctuatingChargeForces(
SimInfo* info) :
60 info_(info), initialized_(false) {}
62 void FluctuatingChargeForces::initialize() {
65 FQtids.resize(forceField_->getNAtomType(), -1);
67 AtomTypeSet::iterator at;
68 for (at = simTypes_.begin(); at != simTypes_.end(); ++at)
69 if ((*at)->isFluctuatingCharge()) addType(*at);
74 void FluctuatingChargeForces::getSelfInteraction(
int atid, RealType charge,
77 if (!initialized_) initialize();
79 data = FQMap[FQtids[atid]];
81 DoublePolynomial vself = data.vself_;
83 force -= vself.evaluateDerivative(charge);
88 void FluctuatingChargeForces::addType(AtomType* atomType) {
89 FluctuatingChargeAtomData data;
90 FluctuatingChargeAdapter fqa = FluctuatingChargeAdapter(atomType);
91 if (fqa.isFluctuatingCharge()) {
92 data.electronegativity = fqa.getElectronegativity();
93 data.hardness = fqa.getHardness();
94 data.slaterN = fqa.getSlaterN();
95 data.slaterZeta = fqa.getSlaterZeta();
96 data.vself_ = fqa.getSelfPolynomial();
98 int atid = atomType->getIdent();
99 int fqtid = FQtypes.size();
101 pair<set<int>::iterator,
bool> ret;
102 ret = FQtypes.insert(atid);
103 if (ret.second ==
false) {
104 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
105 "FluctuatingChargeForces already had a previous fluctuating "
106 "charge entry with ident %d\n",
108 painCave.severity = OPENMD_INFO;
109 painCave.isFatal = 0;
112 FQtids[atid] = fqtid;
113 FQMap.push_back(data);
Real evaluate(const Real &x)
Calculates the value of this Polynomial evaluated at the given x value.
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.