--- trunk/OOPSE/libmdtools/EAM_FF.cpp 2003/07/17 19:25:51 631 +++ trunk/OOPSE/libmdtools/EAM_FF.cpp 2003/08/07 00:47:33 669 @@ -168,6 +168,9 @@ EAM_FF::EAM_FF(){ headAtomType = NULL; currentAtomType = NULL; + + // Set eamRcut to 0.0 + eamRcut = 0.0; // do the funtion wrapping wrapMeFF( this ); @@ -264,8 +267,19 @@ EAM_FF::~EAM_FF(){ #endif // is_mpi } -void EAM_FF::initForceField( int ljMixRule ){ + +void EAM_FF::calcRcut( void ){ + #ifdef IS_MPI + double tempEamRcut = eamRcut; + MPI_Allreduce( &tempEamRcut, &eamRcut, 1, MPI_DOUBLE, MPI_MAX, + MPI_COMM_WORLD); +#endif //is_mpi + entry_plug->setRcut(eamRcut); +} + + +void EAM_FF::initForceField( int ljMixRule ){ initFortran( ljMixRule, 0 ); } @@ -284,6 +298,7 @@ void EAM_FF::cleanMe( void ){ #endif // is_mpi } + void EAM_FF::readParams( void ){ atomStruct info; @@ -470,13 +485,14 @@ void EAM_FF::readParams( void ){ } entry_plug->useLJ = 0; - + entry_plug->useEAM = 1; // Walk down again and send out EAM type currentAtomType = headAtomType->next; while( currentAtomType != NULL ){ if( currentAtomType->name[0] != '\0' ){ isError = 0; + newEAMtype( &(currentAtomType->lattice_constant), &(currentAtomType->eam_nrho), &(currentAtomType->eam_drho), @@ -488,6 +504,7 @@ void EAM_FF::readParams( void ){ currentAtomType->eam_Frhovals, &(currentAtomType->eam_ident), &isError); + if( isError ){ sprintf( painCave.errMsg, "Error initializing the \"%s\" atom type in fortran EAM\n", @@ -506,6 +523,8 @@ void EAM_FF::readParams( void ){ "EAM_FF atom structures successfully sent to fortran\n" ); MPIcheckPoint(); #endif // is_mpi + + } @@ -513,7 +532,7 @@ void EAM_FF::initializeAtoms( int nAtoms, Atom** the_a void EAM_FF::initializeAtoms( int nAtoms, Atom** the_atoms ){ int i; - + // initialize the atoms @@ -533,7 +552,10 @@ 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; + } } @@ -661,19 +683,23 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil double **eam_rvals, double **eam_rhovals, double **eam_Frhovals){ - + double* myEam_rvals; + double* myEam_rhovals; + double* myEam_Frhovals; + char* ffPath_env = "FORCE_PARAM_PATH"; char* ffPath; char* the_token; char* eam_eof_test; FILE *eamFile; - const int BUFFERSIZE = 2000; + const int BUFFERSIZE = 3000; char temp[200]; int linenumber; int nReadLines; char eam_read_buffer[BUFFERSIZE]; + int i,j; linenumber = 0; @@ -814,20 +840,25 @@ int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil info.eam_rcut = atof( the_token); + + + // Ok now we have to allocate point arrays and read in number of points // Index the arrays for fortran, starting at 1 - *eam_Frhovals = new double[info.eam_nrho]; - *eam_rvals = new double[info.eam_nr]; - *eam_rhovals = new double[info.eam_nr]; + myEam_Frhovals = new double[info.eam_nrho]; + myEam_rvals = new double[info.eam_nr]; + myEam_rhovals = new double[info.eam_nr]; // Parse F of rho vals. // Assume for now that we have a complete number of lines nReadLines = int(info.eam_nrho/5); + + for (i=0;i