33 |
|
} |
34 |
|
|
35 |
|
//register createDUFF to ForceFieldFactory |
36 |
< |
ForceFieldFactory::getInstance()->registerForceField("EAM", createDUFF); |
36 |
> |
ForceFieldFactory::getInstance()->registerForceField("EAM", createEAM); |
37 |
|
|
38 |
|
void EAM::parse(const std::string& filename) { |
39 |
|
ifstrstream* ffStream; |
58 |
|
double mass; |
59 |
|
StringTokenizer tokenizer(line); |
60 |
|
|
61 |
< |
if (tokenizer.countToken() >= 3) { |
61 |
> |
if (tokenizer.countTokens() >= 3) { |
62 |
|
atomTypeName = tokenizer.nextToken(); |
63 |
|
mass = tokenizer.nextTokenAsDouble(); |
64 |
|
std::string potentialParamFile = tokenizer.nextToken(); |
71 |
|
atomType->setEAM(); |
72 |
|
atomType->complete(); |
73 |
|
|
74 |
< |
parseEAMParamFile(potentialParamFile); |
74 |
> |
parseEAMParamFile(potentialParamFile, ident); |
75 |
|
|
76 |
|
//add atom type to AtomTypeContainer |
77 |
|
addAtomType(atomTypeName, atomType); |
80 |
|
|
81 |
|
} else { |
82 |
|
sprintf( painCave.errMsg, |
83 |
< |
"Not enough tokens when parsing Lennard-Jones Force Field : %s\n" |
83 |
> |
"Not enough tokens when parsing EAM Force Field : %s\n" |
84 |
|
"in line %d : %s\n", |
85 |
|
filename.c_str(), lineNo, line); |
86 |
|
painCave.severity = OOPSE_ERROR; |
96 |
|
|
97 |
|
} |
98 |
|
|
99 |
< |
void EAM::parseEAMParamFile(const std::string& potentialParamFile) { |
99 |
> |
void EAM::parseEAMParamFile(const std::string& potentialParamFile, int ident) { |
100 |
|
|
101 |
|
ifstrstream* ppfStream; |
102 |
|
ppfStream = openForceFiledFile(potentialParamFile); |
109 |
|
|
110 |
|
|
111 |
|
//The Second line contains atomic number, atomic mass, a lattice constant and lattic type |
112 |
< |
int ident; |
112 |
> |
int junk; |
113 |
|
double mass; |
114 |
|
double latticeConstant; |
115 |
< |
std::string lattic; |
115 |
> |
std::string lattice; |
116 |
|
if (ppfStream->getline(buffer, bufferSize)) { |
117 |
|
StringTokenizer tokenizer1(buffer); |
118 |
|
ident = tokenizer1.nextTokenAsInt(); |
119 |
|
|
120 |
|
if (tokenizer1.countTokens() >= 4) { |
121 |
< |
ident = tokenizer1.nextTokenAsInt(); |
121 |
> |
junk = tokenizer1.nextTokenAsInt(); |
122 |
|
mass = tokenizer1.nextTokenAsDouble(); |
123 |
|
latticeConstant = tokenizer1.nextTokenAsDouble(); |
124 |
|
lattice = tokenizer1.nextToken(); |
160 |
|
parseEAMArray(ppfStream, rhovals, nr); |
161 |
|
parseEAMArray(ppfStream, Frhovals, nrho); |
162 |
|
|
163 |
+ |
|
164 |
|
int status; |
165 |
|
newEAMtype(&latticeConstant, &nrho, &drho, &nr, &dr, &rcut, |
166 |
|
&rvals[0], &rhovals[0], &Frhovals[0], &ident, &status ); |