improve style mismatch warning messages in read_data
This commit is contained in:
@ -336,8 +336,8 @@ void ReadData::command(int narg, char **arg)
|
||||
error->all(FLERR, "Cannot run 2d simulation with nonperiodic Z dimension");
|
||||
if ((domain->nonperiodic == 2) && utils::strmatch(force->kspace_style, "^msm"))
|
||||
error->all(FLERR,
|
||||
"Reading a data file with shrinkwrap boundaries is "
|
||||
"not compatible with a MSM KSpace style");
|
||||
"Reading a data file with shrinkwrap boundaries is not "
|
||||
"compatible with a MSM KSpace style");
|
||||
if (domain->box_exist && !addflag)
|
||||
error->all(FLERR, "Cannot use read_data without add keyword after simulation box is defined");
|
||||
if (!domain->box_exist && addflag)
|
||||
@ -561,8 +561,8 @@ void ReadData::command(int narg, char **arg)
|
||||
// only done if firstpass and not first data file
|
||||
|
||||
if (firstpass && addflag != NONE) {
|
||||
double oldboxlo[3] = { domain->boxlo[0], domain->boxlo[1] , domain->boxlo[2]};
|
||||
double oldboxhi[3] = { domain->boxhi[0], domain->boxhi[1] , domain->boxhi[2]};
|
||||
double oldboxlo[3] = {domain->boxlo[0], domain->boxlo[1], domain->boxlo[2]};
|
||||
double oldboxhi[3] = {domain->boxhi[0], domain->boxhi[1], domain->boxhi[2]};
|
||||
domain->boxlo[0] = MIN(domain->boxlo[0], boxlo[0] + shift[0]);
|
||||
domain->boxhi[0] = MAX(domain->boxhi[0], boxhi[0] + shift[0]);
|
||||
domain->boxlo[1] = MIN(domain->boxlo[1], boxlo[1] + shift[1]);
|
||||
@ -575,7 +575,7 @@ void ReadData::command(int narg, char **arg)
|
||||
(oldboxlo[2] != domain->boxlo[2]) || (oldboxhi[0] != domain->boxhi[0]) ||
|
||||
(oldboxhi[1] != domain->boxhi[1]) || (oldboxhi[2] != domain->boxhi[2])) {
|
||||
int iflag = 1;
|
||||
for (int i=0; i < atom->nlocal; ++i) {
|
||||
for (int i = 0; i < atom->nlocal; ++i) {
|
||||
int xbox = (atom->image[i] & IMGMASK) - IMGMAX;
|
||||
int ybox = (atom->image[i] >> IMGBITS & IMGMASK) - IMGMAX;
|
||||
int zbox = (atom->image[i] >> IMG2BITS) - IMGMAX;
|
||||
@ -584,9 +584,9 @@ void ReadData::command(int narg, char **arg)
|
||||
if (zbox != 0) iflag = 1;
|
||||
}
|
||||
int flag_all;
|
||||
MPI_Allreduce(&iflag,&flag_all, 1, MPI_INT, MPI_SUM, world);
|
||||
MPI_Allreduce(&iflag, &flag_all, 1, MPI_INT, MPI_SUM, world);
|
||||
if ((flag_all > 0) && (comm->me == 0))
|
||||
error->warning(FLERR,"Non-zero image flags with growing box leads to bad coordinates");
|
||||
error->warning(FLERR, "Non-zero image flags with growing box leads to bad coordinates");
|
||||
}
|
||||
|
||||
// NOTE: not sure what to do about tilt value in subsequent data files
|
||||
@ -617,8 +617,9 @@ void ReadData::command(int narg, char **arg)
|
||||
atomflag = 1;
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style, atom->atom_style))
|
||||
error->warning(FLERR,
|
||||
"Atom style in data file differs from currently defined atom style");
|
||||
error->warning(
|
||||
FLERR, "Atom style in data file {} differs from currently defined atom style {}",
|
||||
style, atom->atom_style);
|
||||
atoms();
|
||||
} else
|
||||
skip_lines(natoms);
|
||||
@ -696,8 +697,9 @@ void ReadData::command(int narg, char **arg)
|
||||
if (force->pair == nullptr) error->all(FLERR, "Must define pair_style before Pair Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style, force->pair_style))
|
||||
error->warning(FLERR,
|
||||
"Pair style in data file differs from currently defined pair style");
|
||||
error->warning(
|
||||
FLERR, "Pair style {} in data file differs from currently defined pair style {}",
|
||||
style, force->pair_style);
|
||||
paircoeffs();
|
||||
} else
|
||||
skip_lines(ntypes);
|
||||
@ -706,9 +708,9 @@ void ReadData::command(int narg, char **arg)
|
||||
error->all(FLERR, "Must define pair_style before PairIJ Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style, force->pair_style))
|
||||
error->warning(FLERR,
|
||||
"Pair style in data file differs "
|
||||
"from currently defined pair style");
|
||||
error->warning(
|
||||
FLERR, "Pair style {} in data file differs from currently defined pair style {}",
|
||||
style, force->pair_style);
|
||||
pairIJcoeffs();
|
||||
} else
|
||||
skip_lines(ntypes * (ntypes + 1) / 2);
|
||||
@ -718,8 +720,9 @@ void ReadData::command(int narg, char **arg)
|
||||
if (force->bond == nullptr) error->all(FLERR, "Must define bond_style before Bond Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style, force->bond_style))
|
||||
error->warning(FLERR,
|
||||
"Bond style in data file differs from currently defined bond style");
|
||||
error->warning(
|
||||
FLERR, "Bond style {} in data file differs from currently defined bond style {}",
|
||||
style, force->bond_style);
|
||||
bondcoeffs();
|
||||
} else
|
||||
skip_lines(nbondtypes);
|
||||
@ -730,8 +733,9 @@ void ReadData::command(int narg, char **arg)
|
||||
error->all(FLERR, "Must define angle_style before Angle Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style, force->angle_style))
|
||||
error->warning(FLERR,
|
||||
"Angle style in data file differs from currently defined angle style");
|
||||
error->warning(
|
||||
FLERR, "Angle style {} in data file differs from currently defined angle style {}",
|
||||
style, force->angle_style);
|
||||
anglecoeffs(0);
|
||||
} else
|
||||
skip_lines(nangletypes);
|
||||
@ -742,9 +746,10 @@ void ReadData::command(int narg, char **arg)
|
||||
error->all(FLERR, "Must define dihedral_style before Dihedral Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style, force->dihedral_style))
|
||||
error->warning(FLERR,
|
||||
"Dihedral style in data file differs "
|
||||
"from currently defined dihedral style");
|
||||
error->warning(
|
||||
FLERR,
|
||||
"Dihedral style {} in data file differs from currently defined dihedral style {}",
|
||||
style, force->dihedral_style);
|
||||
dihedralcoeffs(0);
|
||||
} else
|
||||
skip_lines(ndihedraltypes);
|
||||
@ -755,9 +760,10 @@ void ReadData::command(int narg, char **arg)
|
||||
error->all(FLERR, "Must define improper_style before Improper Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style, force->improper_style))
|
||||
error->warning(FLERR,
|
||||
"Improper style in data file differs "
|
||||
"from currently defined improper style");
|
||||
error->warning(
|
||||
FLERR,
|
||||
"Improper style {} in data file differs from currently defined improper style {}",
|
||||
style, force->improper_style);
|
||||
impropercoeffs(0);
|
||||
} else
|
||||
skip_lines(nimpropertypes);
|
||||
@ -2018,8 +2024,10 @@ void ReadData::pairIJcoeffs()
|
||||
*next = '\0';
|
||||
parse_coeffs(buf, nullptr, 0, 2, toffset, tlabelflag, lmap->lmap2lmap.atom);
|
||||
if (ncoeffarg == 0)
|
||||
error->all(FLERR, "Unexpected empty line in PairIJCoeffs section. "
|
||||
"Expected {} lines.", (ntypes-1)*ntypes);
|
||||
error->all(FLERR,
|
||||
"Unexpected empty line in PairIJCoeffs section. "
|
||||
"Expected {} lines.",
|
||||
(ntypes - 1) * ntypes);
|
||||
force->pair->coeff(ncoeffarg, coeffarg);
|
||||
buf = next + 1;
|
||||
}
|
||||
@ -2049,7 +2057,8 @@ void ReadData::bondcoeffs()
|
||||
*next = '\0';
|
||||
parse_coeffs(buf, nullptr, 0, 1, boffset, blabelflag, lmap->lmap2lmap.bond);
|
||||
if (ncoeffarg == 0)
|
||||
error->all(FLERR, "Unexpected empty line in BondCoeffs section. Expected {} lines.", nbondtypes);
|
||||
error->all(FLERR, "Unexpected empty line in BondCoeffs section. Expected {} lines.",
|
||||
nbondtypes);
|
||||
force->bond->coeff(ncoeffarg, coeffarg);
|
||||
buf = next + 1;
|
||||
}
|
||||
@ -2442,12 +2451,12 @@ void ReadData::parse_coeffs(char *line, const char *addstr, int dupflag, int nof
|
||||
int value = utils::inumeric(FLERR, coeffarg[0], false, lmp);
|
||||
if (labelmode) value = ilabel[value - 1];
|
||||
argoffset1 = std::to_string(value + offset);
|
||||
coeffarg[0] = (char *)argoffset1.c_str();
|
||||
coeffarg[0] = (char *) argoffset1.c_str();
|
||||
if (noffset == 2) {
|
||||
value = utils::inumeric(FLERR, coeffarg[1], false, lmp);
|
||||
if (labelmode) value = ilabel[value - 1];
|
||||
argoffset2 = std::to_string(value + offset);
|
||||
coeffarg[1] = (char *)argoffset2.c_str();
|
||||
coeffarg[1] = (char *) argoffset2.c_str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user