161 |
|
EAM_FF(""); |
162 |
|
} |
163 |
|
|
164 |
< |
EAM_FF::EAM_FF(char* the_variant){ |
164 |
> |
EAM_FF::EAM_FF(string the_variant){ |
165 |
|
|
166 |
< |
char fileName[200]; |
167 |
< |
char* ffPath_env = "FORCE_PARAM_PATH"; |
168 |
< |
char* ffPath; |
169 |
< |
char temp[200]; |
166 |
> |
string fileName; |
167 |
> |
string tempString; |
168 |
|
|
169 |
|
headAtomType = NULL; |
170 |
|
currentAtomType = NULL; |
203 |
|
|
204 |
|
// generate the force file name |
205 |
|
|
206 |
< |
strcpy( fileName, "EAM" ); |
206 |
> |
fileName = "EAM"; |
207 |
|
|
208 |
< |
if (strlen(the_variant) > 0) { |
208 |
> |
if (!the_variant.empty()) { |
209 |
|
has_variant = 1; |
210 |
< |
strcpy( variant, the_variant); |
211 |
< |
strcat( fileName, "."); |
214 |
< |
strcat( fileName, variant ); |
215 |
< |
|
210 |
> |
fileName += "." + the_variant + ".frc"; |
211 |
> |
|
212 |
|
sprintf( painCave.errMsg, |
213 |
|
"Using %s variant of EAM force field.\n", |
214 |
< |
variant ); |
214 |
> |
the_variant.c_str() ); |
215 |
|
painCave.severity = OOPSE_INFO; |
216 |
|
painCave.isFatal = 0; |
217 |
|
simError(); |
218 |
< |
} |
223 |
< |
strcat( fileName, ".frc"); |
218 |
> |
} |
219 |
|
|
220 |
|
//fprintf( stderr,"Trying to open %s\n", fileName ); |
221 |
|
|
222 |
|
// attempt to open the file in the current directory first. |
223 |
|
|
224 |
< |
frcFile = fopen( fileName, "r" ); |
224 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
225 |
|
|
226 |
|
if( frcFile == NULL ){ |
227 |
|
|
228 |
|
// next see if the force path enviorment variable is set |
229 |
|
|
230 |
< |
ffPath = getenv( ffPath_env ); |
231 |
< |
if( ffPath == NULL ) { |
232 |
< |
STR_DEFINE(ffPath, FRC_PATH ); |
233 |
< |
} |
239 |
< |
|
240 |
< |
|
241 |
< |
strcpy( temp, ffPath ); |
242 |
< |
strcat( temp, "/" ); |
243 |
< |
strcat( temp, fileName ); |
244 |
< |
strcpy( fileName, temp ); |
245 |
< |
|
246 |
< |
frcFile = fopen( fileName, "r" ); |
230 |
> |
tempString = ffPath + "/" + fileName; |
231 |
> |
fileName = tempString; |
232 |
> |
|
233 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
234 |
|
|
235 |
|
if( frcFile == NULL ){ |
236 |
|
|
239 |
|
"\t%s\n" |
240 |
|
"\tHave you tried setting the FORCE_PARAM_PATH environment " |
241 |
|
"variable?\n", |
242 |
< |
fileName ); |
242 |
> |
fileName.c_str() ); |
243 |
|
painCave.severity = OOPSE_ERROR; |
244 |
|
painCave.isFatal = 1; |
245 |
|
simError(); |