76 |
|
std::string line; |
77 |
|
char buffer[bufferSize]; |
78 |
|
int lineNo = 0; |
79 |
+ |
int atomIdent = getNAtomType() + 1; //atom's indent begins from 1 (since only fortran's array begins from 1) |
80 |
|
ParseState currentSection = DUFF::UnknownSection; |
81 |
|
|
82 |
|
while(ffStream.getline(buffer, bufferSize)){ |
90 |
|
|
91 |
|
switch(currentSection) { |
92 |
|
case DUFF::AtomTypeSection : |
93 |
< |
parseAtomType(line, lineNo); |
93 |
> |
parseAtomType(line, lineNo, atomIdent); |
94 |
|
break; |
95 |
|
|
96 |
+ |
case DUFF::DirectionalAtomTypeSection : |
97 |
+ |
parseDirectionalAtomType(line, lineNo); |
98 |
+ |
break; |
99 |
+ |
|
100 |
|
case DUFF::BondTypeSection : |
101 |
|
parseBondType(line, lineNo); |
102 |
|
break; |
154 |
|
//in AtomTypeSection, a line at least contains 5 tokens |
155 |
|
//atomTypeName, is Directional, isLJ, isCharge and mass |
156 |
|
if (nTokens < 5) { |
157 |
< |
sprintf( painCave.errMsg, |
153 |
< |
"Not enough tokens when parsing DUFF Force Field : %s\n" |
154 |
< |
"in line %d : %s\n", |
155 |
< |
filename.c_str(), lineNo, line); |
156 |
< |
painCave.severity = OOPSE_ERROR; |
157 |
< |
painCave.isFatal = 1; |
158 |
< |
simError(); |
159 |
< |
|
160 |
< |
|
157 |
> |
|
158 |
|
} else { |
159 |
|
|
160 |
|
std::string atomTypeName = tokenizer.nextToken(); |
198 |
|
atomType->setName(atomTypeName); |
199 |
|
atomType->setMass(mass); |
200 |
|
|
201 |
< |
//by default, all of the properties in AtomTypeProperties is set to 0 |
202 |
< |
//In Lennard-Jones Force Field, we only need to set Lennard-Jones to true |
203 |
< |
atomType->setLennardJones(); |
201 |
> |
if (isLJ) { |
202 |
> |
atomType->setLennardJones(); |
203 |
> |
} |
204 |
|
|
205 |
+ |
if (isCharge) { |
206 |
+ |
atomType->setCharge(); |
207 |
+ |
} |
208 |
+ |
|
209 |
|
atomType->setIdent(ident); |
210 |
|
|
211 |
|
atomType->complete(); |
265 |
|
|
266 |
|
} |
267 |
|
|
268 |
< |
dAtomType->setDipole(isDipole); |
269 |
< |
dAtomType->setSticky(isSticky); |
268 |
> |
if (isDipole) { |
269 |
> |
dAtomType->setDipole(); |
270 |
> |
} |
271 |
|
|
272 |
+ |
if (isSticky) { |
273 |
+ |
dAtomType->setSticky(); |
274 |
+ |
} |
275 |
+ |
|
276 |
|
Mat3x3d inertialMat; |
277 |
|
inertialMat(0, 0) = Ixx; |
278 |
|
inertialMat(1, 1) = Ixx; |