1 |
< |
#include <cstdlib> |
2 |
< |
#include <cstdio> |
3 |
< |
#include <cstring> |
1 |
> |
#include <stdlib.h> |
2 |
> |
#include <stdio.h> |
3 |
> |
#include <string.h> |
4 |
|
|
5 |
|
#include <iostream> |
6 |
|
using namespace std; |
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 |
– |
int eam_rcut; // The cutoff radius for eam. |
37 |
|
int eam_ident; // Atomic number |
38 |
|
int ident; |
39 |
|
int last; // 0 -> default |
41 |
|
} atomStruct; |
42 |
|
|
43 |
|
int parseAtom( char *lineBuffer, int lineNum, atomStruct &info, char *eamPotFile ); |
44 |
< |
int parseEAM( atomStruct &info, char *eamPotFile ); |
44 |
> |
int parseEAM( atomStruct &info, char *eamPotFile, double **eam_rvals, |
45 |
> |
double **eam_rhovals, double **eam_Frhovals); |
46 |
|
#ifdef IS_MPI |
47 |
|
|
48 |
|
MPI_Datatype mpiAtomStructType; |
76 |
|
void add( atomStruct &info, double *the_eam_rvals, |
77 |
|
double *the_eam_rhovals,double *the_eam_Frhovals ){ |
78 |
|
|
78 |
– |
int i; |
79 |
– |
|
79 |
|
// check for duplicates |
80 |
|
|
81 |
|
if( !strcmp( info.name, name ) ){ |
134 |
|
double eam_drho; // The distance between each of the points indexed by rho. |
135 |
|
int eam_nr; // The number of points based on r (Both Phi(r) and Rho(r)). |
136 |
|
double eam_dr; // The distance between each of the rho points. |
137 |
< |
int eam_rcut; // The cutoff radius for eam. |
137 |
> |
double eam_rcut; // The cutoff radius for eam. |
138 |
|
|
139 |
|
double *eam_rvals; // Z of r values |
140 |
|
double *eam_rhovals; // rho of r values |
149 |
|
|
150 |
|
} |
151 |
|
|
152 |
< |
using namespace LJ_NS; |
152 |
> |
using namespace EAM_NS; |
153 |
|
|
154 |
|
//**************************************************************** |
155 |
|
// begins the actual forcefield stuff. |
162 |
|
char* ffPath_env = "FORCE_PARAM_PATH"; |
163 |
|
char* ffPath; |
164 |
|
char temp[200]; |
166 |
– |
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 |
|
|
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 |
|
|
228 |
|
frcFile = fopen( fileName, "r" ); |
229 |
|
|
230 |
|
if( frcFile == NULL ){ |
231 |
< |
|
231 |
> |
|
232 |
|
sprintf( painCave.errMsg, |
233 |
< |
"Error opening the force field parameter file: %s\n" |
234 |
< |
"Have you tried setting the FORCE_PARAM_PATH environment " |
235 |
< |
"vairable?\n", |
233 |
> |
"Error opening the force field parameter file:\n" |
234 |
> |
"\t%s\n" |
235 |
> |
"\tHave you tried setting the FORCE_PARAM_PATH environment " |
236 |
> |
"variable?\n", |
237 |
|
fileName ); |
238 |
+ |
painCave.severity = OOPSE_ERROR; |
239 |
|
painCave.isFatal = 1; |
240 |
|
simError(); |
241 |
|
} |
266 |
|
#endif // is_mpi |
267 |
|
} |
268 |
|
|
269 |
< |
void EAM_FF::initForceField( int ljMixRule ){ |
269 |
> |
|
270 |
> |
void EAM_FF::calcRcut( void ){ |
271 |
|
|
272 |
+ |
#ifdef IS_MPI |
273 |
+ |
double tempEamRcut = eamRcut; |
274 |
+ |
MPI_Allreduce( &tempEamRcut, &eamRcut, 1, MPI_DOUBLE, MPI_MAX, |
275 |
+ |
MPI_COMM_WORLD); |
276 |
+ |
#endif //is_mpi |
277 |
+ |
entry_plug->setDefaultRcut(eamRcut); |
278 |
+ |
} |
279 |
+ |
|
280 |
+ |
|
281 |
+ |
void EAM_FF::initForceField( int ljMixRule ){ |
282 |
|
initFortran( ljMixRule, 0 ); |
283 |
|
} |
284 |
|
|
297 |
|
#endif // is_mpi |
298 |
|
} |
299 |
|
|
300 |
+ |
|
301 |
|
void EAM_FF::readParams( void ){ |
302 |
|
|
303 |
|
atomStruct info; |
304 |
|
info.last = 1; // initialize last to have the last set. |
305 |
|
// if things go well, last will be set to 0 |
306 |
|
|
292 |
– |
int i; |
307 |
|
int identNum; |
308 |
|
double *eam_rvals; // Z of r values |
309 |
|
double *eam_rhovals; // rho of r values |
349 |
|
// the parser returns 0 if the line was blank |
350 |
|
if( parseAtom( readLine, lineNum, info, eamPotFile ) ){ |
351 |
|
parseEAM(info,eamPotFile, &eam_rvals, |
352 |
< |
&eam_rhovals, &eam_Frhovals)){ |
352 |
> |
&eam_rhovals, &eam_Frhovals); |
353 |
|
info.ident = identNum; |
354 |
|
headAtomType->add( info, eam_rvals, |
355 |
|
eam_rhovals,eam_Frhovals ); |
409 |
|
MPIcheckPoint(); |
410 |
|
|
411 |
|
headAtomType = new LinkedAtomType; |
412 |
< |
recieveFrcStruct( &info, mpiAtomStructType ); |
412 |
> |
receiveFrcStruct( &info, mpiAtomStructType ); |
413 |
|
|
414 |
|
while( !info.last ){ |
415 |
|
|
435 |
|
|
436 |
|
MPIcheckPoint(); |
437 |
|
|
438 |
< |
recieveFrcStruct( &info, mpiAtomStructType ); |
438 |
> |
receiveFrcStruct( &info, mpiAtomStructType ); |
439 |
|
|
440 |
|
|
441 |
|
} |
451 |
|
int isDipole = 0; |
452 |
|
int isSSD = 0; |
453 |
|
int isGB = 0; |
454 |
< |
int isEam = 1; |
454 |
> |
int isEAM = 1; |
455 |
> |
int isCharge = 0; |
456 |
|
double dipole = 0.0; |
457 |
+ |
double charge = 0.0; |
458 |
+ |
double eamSigma = 0.0; |
459 |
+ |
double eamEpslon = 0.0; |
460 |
|
|
461 |
|
currentAtomType = headAtomType->next; |
462 |
|
while( currentAtomType != NULL ){ |
469 |
|
&isDipole, |
470 |
|
&isGB, |
471 |
|
&isEAM, |
472 |
< |
&(currentAtomType->epslon), |
473 |
< |
&(currentAtomType->sigma), |
472 |
> |
&isCharge, |
473 |
> |
&eamEpslon, |
474 |
> |
&eamSigma, |
475 |
> |
&charge, |
476 |
|
&dipole, |
477 |
|
&isError ); |
478 |
|
if( isError ){ |
487 |
|
} |
488 |
|
|
489 |
|
entry_plug->useLJ = 0; |
490 |
< |
|
490 |
> |
entry_plug->useEAM = 1; |
491 |
|
// Walk down again and send out EAM type |
492 |
|
currentAtomType = headAtomType->next; |
493 |
|
while( currentAtomType != NULL ){ |
494 |
|
|
495 |
|
if( currentAtomType->name[0] != '\0' ){ |
496 |
|
isError = 0; |
497 |
+ |
|
498 |
|
newEAMtype( &(currentAtomType->lattice_constant), |
499 |
|
&(currentAtomType->eam_nrho), |
500 |
|
&(currentAtomType->eam_drho), |
501 |
|
&(currentAtomType->eam_nr), |
502 |
|
&(currentAtomType->eam_dr), |
503 |
+ |
&(currentAtomType->eam_rcut), |
504 |
|
currentAtomType->eam_rvals, |
505 |
|
currentAtomType->eam_rhovals, |
506 |
|
currentAtomType->eam_Frhovals, |
507 |
|
&(currentAtomType->eam_ident), |
508 |
|
&isError); |
509 |
+ |
|
510 |
|
if( isError ){ |
511 |
|
sprintf( painCave.errMsg, |
512 |
|
"Error initializing the \"%s\" atom type in fortran EAM\n", |
526 |
|
MPIcheckPoint(); |
527 |
|
#endif // is_mpi |
528 |
|
|
529 |
+ |
|
530 |
+ |
|
531 |
|
} |
532 |
|
|
533 |
|
|
534 |
|
void EAM_FF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
535 |
|
|
536 |
|
int i; |
537 |
< |
|
537 |
> |
|
538 |
|
// initialize the atoms |
539 |
|
|
515 |
– |
|
516 |
– |
Atom* thisAtom; |
517 |
– |
|
540 |
|
for( i=0; i<nAtoms; i++ ){ |
541 |
|
|
542 |
|
currentAtomType = headAtomType->find( the_atoms[i]->getType() ); |
550 |
|
|
551 |
|
the_atoms[i]->setMass( currentAtomType->mass ); |
552 |
|
the_atoms[i]->setIdent( currentAtomType->ident ); |
531 |
– |
the_atoms[i]->setEAM(); |
553 |
|
|
554 |
+ |
if (eamRcut < currentAtomType->eam_rcut) eamRcut = currentAtomType->eam_rcut; |
555 |
+ |
|
556 |
|
} |
557 |
|
} |
558 |
|
|
559 |
< |
void LJ_FF::initializeBonds( int nBonds, Bond** BondArray, |
559 |
> |
void EAM_FF::initializeBonds( int nBonds, Bond** BondArray, |
560 |
|
bond_pair* the_bonds ){ |
561 |
|
|
562 |
|
if( nBonds ){ |
680 |
|
double **eam_rvals, |
681 |
|
double **eam_rhovals, |
682 |
|
double **eam_Frhovals){ |
683 |
< |
|
683 |
> |
double* myEam_rvals; |
684 |
> |
double* myEam_rhovals; |
685 |
> |
double* myEam_Frhovals; |
686 |
> |
|
687 |
|
char* ffPath_env = "FORCE_PARAM_PATH"; |
688 |
|
char* ffPath; |
689 |
|
char* the_token; |
690 |
+ |
char* eam_eof_test; |
691 |
|
FILE *eamFile; |
692 |
+ |
const int BUFFERSIZE = 3000; |
693 |
+ |
|
694 |
|
char temp[200]; |
695 |
|
int linenumber; |
696 |
|
int nReadLines; |
697 |
+ |
char eam_read_buffer[BUFFERSIZE]; |
698 |
|
|
699 |
+ |
|
700 |
|
int i,j; |
701 |
|
|
702 |
|
linenumber = 0; |
705 |
|
eamFile = fopen( eamPotFile, "r" ); |
706 |
|
|
707 |
|
|
708 |
< |
if( frcFile == NULL ){ |
708 |
> |
if( eamFile == NULL ){ |
709 |
|
|
710 |
|
// next see if the force path enviorment variable is set |
711 |
|
|
724 |
|
|
725 |
|
|
726 |
|
|
727 |
< |
if( frcFile == NULL ){ |
727 |
> |
if( eamFile == NULL ){ |
728 |
|
|
729 |
|
sprintf( painCave.errMsg, |
730 |
|
"Error opening the EAM force parameter file: %s\n" |
731 |
|
"Have you tried setting the FORCE_PARAM_PATH environment " |
732 |
< |
"vairable?\n", |
732 |
> |
"variable?\n", |
733 |
|
eamPotFile ); |
734 |
|
painCave.isFatal = 1; |
735 |
|
simError(); |
737 |
|
} |
738 |
|
|
739 |
|
// First line is a comment line, read and toss it.... |
740 |
< |
eof_test = fgets(read_buffer, sizeof(read_buffer),eamFile); |
740 |
> |
eam_eof_test = fgets(eam_read_buffer, sizeof(eam_read_buffer),eamFile); |
741 |
|
linenumber++; |
742 |
< |
if(eof_test == NULL){ |
742 |
> |
if(eam_eof_test == NULL){ |
743 |
|
sprintf( painCave.errMsg, |
744 |
|
"error in reading commment in %s\n", eamPotFile); |
745 |
|
painCave.isFatal = 1; |
749 |
|
|
750 |
|
|
751 |
|
// The Second line contains atomic number, atomic mass and a lattice constant |
752 |
< |
eof_test = fgets(read_buffer, sizeof(read_buffer),eamFile); |
752 |
> |
eam_eof_test = fgets(eam_read_buffer, sizeof(eam_read_buffer),eamFile); |
753 |
|
linenumber++; |
754 |
< |
if(eof_test == NULL){ |
754 |
> |
if(eam_eof_test == NULL){ |
755 |
|
sprintf( painCave.errMsg, |
756 |
|
"error in reading Identifier line in %s\n", eamPotFile); |
757 |
|
painCave.isFatal = 1; |
761 |
|
|
762 |
|
|
763 |
|
|
764 |
< |
if ( (the_token = strtok( read_buffer, " \n\t,;")) == NULL){ |
764 |
> |
if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){ |
765 |
|
sprintf( painCave.errMsg, |
766 |
|
"Error parseing EAM ident line in %s\n", eamPotFile ); |
767 |
|
painCave.isFatal = 1; |
787 |
|
info.lattice_constant = atof( the_token); |
788 |
|
|
789 |
|
// Next line is nrho, drho, nr, dr and rcut |
790 |
< |
eof_test = fgets(read_buffer, sizeof(read_buffer),eamFile) |
791 |
< |
if(eof_test == NULL){ |
790 |
> |
eam_eof_test = fgets(eam_read_buffer, sizeof(eam_read_buffer),eamFile); |
791 |
> |
if(eam_eof_test == NULL){ |
792 |
|
sprintf( painCave.errMsg, |
793 |
|
"error in reading number of points line in %s\n", eamPotFile); |
794 |
|
painCave.isFatal = 1; |
795 |
|
simError(); |
796 |
|
} |
797 |
|
|
798 |
< |
if ( (the_token = strtok( read_buffer, " \n\t,;")) == NULL){ |
798 |
> |
if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){ |
799 |
|
sprintf( painCave.errMsg, |
800 |
|
"Error parseing EAM nrho: line in %s\n", eamPotFile ); |
801 |
|
painCave.isFatal = 1; |
837 |
|
info.eam_rcut = atof( the_token); |
838 |
|
|
839 |
|
|
840 |
+ |
|
841 |
+ |
|
842 |
+ |
|
843 |
|
// Ok now we have to allocate point arrays and read in number of points |
844 |
|
// Index the arrays for fortran, starting at 1 |
845 |
< |
*eam_Frhovals = new double[info.nrho]; |
846 |
< |
*eam_rvals = new double[info.nr]; |
847 |
< |
*eam_rhovals = new double[info.nr]; |
845 |
> |
myEam_Frhovals = new double[info.eam_nrho]; |
846 |
> |
myEam_rvals = new double[info.eam_nr]; |
847 |
> |
myEam_rhovals = new double[info.eam_nr]; |
848 |
|
|
849 |
|
// Parse F of rho vals. |
850 |
|
|
851 |
|
// Assume for now that we have a complete number of lines |
852 |
< |
nReadLines = int(info.nrho/5); |
852 |
> |
nReadLines = int(info.eam_nrho/5); |
853 |
> |
|
854 |
|
|
855 |
+ |
|
856 |
|
for (i=0;i<nReadLines;i++){ |
857 |
|
j = i*5; |
858 |
< |
|
858 |
> |
|
859 |
|
// Read next line |
860 |
< |
eof_test = fgets(read_buffer, sizeof(read_buffer),eamFile); |
860 |
> |
eam_eof_test = fgets(eam_read_buffer, sizeof(eam_read_buffer),eamFile); |
861 |
|
linenumber++; |
862 |
< |
if(eof_test == NULL){ |
862 |
> |
if(eam_eof_test == NULL){ |
863 |
|
sprintf( painCave.errMsg, |
864 |
|
"error in reading EAM file %s at line %d\n", |
865 |
|
eamPotFile,linenumber); |
869 |
|
|
870 |
|
// Parse 5 values on each line into array |
871 |
|
// Value 1 |
872 |
< |
if ( (the_token = strtok( read_buffer, " \n\t,;")) == NULL){ |
872 |
> |
if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){ |
873 |
|
sprintf( painCave.errMsg, |
874 |
|
"Error parseing EAM nrho: line in %s\n", eamPotFile ); |
875 |
|
painCave.isFatal = 1; |
876 |
|
simError(); |
877 |
|
} |
878 |
+ |
|
879 |
+ |
myEam_Frhovals[j+0] = atof( the_token ); |
880 |
|
|
843 |
– |
*eam_Frhovals[j+0] = atof( the_token ); |
844 |
– |
|
881 |
|
// Value 2 |
882 |
|
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
883 |
|
sprintf( painCave.errMsg, |
885 |
|
painCave.isFatal = 1; |
886 |
|
simError(); |
887 |
|
} |
888 |
< |
|
889 |
< |
*eam_Frhovals[j+1] = atof( the_token ); |
888 |
> |
|
889 |
> |
myEam_Frhovals[j+1] = atof( the_token ); |
890 |
|
|
891 |
|
// Value 3 |
892 |
|
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
895 |
|
painCave.isFatal = 1; |
896 |
|
simError(); |
897 |
|
} |
898 |
+ |
|
899 |
+ |
myEam_Frhovals[j+2] = atof( the_token ); |
900 |
|
|
863 |
– |
*eam_Frhovals[j+2] = atof( the_token ); |
864 |
– |
|
901 |
|
// Value 4 |
902 |
|
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
903 |
|
sprintf( painCave.errMsg, |
905 |
|
painCave.isFatal = 1; |
906 |
|
simError(); |
907 |
|
} |
872 |
– |
|
873 |
– |
*eam_Frhovals[j+3] = atof( the_token ); |
908 |
|
|
909 |
+ |
myEam_Frhovals[j+3] = atof( the_token ); |
910 |
+ |
|
911 |
|
// Value 5 |
912 |
|
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
913 |
|
sprintf( painCave.errMsg, |
915 |
|
painCave.isFatal = 1; |
916 |
|
simError(); |
917 |
|
} |
918 |
+ |
|
919 |
+ |
myEam_Frhovals[j+4] = atof( the_token ); |
920 |
|
|
883 |
– |
*eam_Frhovals[j+4] = atof( the_token ); |
884 |
– |
|
921 |
|
} |
922 |
|
// Parse Z of r vals |
923 |
|
|
924 |
|
// Assume for now that we have a complete number of lines |
925 |
< |
nReadLines = int(info.nr/5); |
925 |
> |
nReadLines = int(info.eam_nr/5); |
926 |
|
|
927 |
|
for (i=0;i<nReadLines;i++){ |
928 |
|
j = i*5; |
929 |
|
|
930 |
|
// Read next line |
931 |
< |
eof_test = fgets(read_buffer, sizeof(read_buffer),eamFile); |
931 |
> |
eam_eof_test = fgets(eam_read_buffer, sizeof(eam_read_buffer),eamFile); |
932 |
|
linenumber++; |
933 |
< |
if(eof_test == NULL){ |
933 |
> |
if(eam_eof_test == NULL){ |
934 |
|
sprintf( painCave.errMsg, |
935 |
|
"error in reading EAM file %s at line %d\n", |
936 |
|
eamPotFile,linenumber); |
940 |
|
|
941 |
|
// Parse 5 values on each line into array |
942 |
|
// Value 1 |
943 |
< |
if ( (the_token = strtok( read_buffer, " \n\t,;")) == NULL){ |
943 |
> |
if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){ |
944 |
|
sprintf( painCave.errMsg, |
945 |
|
"Error parseing EAM nrho: line in %s\n", eamPotFile ); |
946 |
|
painCave.isFatal = 1; |
947 |
|
simError(); |
948 |
|
} |
949 |
|
|
950 |
< |
*eam_rvals[j+0] = atof( the_token ); |
950 |
> |
myEam_rvals[j+0] = atof( the_token ); |
951 |
|
|
952 |
|
// Value 2 |
953 |
|
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
957 |
|
simError(); |
958 |
|
} |
959 |
|
|
960 |
< |
*eam_rvals[j+1] = atof( the_token ); |
960 |
> |
myEam_rvals[j+1] = atof( the_token ); |
961 |
|
|
962 |
|
// Value 3 |
963 |
|
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
967 |
|
simError(); |
968 |
|
} |
969 |
|
|
970 |
< |
*eam_rvals[j+2] = atof( the_token ); |
970 |
> |
myEam_rvals[j+2] = atof( the_token ); |
971 |
|
|
972 |
|
// Value 4 |
973 |
|
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
977 |
|
simError(); |
978 |
|
} |
979 |
|
|
980 |
< |
*eam_rvals[j+3] = atof( the_token ); |
980 |
> |
myEam_rvals[j+3] = atof( the_token ); |
981 |
|
|
982 |
|
// Value 5 |
983 |
|
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
987 |
|
simError(); |
988 |
|
} |
989 |
|
|
990 |
< |
*eam_rvals[j+4] = atof( the_token ); |
990 |
> |
myEam_rvals[j+4] = atof( the_token ); |
991 |
|
|
992 |
|
} |
993 |
|
// Parse rho of r vals |
998 |
|
j = i*5; |
999 |
|
|
1000 |
|
// Read next line |
1001 |
< |
eof_test = fgets(read_buffer, sizeof(read_buffer),eamFile); |
1001 |
> |
eam_eof_test = fgets(eam_read_buffer, sizeof(eam_read_buffer),eamFile); |
1002 |
|
linenumber++; |
1003 |
< |
if(eof_test == NULL){ |
1003 |
> |
if(eam_eof_test == NULL){ |
1004 |
|
sprintf( painCave.errMsg, |
1005 |
|
"error in reading EAM file %s at line %d\n", |
1006 |
|
eamPotFile,linenumber); |
1010 |
|
|
1011 |
|
// Parse 5 values on each line into array |
1012 |
|
// Value 1 |
1013 |
< |
if ( (the_token = strtok( read_buffer, " \n\t,;")) == NULL){ |
1013 |
> |
if ( (the_token = strtok( eam_read_buffer, " \n\t,;")) == NULL){ |
1014 |
|
sprintf( painCave.errMsg, |
1015 |
|
"Error parseing EAM nrho: line in %s\n", eamPotFile ); |
1016 |
|
painCave.isFatal = 1; |
1017 |
|
simError(); |
1018 |
|
} |
1019 |
|
|
1020 |
< |
*eam_rhovals[j+0] = atof( the_token ); |
1020 |
> |
myEam_rhovals[j+0] = atof( the_token ); |
1021 |
|
|
1022 |
|
// Value 2 |
1023 |
< |
if ( (the_token = strtok( read_buffer, " \n\t,;")) == NULL){ |
1023 |
> |
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
1024 |
|
sprintf( painCave.errMsg, |
1025 |
|
"Error parseing EAM nrho: line in %s\n", eamPotFile ); |
1026 |
|
painCave.isFatal = 1; |
1027 |
|
simError(); |
1028 |
|
} |
1029 |
|
|
1030 |
< |
*eam_rhovals[j+1] = atof( the_token ); |
1030 |
> |
myEam_rhovals[j+1] = atof( the_token ); |
1031 |
|
|
1032 |
|
// Value 3 |
1033 |
< |
if ( (the_token = strtok( read_buffer, " \n\t,;")) == NULL){ |
1033 |
> |
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
1034 |
|
sprintf( painCave.errMsg, |
1035 |
|
"Error parseing EAM nrho: line in %s\n", eamPotFile ); |
1036 |
|
painCave.isFatal = 1; |
1037 |
|
simError(); |
1038 |
|
} |
1039 |
|
|
1040 |
< |
*eam_rhovals[j+2] = atof( the_token ); |
1040 |
> |
myEam_rhovals[j+2] = atof( the_token ); |
1041 |
|
|
1042 |
|
// Value 4 |
1043 |
< |
if ( (the_token = strtok( read_buffer, " \n\t,;")) == NULL){ |
1043 |
> |
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
1044 |
|
sprintf( painCave.errMsg, |
1045 |
|
"Error parseing EAM nrho: line in %s\n", eamPotFile ); |
1046 |
|
painCave.isFatal = 1; |
1047 |
|
simError(); |
1048 |
|
} |
1049 |
|
|
1050 |
< |
*eam_rhovals[j+3] = atof( the_token ); |
1050 |
> |
myEam_rhovals[j+3] = atof( the_token ); |
1051 |
|
|
1052 |
|
// Value 5 |
1053 |
< |
if ( (the_token = strtok( read_buffer, " \n\t,;")) == NULL){ |
1053 |
> |
if ( (the_token = strtok( NULL, " \n\t,;")) == NULL){ |
1054 |
|
sprintf( painCave.errMsg, |
1055 |
|
"Error parseing EAM nrho: line in %s\n", eamPotFile ); |
1056 |
|
painCave.isFatal = 1; |
1057 |
|
simError(); |
1058 |
|
} |
1059 |
|
|
1060 |
< |
*eam_rhovals[j+4] = atof( the_token ); |
1061 |
< |
|
1060 |
> |
myEam_rhovals[j+4] = atof( the_token ); |
1061 |
> |
|
1062 |
|
} |
1063 |
+ |
*eam_rvals = myEam_rvals; |
1064 |
+ |
*eam_rhovals = myEam_rhovals; |
1065 |
+ |
*eam_Frhovals = myEam_Frhovals; |
1066 |
|
|
1067 |
|
fclose(eamFile); |
1068 |
|
return 0; |