45#include "io/UFFAtomTypesSectionParser.hpp"
48#include "types/UFFAdapter.hpp"
49#include "utils/simError.h"
53 UFFAtomTypesSectionParser::UFFAtomTypesSectionParser(
54 ForceFieldOptions& options) :
56 setSectionName(
"UFFAtomTypes");
59 void UFFAtomTypesSectionParser::parseLine(ForceField& ff,
60 const std::string& line,
62 StringTokenizer tokenizer(line);
63 int nTokens = tokenizer.countTokens();
69 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
70 "UFFAtomTypesSectionParser Error: "
71 "Not enough tokens at line %d\n",
76 std::string atomTypeName = tokenizer.nextToken();
77 AtomType* atomType = ff.getAtomType(atomTypeName);
79 if (atomType != NULL) {
80 UFFAdapter uffa = UFFAdapter(atomType);
82 RealType r1 = tokenizer.nextTokenAsDouble();
83 RealType theta0 = tokenizer.nextTokenAsDouble();
84 RealType x1 = tokenizer.nextTokenAsDouble();
85 RealType D1 = tokenizer.nextTokenAsDouble();
86 RealType zeta = tokenizer.nextTokenAsDouble();
87 RealType Z1 = tokenizer.nextTokenAsDouble();
88 RealType Vi = tokenizer.nextTokenAsDouble();
89 RealType Uj = tokenizer.nextTokenAsDouble();
90 RealType Xi = tokenizer.nextTokenAsDouble();
91 RealType Hard = tokenizer.nextTokenAsDouble();
92 RealType Radius = tokenizer.nextTokenAsDouble();
94 r1 *= options_.getDistanceUnitScaling();
95 theta0 *= options_.getAngleUnitScaling();
96 x1 *= options_.getDistanceUnitScaling();
97 D1 *= options_.getEnergyUnitScaling();
98 Z1 *= options_.getChargeUnitScaling();
99 Vi *= options_.getEnergyUnitScaling();
100 Uj *= options_.getEnergyUnitScaling();
102 uffa.makeUFF(r1, theta0, x1, D1, zeta, Z1, Vi, Uj, Xi, Hard, Radius);
105 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
106 "UFFAtomTypesSectionParser Error: Atom Type [%s]"
107 " has not been created yet\n",
108 atomTypeName.c_str());
109 painCave.isFatal = 1;
115 void UFFAtomTypesSectionParser::validateSection(ForceField&) {
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.