49 |
|
setSectionName("DirectionalAtomTypes"); |
50 |
|
} |
51 |
|
|
52 |
< |
void DirectionalAtomTypesSectionParser::parseLine(ForceField& ff,const std::string& line, int lineNo){ |
52 |
> |
void DirectionalAtomTypesSectionParser::parseLine(ForceField& ff, |
53 |
> |
const std::string& line, |
54 |
> |
int lineNo){ |
55 |
|
StringTokenizer tokenizer(line); |
56 |
|
int nTokens = tokenizer.countTokens(); |
57 |
|
|
58 |
|
//in AtomTypeSection, a line at least contains 2 tokens |
59 |
|
//atomTypeName and mass |
60 |
|
if (nTokens < 4) { |
61 |
< |
sprintf(painCave.errMsg, "DirectionalAtomTypesSectionParser Error: Not enough tokens at line %d\n", |
62 |
< |
lineNo); |
61 |
> |
sprintf(painCave.errMsg, |
62 |
> |
"DirectionalAtomTypesSectionParser Error: Not enough tokens at line %d\n", |
63 |
> |
lineNo); |
64 |
|
painCave.isFatal = 1; |
65 |
|
simError(); |
66 |
|
|
70 |
|
AtomType* atomType = ff.getAtomType(atomTypeName); |
71 |
|
DirectionalAtomType* dAtomType; |
72 |
|
if (atomType == NULL) { |
73 |
< |
dAtomType = new DirectionalAtomType(); |
74 |
< |
int ident = ff.getNAtomType() + 1; |
75 |
< |
dAtomType->setIdent(ident); |
76 |
< |
dAtomType->setName(atomTypeName); |
77 |
< |
ff.addAtomType(atomTypeName, dAtomType); |
73 |
> |
dAtomType = new DirectionalAtomType(); |
74 |
> |
int ident = ff.getNAtomType() + 1; |
75 |
> |
dAtomType->setIdent(ident); |
76 |
> |
dAtomType->setName(atomTypeName); |
77 |
> |
ff.addAtomType(atomTypeName, dAtomType); |
78 |
|
} else { |
79 |
< |
dAtomType = dynamic_cast<DirectionalAtomType*>(atomType); |
80 |
< |
if (dAtomType == NULL) { |
81 |
< |
sprintf(painCave.errMsg,"DirectionalAtomTypesSectionParser:: Can not cast to DirectionalAtomType"); |
82 |
< |
painCave.isFatal = 1; |
83 |
< |
simError(); |
84 |
< |
} |
79 |
> |
dAtomType = dynamic_cast<DirectionalAtomType*>(atomType); |
80 |
> |
if (dAtomType == NULL) { |
81 |
> |
sprintf(painCave.errMsg, |
82 |
> |
"DirectionalAtomTypesSectionParser:: Can not cast to DirectionalAtomType"); |
83 |
> |
painCave.isFatal = 1; |
84 |
> |
simError(); |
85 |
> |
} |
86 |
|
} |
87 |
< |
|
87 |
> |
|
88 |
|
double Ixx = tokenizer.nextTokenAsDouble(); |
89 |
|
double Iyy = tokenizer.nextTokenAsDouble(); |
90 |
|
double Izz = tokenizer.nextTokenAsDouble(); |