change check for reset image flags to print messages only once per data file

This commit is contained in:
Axel Kohlmeyer
2021-10-13 21:54:18 -04:00
parent afad3f42d5
commit f4851e9103
3 changed files with 28 additions and 21 deletions

View File

@ -312,6 +312,10 @@ void ReadData::command(int narg, char **arg)
error->all(FLERR,fmt::format("Cannot open file {}: {}",
arg[0], utils::getsyserror()));
// reset so we can warn about reset image flags exactly once per data file
atom->reset_image_flag[0] = atom->reset_image_flag[1] = atom->reset_image_flag[2] = false;
// first time system initialization
if (addflag == NONE) {
@ -1238,6 +1242,22 @@ void ReadData::atoms()
nread += nchunk;
}
// warn if we have read data with non-zero image flags for non-periodic boundaries.
// we may want to turn this into an error at some point, since this essentially
// creates invalid position information that works by accident most of the time.
if (comm->me == 0) {
if (atom->reset_image_flag[0])
error->warning(FLERR,"Non-zero imageflag(s) in x direction for "
"non-periodic boundary reset to zero");
if (atom->reset_image_flag[1])
error->warning(FLERR,"Non-zero imageflag(s) in y direction for "
"non-periodic boundary reset to zero");
if (atom->reset_image_flag[2])
error->warning(FLERR,"Non-zero imageflag(s) in z direction for "
"non-periodic boundary reset to zero");
}
// check that all atoms were assigned correctly
bigint n = atom->nlocal;