ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/EAM_FF.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/EAM_FF.cpp (file contents):
Revision 657 by chuckv, Wed Jul 30 21:17:01 2003 UTC vs.
Revision 814 by mmeineke, Thu Oct 23 19:57:25 2003 UTC

# Line 30 | Line 30 | namespace EAM_NS{
30      double mass;
31      double lattice_constant;
32      double eam_drho;  // The distance between each of the points indexed by rho.
33 +    double eam_rcut;  // The cutoff radius for eam.
34      double eam_dr;    // The distance between each of the rho points.    
35      int eam_nrho;  // Number of points indexed by rho
36      int eam_nr;    // The number of points based on r (Both Phi(r) and Rho(r)).
36    double eam_rcut;  // The cutoff radius for eam.
37      int eam_ident; // Atomic number
38      int ident;
39      int last;      //  0  -> default
# Line 76 | Line 76 | namespace EAM_NS{
76      void add( atomStruct &info, double *the_eam_rvals,
77                double *the_eam_rhovals,double *the_eam_Frhovals ){
78  
79      int i;
80
79        // check for duplicates
80        
81        if( !strcmp( info.name, name ) ){
# Line 164 | Line 162 | EAM_FF::EAM_FF(){
162    char* ffPath_env = "FORCE_PARAM_PATH";
163    char* ffPath;
164    char temp[200];
167  char errMsg[1000];
165  
166    headAtomType = NULL;
167    currentAtomType = NULL;
168  
169 +  // Set eamRcut to 0.0
170 +  eamRcut = 0.0;
171 +
172    // do the funtion wrapping
173    wrapMeFF( this );
174  
# Line 179 | Line 179 | EAM_FF::EAM_FF(){
179    // Init the atomStruct mpi type
180  
181    atomStruct atomProto; // mpiPrototype
182 <  int atomBC[3] = {15,4,6};  // block counts
182 >  int atomBC[3] = {15,5,5};  // block counts
183    MPI_Aint atomDspls[3];           // displacements
184    MPI_Datatype atomMbrTypes[3];    // member mpi types
185  
# Line 266 | Line 266 | void EAM_FF::calcRcut( void ){
266  
267  
268   void EAM_FF::calcRcut( void ){
269 <  double tempEamRcut;
270 <
269 >  
270 >  #ifdef IS_MPI
271 >  double tempEamRcut = eamRcut;
272 >  MPI_Allreduce( &tempEamRcut, &eamRcut, 1, MPI_DOUBLE, MPI_MAX,
273 >                 MPI_COMM_WORLD);
274 > #endif  //is_mpi
275    entry_plug->setRcut(eamRcut);
276   }
277  
# Line 298 | Line 302 | void EAM_FF::readParams( void ){
302    info.last = 1; // initialize last to have the last set.
303                   // if things go well, last will be set to 0
304  
301  int i;
305    int identNum;
306    double *eam_rvals;    // Z of r values
307    double *eam_rhovals;  // rho of r values
# Line 478 | Line 481 | void EAM_FF::readParams( void ){
481    }
482        
483    entry_plug->useLJ = 0;
484 <
484 >  entry_plug->useEAM = 1;
485    // Walk down again and send out EAM type
486    currentAtomType = headAtomType->next;
487    while( currentAtomType != NULL ){
488      
489      if( currentAtomType->name[0] != '\0' ){
490        isError = 0;
491 <      cerr << "Calling newEAMtype for type "<<currentAtomType->eam_ident <<"\n";
491 >
492        newEAMtype( &(currentAtomType->lattice_constant),
493                    &(currentAtomType->eam_nrho),
494                    &(currentAtomType->eam_drho),
# Line 497 | Line 500 | void EAM_FF::readParams( void ){
500                    currentAtomType->eam_Frhovals,
501                    &(currentAtomType->eam_ident),
502                    &isError);
503 <      cerr << "Returned from newEAMtype\n";
503 >
504        if( isError ){
505          sprintf( painCave.errMsg,
506                   "Error initializing the \"%s\" atom type in fortran EAM\n",
# Line 517 | Line 520 | void EAM_FF::readParams( void ){
520    MPIcheckPoint();
521   #endif // is_mpi
522  
520  cerr << "Done sending eamtypes to fortran\n";
523  
524 +
525   }
526  
527  
528   void EAM_FF::initializeAtoms( int nAtoms, Atom** the_atoms ){
529    
530    int i;
531 <
531 >  
532    // initialize the atoms
533    
531
532  Atom* thisAtom;
533
534    for( i=0; i<nAtoms; i++ ){
535      
536      currentAtomType = headAtomType->find( the_atoms[i]->getType() );
# Line 545 | Line 545 | void EAM_FF::initializeAtoms( int nAtoms, Atom** the_a
545      the_atoms[i]->setMass( currentAtomType->mass );
546      the_atoms[i]->setIdent( currentAtomType->ident );
547      the_atoms[i]->setEAM();
548 +    the_atoms[i]->setEamRcut( currentAtomType->eam_rcut);
549 +
550 +    if (eamRcut < currentAtomType->eam_rcut) eamRcut = currentAtomType->eam_rcut;
551  
552    }
553   }
# Line 1013 | Line 1016 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
1016      myEam_rhovals[j+0] = atof( the_token );
1017  
1018      // Value 2
1019 <    if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){
1019 >    if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
1020        sprintf( painCave.errMsg,
1021                 "Error parseing EAM nrho: line in %s\n", eamPotFile );
1022        painCave.isFatal = 1;
# Line 1023 | Line 1026 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
1026      myEam_rhovals[j+1] = atof( the_token );
1027  
1028      // Value 3
1029 <    if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){
1029 >    if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
1030        sprintf( painCave.errMsg,
1031                 "Error parseing EAM nrho: line in %s\n", eamPotFile );
1032        painCave.isFatal = 1;
# Line 1033 | Line 1036 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
1036      myEam_rhovals[j+2] = atof( the_token );
1037  
1038      // Value 4
1039 <    if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){
1039 >    if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
1040        sprintf( painCave.errMsg,
1041                 "Error parseing EAM nrho: line in %s\n", eamPotFile );
1042        painCave.isFatal = 1;
# Line 1043 | Line 1046 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
1046      myEam_rhovals[j+3] = atof( the_token );
1047  
1048      // Value 5
1049 <    if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){
1049 >    if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
1050        sprintf( painCave.errMsg,
1051                 "Error parseing EAM nrho: line in %s\n", eamPotFile );
1052        painCave.isFatal = 1;
# Line 1051 | Line 1054 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
1054      }
1055    
1056      myEam_rhovals[j+4] = atof( the_token );
1057 <
1057 >
1058    }
1059    *eam_rvals = myEam_rvals;
1060    *eam_rhovals = myEam_rhovals;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines