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 631 by chuckv, Thu Jul 17 19:25:51 2003 UTC vs.
Revision 657 by chuckv, Wed Jul 30 21:17:01 2003 UTC

# Line 262 | Line 262 | EAM_FF::~EAM_FF(){
262   #ifdef IS_MPI
263    }
264   #endif // is_mpi
265 + }
266 +
267 +
268 + void EAM_FF::calcRcut( void ){
269 +  double tempEamRcut;
270 +
271 +  entry_plug->setRcut(eamRcut);
272   }
273  
274 +
275   void EAM_FF::initForceField( int ljMixRule ){
268  
276    initFortran( ljMixRule, 0 );
277   }
278  
# Line 284 | Line 291 | void EAM_FF::readParams( void ){
291   #endif // is_mpi
292   }
293  
294 +
295   void EAM_FF::readParams( void ){
296  
297    atomStruct info;
# Line 477 | Line 485 | void EAM_FF::readParams( void ){
485      
486      if( currentAtomType->name[0] != '\0' ){
487        isError = 0;
488 +      cerr << "Calling newEAMtype for type "<<currentAtomType->eam_ident <<"\n";
489        newEAMtype( &(currentAtomType->lattice_constant),
490                    &(currentAtomType->eam_nrho),
491                    &(currentAtomType->eam_drho),
# Line 488 | Line 497 | void EAM_FF::readParams( void ){
497                    currentAtomType->eam_Frhovals,
498                    &(currentAtomType->eam_ident),
499                    &isError);
500 +      cerr << "Returned from newEAMtype\n";
501        if( isError ){
502          sprintf( painCave.errMsg,
503                   "Error initializing the \"%s\" atom type in fortran EAM\n",
# Line 507 | Line 517 | void EAM_FF::readParams( void ){
517    MPIcheckPoint();
518   #endif // is_mpi
519  
520 +  cerr << "Done sending eamtypes to fortran\n";
521 +
522   }
523  
524  
# Line 661 | Line 673 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
673                       double **eam_rvals,
674                       double **eam_rhovals,
675                       double **eam_Frhovals){
676 <  
676 >  double* myEam_rvals;
677 >  double* myEam_rhovals;
678 >  double* myEam_Frhovals;
679 >
680    char* ffPath_env = "FORCE_PARAM_PATH";
681    char* ffPath;
682    char* the_token;
683    char* eam_eof_test;
684    FILE *eamFile;
685 <  const int BUFFERSIZE = 2000;
685 >  const int BUFFERSIZE = 3000;
686  
687    char temp[200];
688    int linenumber;
689    int nReadLines;
690    char eam_read_buffer[BUFFERSIZE];
691  
692 +
693    int i,j;
694  
695    linenumber = 0;
# Line 814 | Line 830 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
830    info.eam_rcut = atof( the_token);
831  
832  
833 +
834 +
835 +
836    // Ok now we have to allocate point arrays and read in number of points
837    // Index the arrays for fortran, starting at 1
838 <  *eam_Frhovals = new double[info.eam_nrho];
839 <  *eam_rvals    = new double[info.eam_nr];
840 <  *eam_rhovals  = new double[info.eam_nr];
838 >  myEam_Frhovals = new double[info.eam_nrho];
839 >  myEam_rvals    = new double[info.eam_nr];
840 >  myEam_rhovals  = new double[info.eam_nr];
841  
842    // Parse F of rho vals.
843  
844    // Assume for now that we have a complete number of lines
845    nReadLines = int(info.eam_nrho/5);
846 +  
847  
848 +
849    for (i=0;i<nReadLines;i++){
850      j = i*5;
851 <    
851 >
852      // Read next line
853      eam_eof_test = fgets(eam_read_buffer, sizeof(eam_read_buffer),eamFile);
854      linenumber++;
# Line 847 | Line 868 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
868        painCave.isFatal = 1;
869        simError();
870      }
871 <    
872 <    *eam_Frhovals[j+0] = atof( the_token );
871 >
872 >    myEam_Frhovals[j+0] = atof( the_token );
873      
874      // Value 2
875      if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
# Line 857 | Line 878 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
878        painCave.isFatal = 1;
879        simError();
880      }
881 <  
882 <    *eam_Frhovals[j+1] = atof( the_token );
881 >
882 >    myEam_Frhovals[j+1] = atof( the_token );
883      
884      // Value 3
885      if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
# Line 867 | Line 888 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
888        painCave.isFatal = 1;
889        simError();
890      }
891 +
892 +    myEam_Frhovals[j+2] = atof( the_token );
893      
871    *eam_Frhovals[j+2] = atof( the_token );
872    
894      // Value 4
895      if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
896        sprintf( painCave.errMsg,
# Line 877 | Line 898 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
898        painCave.isFatal = 1;
899        simError();
900      }
880    
881    *eam_Frhovals[j+3] = atof( the_token );
901  
902 +    myEam_Frhovals[j+3] = atof( the_token );
903 +
904      // Value 5
905      if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
906        sprintf( painCave.errMsg,
# Line 887 | Line 908 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
908        painCave.isFatal = 1;
909        simError();
910      }
911 +
912 +    myEam_Frhovals[j+4] = atof( the_token );
913      
891    *eam_Frhovals[j+4] = atof( the_token );
892    
914    }
915    // Parse Z of r vals
916    
# Line 919 | Line 940 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
940        simError();
941      }
942      
943 <    *eam_rvals[j+0] = atof( the_token );
943 >    myEam_rvals[j+0] = atof( the_token );
944  
945      // Value 2
946      if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
# Line 929 | Line 950 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
950        simError();
951      }
952    
953 <    *eam_rvals[j+1] = atof( the_token );
953 >    myEam_rvals[j+1] = atof( the_token );
954  
955      // Value 3
956      if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
# Line 939 | Line 960 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
960        simError();
961      }
962    
963 <    *eam_rvals[j+2] = atof( the_token );
963 >    myEam_rvals[j+2] = atof( the_token );
964  
965      // Value 4
966      if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
# Line 949 | Line 970 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
970        simError();
971      }
972    
973 <    *eam_rvals[j+3] = atof( the_token );
973 >    myEam_rvals[j+3] = atof( the_token );
974  
975      // Value 5
976      if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){
# Line 959 | Line 980 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
980        simError();
981      }
982    
983 <    *eam_rvals[j+4] = atof( the_token );
983 >    myEam_rvals[j+4] = atof( the_token );
984  
985    }
986    // Parse rho of r vals
# Line 989 | Line 1010 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
1010        simError();
1011      }
1012    
1013 <    *eam_rhovals[j+0] = atof( the_token );
1013 >    myEam_rhovals[j+0] = atof( the_token );
1014  
1015      // Value 2
1016      if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){
# Line 999 | Line 1020 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
1020        simError();
1021      }
1022    
1023 <    *eam_rhovals[j+1] = atof( the_token );
1023 >    myEam_rhovals[j+1] = atof( the_token );
1024  
1025      // Value 3
1026      if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){
# Line 1009 | Line 1030 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
1030        simError();
1031      }
1032    
1033 <    *eam_rhovals[j+2] = atof( the_token );
1033 >    myEam_rhovals[j+2] = atof( the_token );
1034  
1035      // Value 4
1036      if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){
# Line 1019 | Line 1040 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
1040        simError();
1041      }
1042    
1043 <    *eam_rhovals[j+3] = atof( the_token );
1043 >    myEam_rhovals[j+3] = atof( the_token );
1044  
1045      // Value 5
1046      if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){
# Line 1029 | Line 1050 | int EAM_NS::parseEAM(atomStruct &info, char *eamPotFil
1050        simError();
1051      }
1052    
1053 <    *eam_rhovals[j+4] = atof( the_token );
1053 >    myEam_rhovals[j+4] = atof( the_token );
1054  
1055    }
1056 +  *eam_rvals = myEam_rvals;
1057 +  *eam_rhovals = myEam_rhovals;
1058 +  *eam_Frhovals = myEam_Frhovals;
1059  
1060    fclose(eamFile);
1061    return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines