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 |
|
|
200 |
|
#ifdef IS_MPI |
201 |
|
} |
202 |
|
|
203 |
< |
sprintf( checkPointMsg, "LJ_FF file opened sucessfully." ); |
203 |
> |
sprintf( checkPointMsg, "LJFF file opened sucessfully." ); |
204 |
|
MPIcheckPoint(); |
205 |
|
|
206 |
|
#endif // is_mpi |
207 |
|
} |
208 |
|
|
209 |
|
|
210 |
< |
LJ_FF::~LJ_FF(){ |
210 |
> |
LJFF::~LJFF(){ |
211 |
|
|
212 |
|
if( headAtomType != NULL ) delete headAtomType; |
213 |
|
|
222 |
|
#endif // is_mpi |
223 |
|
} |
224 |
|
|
225 |
< |
void LJ_FF::initForceField( int ljMixRule ){ |
225 |
> |
void LJFF::initForceField( int ljMixRule ){ |
226 |
|
|
227 |
|
initFortran( ljMixRule, 0 ); |
228 |
|
} |
229 |
|
|
230 |
< |
void LJ_FF::cleanMe( void ){ |
230 |
> |
void LJFF::cleanMe( void ){ |
231 |
|
|
232 |
|
#ifdef IS_MPI |
233 |
|
|
242 |
|
#endif // is_mpi |
243 |
|
} |
244 |
|
|
245 |
< |
void LJ_FF::readParams( void ){ |
245 |
> |
void LJFF::readParams( void ){ |
246 |
|
|
247 |
|
atomStruct info; |
248 |
|
info.last = 1; // initialize last to have the last set. |
249 |
|
// if things go well, last will be set to 0 |
250 |
|
|
252 |
– |
int i; |
251 |
|
int identNum; |
252 |
|
|
253 |
|
|
301 |
|
// send out the linked list to all the other processes |
302 |
|
|
303 |
|
sprintf( checkPointMsg, |
304 |
< |
"LJ_FF atom structures read successfully." ); |
304 |
> |
"LJFF atom structures read successfully." ); |
305 |
|
MPIcheckPoint(); |
306 |
|
|
307 |
|
currentAtomType = headAtomType->next; //skip the first element who is a place holder. |
331 |
|
MPIcheckPoint(); |
332 |
|
|
333 |
|
headAtomType = new LinkedAtomType; |
334 |
< |
recieveFrcStruct( &info, mpiAtomStructType ); |
334 |
> |
receiveFrcStruct( &info, mpiAtomStructType ); |
335 |
|
|
336 |
|
while( !info.last ){ |
337 |
|
|
341 |
|
|
342 |
|
MPIcheckPoint(); |
343 |
|
|
344 |
< |
recieveFrcStruct( &info, mpiAtomStructType ); |
344 |
> |
receiveFrcStruct( &info, mpiAtomStructType ); |
345 |
|
} |
346 |
|
} |
347 |
|
#endif // is_mpi |
355 |
|
int isDipole = 0; |
356 |
|
int isSSD = 0; |
357 |
|
int isGB = 0; |
358 |
+ |
int isEAM = 0; |
359 |
+ |
int isCharge = 0; |
360 |
+ |
double charge = 0.0; |
361 |
|
double dipole = 0.0; |
362 |
|
|
363 |
|
currentAtomType = headAtomType; |
370 |
|
&isSSD, |
371 |
|
&isDipole, |
372 |
|
&isGB, |
373 |
+ |
&isEAM, |
374 |
+ |
&isCharge, |
375 |
|
&(currentAtomType->epslon), |
376 |
|
&(currentAtomType->sigma), |
377 |
+ |
&charge, |
378 |
|
&dipole, |
379 |
|
&isError ); |
380 |
|
if( isError ){ |
392 |
|
|
393 |
|
#ifdef IS_MPI |
394 |
|
sprintf( checkPointMsg, |
395 |
< |
"LJ_FF atom structures successfully sent to fortran\n" ); |
395 |
> |
"LJFF atom structures successfully sent to fortran\n" ); |
396 |
|
MPIcheckPoint(); |
397 |
|
#endif // is_mpi |
398 |
|
|
399 |
|
} |
400 |
|
|
401 |
|
|
402 |
< |
void LJ_FF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
402 |
> |
void LJFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
403 |
|
|
404 |
|
int i; |
405 |
|
|
406 |
|
// initialize the atoms |
407 |
|
|
408 |
|
|
405 |
– |
Atom* thisAtom; |
406 |
– |
|
409 |
|
for( i=0; i<nAtoms; i++ ){ |
410 |
|
|
411 |
|
currentAtomType = headAtomType->find( the_atoms[i]->getType() ); |
427 |
|
} |
428 |
|
} |
429 |
|
|
430 |
< |
void LJ_FF::initializeBonds( int nBonds, Bond** BondArray, |
430 |
> |
void LJFF::initializeBonds( int nBonds, Bond** BondArray, |
431 |
|
bond_pair* the_bonds ){ |
432 |
|
|
433 |
|
if( nBonds ){ |
434 |
|
sprintf( painCave.errMsg, |
435 |
< |
"LJ_FF does not support bonds.\n" ); |
435 |
> |
"LJFF does not support bonds.\n" ); |
436 |
|
painCave.isFatal = 1; |
437 |
|
simError(); |
438 |
|
} |
439 |
|
} |
440 |
|
|
441 |
< |
void LJ_FF::initializeBends( int nBends, Bend** bendArray, |
441 |
> |
void LJFF::initializeBends( int nBends, Bend** bendArray, |
442 |
|
bend_set* the_bends ){ |
443 |
|
|
444 |
|
if( nBends ){ |
445 |
|
sprintf( painCave.errMsg, |
446 |
< |
"LJ_FF does not support bends.\n" ); |
446 |
> |
"LJFF does not support bends.\n" ); |
447 |
|
painCave.isFatal = 1; |
448 |
|
simError(); |
449 |
|
} |
450 |
|
} |
451 |
|
|
452 |
< |
void LJ_FF::initializeTorsions( int nTorsions, Torsion** torsionArray, |
452 |
> |
void LJFF::initializeTorsions( int nTorsions, Torsion** torsionArray, |
453 |
|
torsion_set* the_torsions ){ |
454 |
|
|
455 |
|
if( nTorsions ){ |
456 |
|
sprintf( painCave.errMsg, |
457 |
< |
"LJ_FF does not support torsions.\n" ); |
457 |
> |
"LJFF does not support torsions.\n" ); |
458 |
|
painCave.isFatal = 1; |
459 |
|
simError(); |
460 |
|
} |
461 |
|
} |
462 |
|
|
463 |
< |
void LJ_FF::fastForward( char* stopText, char* searchOwner ){ |
463 |
> |
void LJFF::fastForward( char* stopText, char* searchOwner ){ |
464 |
|
|
465 |
|
int foundText = 0; |
466 |
|
char* the_token; |