diff --git a/src/atom.cpp b/src/atom.cpp index 023d7a173f..519752dd91 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -755,7 +755,7 @@ int Atom::count_words(const char *line) void Atom::data_atoms(int n, char *buf) { int m,imagedata,xptr,iptr; - double xdata[3],lamda[3],sublo[3],subhi[3]; + double xdata[3],lamda[3]; double *coord; char *next; @@ -774,6 +774,16 @@ void Atom::data_atoms(int n, char *buf) // insures all data atoms will be owned even with round-off int triclinic = domain->triclinic; + + double epsilon[3]; + if (triclinic) epsilon[0] = epsilon[1] = epsilon[2] = EPSILON; + else { + epsilon[0] = domain->prd[0] * EPSILON; + epsilon[1] = domain->prd[1] * EPSILON; + epsilon[2] = domain->prd[2] * EPSILON; + } + + double sublo[3],subhi[3]; if (triclinic == 0) { sublo[0] = domain->sublo[0]; subhi[0] = domain->subhi[0]; sublo[1] = domain->sublo[1]; subhi[1] = domain->subhi[1]; @@ -785,16 +795,16 @@ void Atom::data_atoms(int n, char *buf) } if (domain->xperiodic) { - if (comm->myloc[0] == 0) sublo[0] -= EPSILON; - if (comm->myloc[0] == comm->procgrid[0]-1) subhi[0] += EPSILON; + if (comm->myloc[0] == 0) sublo[0] -= epsilon[0]; + if (comm->myloc[0] == comm->procgrid[0]-1) subhi[0] += epsilon[0]; } if (domain->yperiodic) { - if (comm->myloc[1] == 0) sublo[1] -= EPSILON; - if (comm->myloc[1] == comm->procgrid[1]-1) subhi[1] += EPSILON; + if (comm->myloc[1] == 0) sublo[1] -= epsilon[1]; + if (comm->myloc[1] == comm->procgrid[1]-1) subhi[1] += epsilon[1]; } if (domain->zperiodic) { - if (comm->myloc[2] == 0) sublo[2] -= EPSILON; - if (comm->myloc[2] == comm->procgrid[2]-1) subhi[2] += EPSILON; + if (comm->myloc[2] == 0) sublo[2] -= epsilon[2]; + if (comm->myloc[2] == comm->procgrid[2]-1) subhi[2] += epsilon[2]; } // xptr = which word in line starts xyz coords @@ -815,10 +825,12 @@ void Atom::data_atoms(int n, char *buf) next = strchr(buf,'\n'); values[0] = strtok(buf," \t\n\r\f"); - if (values[0] == NULL) error->all(FLERR,"Incorrect atom format in data file"); + if (values[0] == NULL) + error->all(FLERR,"Incorrect atom format in data file"); for (m = 1; m < nwords; m++) { values[m] = strtok(NULL," \t\n\r\f"); - if (values[m] == NULL) error->all(FLERR,"Incorrect atom format in data file"); + if (values[m] == NULL) + error->all(FLERR,"Incorrect atom format in data file"); } if (imageflag)