1 |
< |
/* |
1 |
> |
/* |
2 |
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
|
* The University of Notre Dame grants you ("Licensee") a |
45 |
|
#include "utils/simError.h" |
46 |
|
namespace oopse { |
47 |
|
|
48 |
< |
ChargeAtomTypesSectionParser::ChargeAtomTypesSectionParser() { |
48 |
> |
ChargeAtomTypesSectionParser::ChargeAtomTypesSectionParser(ForceFieldOptions& options) : options_(options) { |
49 |
|
setSectionName("ChargeAtomTypes"); |
50 |
< |
} |
50 |
> |
} |
51 |
|
|
52 |
< |
void ChargeAtomTypesSectionParser::parseLine(ForceField& ff,const std::string& line, int lineNo){ |
52 |
> |
void ChargeAtomTypesSectionParser::parseLine(ForceField& ff,const std::string& line, int lineNo){ |
53 |
|
StringTokenizer tokenizer(line); |
54 |
|
int nTokens = tokenizer.countTokens(); |
55 |
|
|
56 |
|
if (nTokens < 2) { |
57 |
< |
sprintf(painCave.errMsg, "ChargeAtomTypesSectionParser Error: Not enough tokens at line %d\n", |
58 |
< |
lineNo); |
59 |
< |
painCave.isFatal = 1; |
60 |
< |
simError(); |
57 |
> |
sprintf(painCave.errMsg, "ChargeAtomTypesSectionParser Error: Not enough tokens at line %d\n", |
58 |
> |
lineNo); |
59 |
> |
painCave.isFatal = 1; |
60 |
> |
simError(); |
61 |
|
} else { |
62 |
|
|
63 |
< |
std::string atomTypeName = tokenizer.nextToken(); |
63 |
> |
std::string atomTypeName = tokenizer.nextToken(); |
64 |
|
|
65 |
< |
AtomType* atomType = ff.getAtomType(atomTypeName); |
66 |
< |
if (atomType != NULL) { |
67 |
< |
double charge = tokenizer.nextTokenAsDouble(); |
65 |
> |
AtomType* atomType = ff.getAtomType(atomTypeName); |
66 |
> |
if (atomType != NULL) { |
67 |
> |
double charge = tokenizer.nextTokenAsDouble(); |
68 |
|
|
69 |
< |
atomType->addProperty(new DoubleGenericData("Charge", charge)); |
70 |
< |
atomType->setCharge(); |
71 |
< |
} else { |
69 |
> |
atomType->addProperty(new DoubleGenericData("Charge", charge)); |
70 |
> |
atomType->setCharge(); |
71 |
> |
} else { |
72 |
|
|
73 |
< |
sprintf(painCave.errMsg, "ChargeAtomTypesSectionParser Error: Can not find matched AtomType at line %d\n", |
74 |
< |
lineNo); |
75 |
< |
painCave.isFatal = 1; |
76 |
< |
simError(); |
77 |
< |
} |
73 |
> |
sprintf(painCave.errMsg, "ChargeAtomTypesSectionParser Error: Can not find matched AtomType at line %d\n", |
74 |
> |
lineNo); |
75 |
> |
painCave.isFatal = 1; |
76 |
> |
simError(); |
77 |
> |
} |
78 |
|
|
79 |
|
} |
80 |
|
|
81 |
< |
} |
81 |
> |
} |
82 |
|
|
83 |
|
|
84 |
|
} //end namespace oopse |