diff --git a/src/atom.cpp b/src/atom.cpp index 805d3572be..c7067abc16 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -603,13 +603,12 @@ void Atom::data_atoms(int n, char *buf) } if (imageflag) - imagedata = - (((tagint) atoi(values[iptr+2]) + IMGMAX & IMGMASK) << IMG2BITS) | - (((tagint) atoi(values[iptr+1]) + IMGMAX & IMGMASK) << IMGBITS) | - (atoi(values[iptr]) + IMGMAX & IMGMASK); + imagedata = ((tagint) (atoi(values[iptr]) + IMGMAX) & IMGMASK) | + (((tagint) (atoi(values[iptr+1]) + IMGMAX) & IMGMASK) << IMGBITS) | + (((tagint) (atoi(values[iptr+2]) + IMGMAX) & IMGMASK) << IMG2BITS); else imagedata = ((tagint) IMGMAX << IMG2BITS) | ((tagint) IMGMAX << IMGBITS) | IMGMAX; - + xdata[0] = atof(values[xptr]); xdata[1] = atof(values[xptr+1]); xdata[2] = atof(values[xptr+2]); diff --git a/src/domain.cpp b/src/domain.cpp index 488780b24d..c95553c6a1 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -1147,9 +1147,9 @@ void Domain::image_flip(int m, int n, int p) ybox -= p*zbox; xbox -= m*ybox + n*zbox; - image[i] = ((zbox + (tagint) IMGMAX & IMGMASK) << IMG2BITS) | - ((ybox + (tagint) IMGMAX & IMGMASK) << IMGBITS) | - (xbox + IMGMAX & IMGMASK); + image[i] = ((tagint) (xbox + IMGMAX) & IMGMASK) | + (((tagint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + (((tagint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } } diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index e8af253f6a..22bed86e6a 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -200,7 +200,8 @@ void FixAdapt::init() Pair *pair = force->pair_match(ad->pstyle,1); if (pair == NULL) error->all(FLERR,"Fix adapt pair style does not exist"); void *ptr = pair->extract(ad->pparam,ad->pdim); - if (ptr == NULL) error->all(FLERR,"Fix adapt pair style param not supported"); + if (ptr == NULL) + error->all(FLERR,"Fix adapt pair style param not supported"); ad->pdim = 2; if (ad->pdim == 0) ad->scalar = (double *) ptr; diff --git a/src/pair_coul_cut.cpp b/src/pair_coul_cut.cpp index 4bca683b23..2e4313f788 100644 --- a/src/pair_coul_cut.cpp +++ b/src/pair_coul_cut.cpp @@ -166,7 +166,8 @@ void PairCoulCut::settings(int narg, char **arg) void PairCoulCut::coeff(int narg, char **arg) { - if (narg < 2 || narg > 3) error->all(FLERR,"Incorrect args for pair coefficients"); + if (narg < 2 || narg > 3) + error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); int ilo,ihi,jlo,jhi; diff --git a/src/read_dump.cpp b/src/read_dump.cpp index d047360f00..f1691ab443 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -729,8 +729,9 @@ void ReadDump::process_atoms(int n) // replace image flag in case changed by ix,iy,iz fields - image[m] = ((tagint) xbox << IMG2BITS) | - ((tagint) ybox << IMGBITS) | zbox; + image[m] = ((tagint) (xbox + IMGMAX) & IMGMASK) | + (((tagint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + (((tagint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } } @@ -786,9 +787,8 @@ void ReadDump::process_atoms(int n) m = atom->nlocal; // set atom attributes from other dump file fields - // xyzbox = IMGMAX is default value set by create_atom() - xbox = ybox = zbox = IMGMAX; + xbox = ybox = zbox = 0; for (ifield = 1; ifield < nfield; ifield++) { switch (fieldtype[ifield]) { @@ -814,8 +814,9 @@ void ReadDump::process_atoms(int n) // replace image flag in case changed by ix,iy,iz fields - image[m] = ((tagint) xbox << IMG2BITS) | - ((tagint) ybox << IMGBITS) | zbox; + image[m] = ((tagint) (xbox + IMGMAX) & IMGMASK) | + (((tagint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + (((tagint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } } diff --git a/src/set.cpp b/src/set.cpp index 5cd710081c..d7d6c69d88 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -496,9 +496,9 @@ void Set::set(int keyword) if (ximageflag) xbox = ximage; if (yimageflag) ybox = yimage; if (zimageflag) zbox = zimage; - atom->image[i] = ((zbox + (tagint) IMGMAX & IMGMASK) << IMG2BITS) | - ((ybox + (tagint) IMGMAX & IMGMASK) << IMGBITS) | - (xbox + IMGMAX & IMGMASK); + atom->image[i] = ((tagint) (xbox + IMGMAX) & IMGMASK) | + (((tagint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + (((tagint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); // set dipole moment