--- trunk/OOPSE/libmdtools/LJFF.cpp 2003/06/19 22:02:44 559 +++ trunk/OOPSE/libmdtools/LJFF.cpp 2004/06/02 18:27:52 1224 @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include using namespace std; @@ -65,7 +65,7 @@ namespace LJ_NS{ if( !strcmp( info.name, name ) ){ sprintf( painCave.errMsg, "Duplicate LJ atom type \"%s\" found in " - "the LJ_FF param file./n", + "the LJFF param file./n", name ); painCave.isFatal = 1; simError(); @@ -117,13 +117,12 @@ using namespace LJ_NS; //**************************************************************** -LJ_FF::LJ_FF(){ +LJFF::LJFF(){ char fileName[200]; char* ffPath_env = "FORCE_PARAM_PATH"; char* ffPath; char temp[200]; - char errMsg[1000]; headAtomType = NULL; currentAtomType = NULL; @@ -162,8 +161,8 @@ LJ_FF::LJ_FF(){ // generate the force file name - strcpy( fileName, "LJ_FF.frc" ); - // fprintf( stderr,"Trying to open %s\n", fileName ); + strcpy( fileName, "LJFF.frc" ); + // fprintf( stderr,"Trying to open %s\n", fileName ); // attempt to open the file in the current directory first. @@ -187,12 +186,14 @@ LJ_FF::LJ_FF(){ frcFile = fopen( fileName, "r" ); if( frcFile == NULL ){ - + sprintf( painCave.errMsg, - "Error opening the force field parameter file: %s\n" - "Have you tried setting the FORCE_PARAM_PATH environment " - "vairable?\n", + "Error opening the force field parameter file:\n" + "\t%s\n" + "\tHave you tried setting the FORCE_PARAM_PATH environment " + "variable?\n", fileName ); + painCave.severity = OOPSE_ERROR; painCave.isFatal = 1; simError(); } @@ -201,14 +202,14 @@ LJ_FF::LJ_FF(){ #ifdef IS_MPI } - sprintf( checkPointMsg, "LJ_FF file opened sucessfully." ); + sprintf( checkPointMsg, "LJFF file opened sucessfully." ); MPIcheckPoint(); #endif // is_mpi } -LJ_FF::~LJ_FF(){ +LJFF::~LJFF(){ if( headAtomType != NULL ) delete headAtomType; @@ -223,12 +224,12 @@ LJ_FF::~LJ_FF(){ #endif // is_mpi } -void LJ_FF::initForceField( int ljMixRule ){ +void LJFF::initForceField( int ljMixRule ){ initFortran( ljMixRule, 0 ); } -void LJ_FF::cleanMe( void ){ +void LJFF::cleanMe( void ){ #ifdef IS_MPI @@ -243,13 +244,12 @@ void LJ_FF::cleanMe( void ){ #endif // is_mpi } -void LJ_FF::readParams( void ){ +void LJFF::readParams( void ){ atomStruct info; info.last = 1; // initialize last to have the last set. // if things go well, last will be set to 0 - int i; int identNum; @@ -303,7 +303,7 @@ void LJ_FF::readParams( void ){ // send out the linked list to all the other processes sprintf( checkPointMsg, - "LJ_FF atom structures read successfully." ); + "LJFF atom structures read successfully." ); MPIcheckPoint(); currentAtomType = headAtomType->next; //skip the first element who is a place holder. @@ -333,7 +333,7 @@ void LJ_FF::readParams( void ){ MPIcheckPoint(); headAtomType = new LinkedAtomType; - recieveFrcStruct( &info, mpiAtomStructType ); + receiveFrcStruct( &info, mpiAtomStructType ); while( !info.last ){ @@ -343,7 +343,7 @@ void LJ_FF::readParams( void ){ MPIcheckPoint(); - recieveFrcStruct( &info, mpiAtomStructType ); + receiveFrcStruct( &info, mpiAtomStructType ); } } #endif // is_mpi @@ -357,6 +357,9 @@ void LJ_FF::readParams( void ){ int isDipole = 0; int isSSD = 0; int isGB = 0; + int isEAM = 0; + int isCharge = 0; + double charge = 0.0; double dipole = 0.0; currentAtomType = headAtomType; @@ -369,8 +372,11 @@ void LJ_FF::readParams( void ){ &isSSD, &isDipole, &isGB, + &isEAM, + &isCharge, &(currentAtomType->epslon), &(currentAtomType->sigma), + &charge, &dipole, &isError ); if( isError ){ @@ -388,22 +394,20 @@ void LJ_FF::readParams( void ){ #ifdef IS_MPI sprintf( checkPointMsg, - "LJ_FF atom structures successfully sent to fortran\n" ); + "LJFF atom structures successfully sent to fortran\n" ); MPIcheckPoint(); #endif // is_mpi } -void LJ_FF::initializeAtoms( int nAtoms, Atom** the_atoms ){ +void LJFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ int i; // initialize the atoms - Atom* thisAtom; - for( i=0; ifind( the_atoms[i]->getType() ); @@ -416,49 +420,46 @@ void LJ_FF::initializeAtoms( int nAtoms, Atom** the_at } the_atoms[i]->setMass( currentAtomType->mass ); - the_atoms[i]->setEpslon( currentAtomType->epslon ); - the_atoms[i]->setSigma( currentAtomType->sigma ); the_atoms[i]->setIdent( currentAtomType->ident ); - the_atoms[i]->setLJ(); if( bigSigma < currentAtomType->sigma ) bigSigma = currentAtomType->sigma; } } -void LJ_FF::initializeBonds( int nBonds, Bond** BondArray, +void LJFF::initializeBonds( int nBonds, Bond** BondArray, bond_pair* the_bonds ){ if( nBonds ){ sprintf( painCave.errMsg, - "LJ_FF does not support bonds.\n" ); + "LJFF does not support bonds.\n" ); painCave.isFatal = 1; simError(); } } -void LJ_FF::initializeBends( int nBends, Bend** bendArray, +void LJFF::initializeBends( int nBends, Bend** bendArray, bend_set* the_bends ){ if( nBends ){ sprintf( painCave.errMsg, - "LJ_FF does not support bends.\n" ); + "LJFF does not support bends.\n" ); painCave.isFatal = 1; simError(); } } -void LJ_FF::initializeTorsions( int nTorsions, Torsion** torsionArray, +void LJFF::initializeTorsions( int nTorsions, Torsion** torsionArray, torsion_set* the_torsions ){ if( nTorsions ){ sprintf( painCave.errMsg, - "LJ_FF does not support torsions.\n" ); + "LJFF does not support torsions.\n" ); painCave.isFatal = 1; simError(); } } -void LJ_FF::fastForward( char* stopText, char* searchOwner ){ +void LJFF::fastForward( char* stopText, char* searchOwner ){ int foundText = 0; char* the_token;