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 |
< |
AtomTypesSectionParser::AtomTypesSectionParser() { |
48 |
> |
AtomTypesSectionParser::AtomTypesSectionParser() { |
49 |
|
setSectionName("AtomTypes"); |
50 |
< |
} |
50 |
> |
} |
51 |
|
|
52 |
< |
void AtomTypesSectionParser::parseLine(ForceField& ff,const std::string& line, int lineNo){ |
52 |
> |
void AtomTypesSectionParser::parseLine(ForceField& ff,const std::string& line, int lineNo){ |
53 |
|
StringTokenizer tokenizer(line); |
54 |
|
int nTokens = tokenizer.countTokens(); |
55 |
|
|
56 |
|
//in AtomTypeSection, a line at least contains 2 tokens |
57 |
|
//atomTypeName and mass |
58 |
|
if (nTokens < 2) { |
59 |
< |
sprintf(painCave.errMsg, "AtomTypesSectionParser Error: Not enough tokens at line %d\n", |
60 |
< |
lineNo); |
61 |
< |
painCave.isFatal = 1; |
62 |
< |
simError(); |
59 |
> |
sprintf(painCave.errMsg, "AtomTypesSectionParser Error: Not enough tokens at line %d\n", |
60 |
> |
lineNo); |
61 |
> |
painCave.isFatal = 1; |
62 |
> |
simError(); |
63 |
|
|
64 |
|
} else { |
65 |
|
|
66 |
< |
std::string atomTypeName = tokenizer.nextToken(); |
67 |
< |
AtomType* atomType = ff.getAtomType(atomTypeName); |
66 |
> |
std::string atomTypeName = tokenizer.nextToken(); |
67 |
> |
AtomType* atomType = ff.getAtomType(atomTypeName); |
68 |
|
|
69 |
< |
if (atomType == NULL) { |
70 |
< |
atomType = new AtomType(); |
71 |
< |
int ident = ff.getNAtomType() + 1; |
72 |
< |
atomType->setIdent(ident); |
73 |
< |
atomType->setName(atomTypeName); |
74 |
< |
ff.addAtomType(atomTypeName, atomType); |
75 |
< |
} |
69 |
> |
if (atomType == NULL) { |
70 |
> |
atomType = new AtomType(); |
71 |
> |
int ident = ff.getNAtomType() + 1; |
72 |
> |
atomType->setIdent(ident); |
73 |
> |
atomType->setName(atomTypeName); |
74 |
> |
ff.addAtomType(atomTypeName, atomType); |
75 |
> |
} |
76 |
|
|
77 |
< |
double mass = tokenizer.nextTokenAsDouble(); |
78 |
< |
atomType->setMass(mass); |
77 |
> |
double mass = tokenizer.nextTokenAsDouble(); |
78 |
> |
atomType->setMass(mass); |
79 |
|
|
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
< |
} |
83 |
> |
} |
84 |
|
|
85 |
|
} //end namespace oopse |