45#include "io/GayBerneAtomTypesSectionParser.hpp"
48#include "types/AtomType.hpp"
49#include "types/GayBerneAdapter.hpp"
50#include "utils/simError.h"
54 GayBerneAtomTypesSectionParser::GayBerneAtomTypesSectionParser(
55 ForceFieldOptions& options) :
57 setSectionName(
"GayBerneAtomTypes");
60 void GayBerneAtomTypesSectionParser::parseLine(ForceField& ff,
61 const std::string& line,
63 StringTokenizer tokenizer(line);
64 int nTokens = tokenizer.countTokens();
69 painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
70 "GayBerneAtomTypesSectionParser: Not enough tokens at line %d\n"
71 "\tPlease note that GB atoms now require separate specification of "
73 "\tvalues for cross (X), Side-by-Side (S), and End-to-End (E) for "
75 "\tellipsoid type.\n",
80 RealType eus_ = options_.getEnergyUnitScaling();
81 RealType dus_ = options_.getDistanceUnitScaling();
82 std::string atomTypeName = tokenizer.nextToken();
83 AtomType* atomType = ff.getAtomType(atomTypeName);
84 if (atomType != NULL) {
85 RealType GB_d = dus_ * tokenizer.nextTokenAsDouble();
86 RealType GB_l = dus_ * tokenizer.nextTokenAsDouble();
87 RealType GB_eps_X = eus_ * tokenizer.nextTokenAsDouble();
88 RealType GB_eps_S = eus_ * tokenizer.nextTokenAsDouble();
89 RealType GB_eps_E = eus_ * tokenizer.nextTokenAsDouble();
90 RealType GB_dw = tokenizer.nextTokenAsDouble();
92 GayBerneAdapter gba = GayBerneAdapter(atomType);
93 gba.makeGayBerne(GB_d, GB_l, GB_eps_X, GB_eps_S, GB_eps_E, GB_dw);
96 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
97 "GayBerneAtomTypesSectionParser: Can not find matching "
99 "\tfor this GayBerne atom type\n",
100 atomTypeName.c_str());
101 painCave.isFatal = 1;
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.