From 8f3d0f743e698edf3106ad76659869415a93504c Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 22 Mar 2016 13:42:13 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14773 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/MANYBODY/pair_polymorphic.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index 5c3ffd6516..ad53789737 100755 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -614,16 +614,23 @@ void PairPolymorphic::read_file(char *file) fgets(line,MAXLINE,fp); n = strlen(line) + 1; } + + // Note: the format of this line has changed between the + // 2015-06-06 and 2015-12-09 versions of the pair style. + MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(line,n,MPI_CHAR,0,world); + nr = ng = nx = 0; ptr = strtok(line," \t\n\r\f"); // 1st token - nr = atoi(ptr); + if (ptr) nr = atoi(ptr); ptr = strtok(NULL," \t\n\r\f"); // 2nd token - ng = atoi(ptr); + if (ptr) ng = atoi(ptr); ptr = strtok(NULL," \t\n\r\f"); // 3rd token - nx = atoi(ptr); + if (ptr) nx = atoi(ptr); ptr = strtok(NULL," \t\n\r\f"); // 4th token - maxX = atof(ptr); + if (ptr) maxX = atof(ptr); + if (ptr == NULL) + error->all(FLERR,"Potential file incompatible with this pair style version"); npair = nelements*(nelements+1)/2; ntriple = nelements*nelements*nelements;