1 |
< |
#include <cstdlib> |
2 |
< |
#include <cstdio> |
3 |
< |
#include <cstring> |
1 |
> |
#include <stdlib.h> |
2 |
> |
#include <stdio.h> |
3 |
> |
#include <string.h> |
4 |
|
|
5 |
|
#include <iostream> |
6 |
|
using namespace std; |
65 |
|
if( !strcmp( info.name, name ) ){ |
66 |
|
sprintf( painCave.errMsg, |
67 |
|
"Duplicate LJ atom type \"%s\" found in " |
68 |
< |
"the LJ_FF param file./n", |
68 |
> |
"the LJFF param file./n", |
69 |
|
name ); |
70 |
|
painCave.isFatal = 1; |
71 |
|
simError(); |
117 |
|
//**************************************************************** |
118 |
|
|
119 |
|
|
120 |
< |
LJ_FF::LJ_FF(){ |
120 |
> |
LJFF::LJFF(){ |
121 |
|
|
122 |
|
char fileName[200]; |
123 |
|
char* ffPath_env = "FORCE_PARAM_PATH"; |
124 |
|
char* ffPath; |
125 |
|
char temp[200]; |
126 |
– |
char errMsg[1000]; |
126 |
|
|
127 |
|
headAtomType = NULL; |
128 |
|
currentAtomType = NULL; |
161 |
|
|
162 |
|
// generate the force file name |
163 |
|
|
164 |
< |
strcpy( fileName, "LJ_FF.frc" ); |
165 |
< |
// fprintf( stderr,"Trying to open %s\n", fileName ); |
164 |
> |
strcpy( fileName, "LJFF.frc" ); |
165 |
> |
// fprintf( stderr,"Trying to open %s\n", fileName ); |
166 |
|
|
167 |
|
// attempt to open the file in the current directory first. |
168 |
|
|
186 |
|
frcFile = fopen( fileName, "r" ); |
187 |
|
|
188 |
|
if( frcFile == NULL ){ |
189 |
< |
|
189 |
> |
|
190 |
|
sprintf( painCave.errMsg, |
191 |
< |
"Error opening the force field parameter file: %s\n" |
192 |
< |
"Have you tried setting the FORCE_PARAM_PATH environment " |
193 |
< |
"vairable?\n", |
191 |
> |
"Error opening the force field parameter file:\n" |
192 |
> |
"\t%s\n" |
193 |
> |
"\tHave you tried setting the FORCE_PARAM_PATH environment " |
194 |
> |
"variable?\n", |
195 |
|
fileName ); |
196 |
+ |
painCave.severity = OOPSE_ERROR; |
197 |
|
painCave.isFatal = 1; |
198 |
|
simError(); |
199 |
|
} |
202 |
|
#ifdef IS_MPI |
203 |
|
} |
204 |
|
|
205 |
< |
sprintf( checkPointMsg, "LJ_FF file opened sucessfully." ); |
205 |
> |
sprintf( checkPointMsg, "LJFF file opened sucessfully." ); |
206 |
|
MPIcheckPoint(); |
207 |
|
|
208 |
|
#endif // is_mpi |
209 |
|
} |
210 |
|
|
211 |
|
|
212 |
< |
LJ_FF::~LJ_FF(){ |
212 |
> |
LJFF::~LJFF(){ |
213 |
|
|
214 |
|
if( headAtomType != NULL ) delete headAtomType; |
215 |
|
|
224 |
|
#endif // is_mpi |
225 |
|
} |
226 |
|
|
227 |
< |
void LJ_FF::initForceField( int ljMixRule ){ |
227 |
> |
void LJFF::initForceField( int ljMixRule ){ |
228 |
|
|
229 |
|
initFortran( ljMixRule, 0 ); |
230 |
|
} |
231 |
|
|
232 |
< |
void LJ_FF::cleanMe( void ){ |
232 |
> |
void LJFF::cleanMe( void ){ |
233 |
|
|
234 |
|
#ifdef IS_MPI |
235 |
|
|
244 |
|
#endif // is_mpi |
245 |
|
} |
246 |
|
|
247 |
< |
void LJ_FF::readParams( void ){ |
247 |
> |
void LJFF::readParams( void ){ |
248 |
|
|
249 |
|
atomStruct info; |
250 |
|
info.last = 1; // initialize last to have the last set. |
251 |
|
// if things go well, last will be set to 0 |
252 |
|
|
252 |
– |
int i; |
253 |
|
int identNum; |
254 |
|
|
255 |
|
|
303 |
|
// send out the linked list to all the other processes |
304 |
|
|
305 |
|
sprintf( checkPointMsg, |
306 |
< |
"LJ_FF atom structures read successfully." ); |
306 |
> |
"LJFF atom structures read successfully." ); |
307 |
|
MPIcheckPoint(); |
308 |
|
|
309 |
|
currentAtomType = headAtomType->next; //skip the first element who is a place holder. |
333 |
|
MPIcheckPoint(); |
334 |
|
|
335 |
|
headAtomType = new LinkedAtomType; |
336 |
< |
recieveFrcStruct( &info, mpiAtomStructType ); |
336 |
> |
receiveFrcStruct( &info, mpiAtomStructType ); |
337 |
|
|
338 |
|
while( !info.last ){ |
339 |
|
|
343 |
|
|
344 |
|
MPIcheckPoint(); |
345 |
|
|
346 |
< |
recieveFrcStruct( &info, mpiAtomStructType ); |
346 |
> |
receiveFrcStruct( &info, mpiAtomStructType ); |
347 |
|
} |
348 |
|
} |
349 |
|
#endif // is_mpi |
357 |
|
int isDipole = 0; |
358 |
|
int isSSD = 0; |
359 |
|
int isGB = 0; |
360 |
+ |
int isEAM = 0; |
361 |
+ |
int isCharge = 0; |
362 |
+ |
double charge = 0.0; |
363 |
|
double dipole = 0.0; |
364 |
|
|
365 |
|
currentAtomType = headAtomType; |
372 |
|
&isSSD, |
373 |
|
&isDipole, |
374 |
|
&isGB, |
375 |
+ |
&isEAM, |
376 |
+ |
&isCharge, |
377 |
|
&(currentAtomType->epslon), |
378 |
|
&(currentAtomType->sigma), |
379 |
+ |
&charge, |
380 |
|
&dipole, |
381 |
|
&isError ); |
382 |
|
if( isError ){ |
394 |
|
|
395 |
|
#ifdef IS_MPI |
396 |
|
sprintf( checkPointMsg, |
397 |
< |
"LJ_FF atom structures successfully sent to fortran\n" ); |
397 |
> |
"LJFF atom structures successfully sent to fortran\n" ); |
398 |
|
MPIcheckPoint(); |
399 |
|
#endif // is_mpi |
400 |
|
|
401 |
|
} |
402 |
|
|
403 |
|
|
404 |
< |
void LJ_FF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
404 |
> |
void LJFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
405 |
|
|
406 |
|
int i; |
407 |
|
|
408 |
|
// initialize the atoms |
409 |
|
|
410 |
|
|
405 |
– |
Atom* thisAtom; |
406 |
– |
|
411 |
|
for( i=0; i<nAtoms; i++ ){ |
412 |
|
|
413 |
|
currentAtomType = headAtomType->find( the_atoms[i]->getType() ); |
420 |
|
} |
421 |
|
|
422 |
|
the_atoms[i]->setMass( currentAtomType->mass ); |
419 |
– |
the_atoms[i]->setEpslon( currentAtomType->epslon ); |
420 |
– |
the_atoms[i]->setSigma( currentAtomType->sigma ); |
423 |
|
the_atoms[i]->setIdent( currentAtomType->ident ); |
422 |
– |
the_atoms[i]->setLJ(); |
424 |
|
|
425 |
|
if( bigSigma < currentAtomType->sigma ) bigSigma = currentAtomType->sigma; |
426 |
|
} |
427 |
|
} |
428 |
|
|
429 |
< |
void LJ_FF::initializeBonds( int nBonds, Bond** BondArray, |
429 |
> |
void LJFF::initializeBonds( int nBonds, Bond** BondArray, |
430 |
|
bond_pair* the_bonds ){ |
431 |
|
|
432 |
|
if( nBonds ){ |
433 |
|
sprintf( painCave.errMsg, |
434 |
< |
"LJ_FF does not support bonds.\n" ); |
434 |
> |
"LJFF does not support bonds.\n" ); |
435 |
|
painCave.isFatal = 1; |
436 |
|
simError(); |
437 |
|
} |
438 |
|
} |
439 |
|
|
440 |
< |
void LJ_FF::initializeBends( int nBends, Bend** bendArray, |
440 |
> |
void LJFF::initializeBends( int nBends, Bend** bendArray, |
441 |
|
bend_set* the_bends ){ |
442 |
|
|
443 |
|
if( nBends ){ |
444 |
|
sprintf( painCave.errMsg, |
445 |
< |
"LJ_FF does not support bends.\n" ); |
445 |
> |
"LJFF does not support bends.\n" ); |
446 |
|
painCave.isFatal = 1; |
447 |
|
simError(); |
448 |
|
} |
449 |
|
} |
450 |
|
|
451 |
< |
void LJ_FF::initializeTorsions( int nTorsions, Torsion** torsionArray, |
451 |
> |
void LJFF::initializeTorsions( int nTorsions, Torsion** torsionArray, |
452 |
|
torsion_set* the_torsions ){ |
453 |
|
|
454 |
|
if( nTorsions ){ |
455 |
|
sprintf( painCave.errMsg, |
456 |
< |
"LJ_FF does not support torsions.\n" ); |
456 |
> |
"LJFF does not support torsions.\n" ); |
457 |
|
painCave.isFatal = 1; |
458 |
|
simError(); |
459 |
|
} |
460 |
|
} |
461 |
|
|
462 |
< |
void LJ_FF::fastForward( char* stopText, char* searchOwner ){ |
462 |
> |
void LJFF::fastForward( char* stopText, char* searchOwner ){ |
463 |
|
|
464 |
|
int foundText = 0; |
465 |
|
char* the_token; |