--- trunk/OOPSE/libmdtools/EAM_FF.cpp 2004/01/16 21:55:39 952 +++ trunk/OOPSE/libmdtools/EAM_FF.cpp 2004/06/11 16:46:13 1266 @@ -80,8 +80,8 @@ namespace EAM_NS{ if( !strcmp( info.name, name ) ){ sprintf( painCave.errMsg, - "Duplicate LJ atom type \"%s\" found in " - "the LJ_FF param file./n", + "Duplicate EAM atom type \"%s\" found in " + "the EAM_FF param file./n", name ); painCave.isFatal = 1; simError(); @@ -155,8 +155,11 @@ using namespace EAM_NS; // begins the actual forcefield stuff. //**************************************************************** +EAM_FF::EAM_FF() { + EAM_FF(""); +} -EAM_FF::EAM_FF(){ +EAM_FF::EAM_FF(char* the_variant){ char fileName[200]; char* ffPath_env = "FORCE_PARAM_PATH"; @@ -201,10 +204,26 @@ EAM_FF::EAM_FF(){ if( worldRank == 0 ){ #endif - // generate the force file name - - strcpy( fileName, "EAM_FF.frc" ); - // fprintf( stderr,"Trying to open %s\n", fileName ); + // generate the force file name + + strcpy( fileName, "EAM" ); + + if (strlen(the_variant) > 0) { + has_variant = 1; + strcpy( variant, the_variant); + strcat( fileName, "."); + strcat( fileName, variant ); + + sprintf( painCave.errMsg, + "Using %s variant of EAM force field.\n", + variant ); + painCave.severity = OOPSE_INFO; + painCave.isFatal = 0; + simError(); + } + strcat( fileName, ".frc"); + + //fprintf( stderr,"Trying to open %s\n", fileName ); // attempt to open the file in the current directory first. @@ -228,16 +247,19 @@ EAM_FF::EAM_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(); } } + #ifdef IS_MPI } @@ -317,7 +339,7 @@ void EAM_FF::readParams( void ){ // read in the atom types. headAtomType = new LinkedAtomType; - + fastForward( "AtomTypes", "eam atom readParams" ); // we are now at the AtomTypes section. @@ -407,7 +429,7 @@ void EAM_FF::readParams( void ){ MPIcheckPoint(); headAtomType = new LinkedAtomType; - recieveFrcStruct( &info, mpiAtomStructType ); + receiveFrcStruct( &info, mpiAtomStructType ); while( !info.last ){ @@ -433,7 +455,7 @@ void EAM_FF::readParams( void ){ MPIcheckPoint(); - recieveFrcStruct( &info, mpiAtomStructType ); + receiveFrcStruct( &info, mpiAtomStructType ); } @@ -548,11 +570,9 @@ void EAM_FF::initializeAtoms( int nAtoms, Atom** the_a the_atoms[i]->setMass( currentAtomType->mass ); the_atoms[i]->setIdent( currentAtomType->ident ); - the_atoms[i]->setEAM(); - the_atoms[i]->setEamRcut( currentAtomType->eam_rcut); if (eamRcut < currentAtomType->eam_rcut) eamRcut = currentAtomType->eam_rcut; - + } } @@ -729,7 +749,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil sprintf( painCave.errMsg, "Error opening the EAM force parameter file: %s\n" "Have you tried setting the FORCE_PARAM_PATH environment " - "vairable?\n", + "variable?\n", eamPotFile ); painCave.isFatal = 1; simError(); @@ -763,7 +783,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM ident line in %s\n", eamPotFile ); + "Error parsing EAM ident line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -772,7 +792,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ sprintf( painCave.errMsg, - "Error parseing EAM mass in %s\n", eamPotFile ); + "Error parsing EAM mass in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -780,7 +800,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ sprintf( painCave.errMsg, - "Error parseing EAM Lattice Constant %s\n", eamPotFile ); + "Error parsing EAM Lattice Constant %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -806,7 +826,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ sprintf( painCave.errMsg, - "Error parseing EAM drho in %s\n", eamPotFile ); + "Error parsing EAM drho in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -814,7 +834,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ sprintf( painCave.errMsg, - "Error parseing EAM # r in %s\n", eamPotFile ); + "Error parsing EAM # r in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -822,7 +842,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ sprintf( painCave.errMsg, - "Error parseing EAM dr in %s\n", eamPotFile ); + "Error parsing EAM dr in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -830,7 +850,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ sprintf( painCave.errMsg, - "Error parseing EAM rcut in %s\n", eamPotFile ); + "Error parsing EAM rcut in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -871,7 +891,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 1 if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -881,7 +901,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 2 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -891,7 +911,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 3 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -901,7 +921,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 4 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -911,7 +931,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 5 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -942,7 +962,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 1 if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -952,7 +972,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 2 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -962,7 +982,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 3 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -972,7 +992,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 4 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -982,7 +1002,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 5 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -1012,7 +1032,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 1 if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -1022,7 +1042,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 2 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -1032,7 +1052,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 3 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -1042,7 +1062,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 4 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); } @@ -1052,7 +1072,7 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil // Value 5 if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ sprintf( painCave.errMsg, - "Error parseing EAM nrho: line in %s\n", eamPotFile ); + "Error parsing EAM nrho: line in %s\n", eamPotFile ); painCave.isFatal = 1; simError(); }