45#include "io/ChargeAtomTypesSectionParser.hpp"
48#include "types/FixedChargeAdapter.hpp"
49#include "utils/simError.h"
53 ChargeAtomTypesSectionParser::ChargeAtomTypesSectionParser(
54 ForceFieldOptions& options) :
56 setSectionName(
"ChargeAtomTypes");
59 void ChargeAtomTypesSectionParser::parseLine(ForceField& ff,
60 const std::string& line,
62 StringTokenizer tokenizer(line);
63 int nTokens = tokenizer.countTokens();
67 painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
68 "ChargeAtomTypesSectionParser Error: Not enough tokens at line %d\n",
73 RealType cus_ = options_.getChargeUnitScaling();
75 std::string atomTypeName = tokenizer.nextToken();
77 AtomType* atomType = ff.getAtomType(atomTypeName);
78 if (atomType != NULL) {
79 FixedChargeAdapter fca = FixedChargeAdapter(atomType);
80 RealType charge = cus_ * tokenizer.nextTokenAsDouble();
81 fca.makeFixedCharge(charge);
83 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
84 "ChargeAtomTypesSectionParser Error: Can not find matching "
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.