parse image flags only for valid numbers and requize imz == 0 for 2d-systems

This commit is contained in:
Axel Kohlmeyer 2020-03-17 16:43:34 -04:00
parent 6f6855e831
commit a7d2847140
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
1 changed files with 13 additions and 6 deletions

View File

@ -973,12 +973,19 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
error->all(FLERR,"Incorrect atom format in data file");
}
if (imageflag)
imagedata = ((imageint) (atoi(values[iptr]) + IMGMAX) & IMGMASK) |
(((imageint) (atoi(values[iptr+1]) + IMGMAX) & IMGMASK) << IMGBITS) |
(((imageint) (atoi(values[iptr+2]) + IMGMAX) & IMGMASK) << IMG2BITS);
else imagedata = ((imageint) IMGMAX << IMG2BITS) |
((imageint) IMGMAX << IMGBITS) | IMGMAX;
int imx = 0;
int imy = 0;
int imz = 0;
if (imageflag) {
imx = utils::inumeric(FLERR,values[iptr],true,lmp);
imy = utils::inumeric(FLERR,values[iptr+1],true,lmp);
imz = utils::inumeric(FLERR,values[iptr+2],true,lmp);
if ((domain->dimension == 2) && (imz != 0))
error->one(FLERR,"Z-direction image flag must be 0 for 2d-systems");
}
imagedata = ((imageint) (imx + IMGMAX) & IMGMASK) |
(((imageint) (imy + IMGMAX) & IMGMASK) << IMGBITS) |
(((imageint) (imz + IMGMAX) & IMGMASK) << IMG2BITS);
xdata[0] = atof(values[xptr]);
xdata[1] = atof(values[xptr+1]);