log labelmap reading from data file and improve error messages
This commit is contained in:
@ -1066,11 +1066,11 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
|
||||
break;
|
||||
}
|
||||
}
|
||||
*next = '\n';
|
||||
|
||||
if ((nwords != avec->size_data_atom) && (nwords != avec->size_data_atom + 3))
|
||||
error->all(FLERR,"Incorrect atom format in {}: {}", location, utils::trim(buf));
|
||||
error->all(FLERR,"Incorrect format in {}: {}", location, utils::trim(buf));
|
||||
|
||||
*next = '\n';
|
||||
// set bounds for my proc
|
||||
// if periodic and I am lo/hi proc, adjust bounds by EPSILON
|
||||
// insures all data atoms will be owned even with round-off
|
||||
@ -1149,7 +1149,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
|
||||
// skip over empty or comment lines
|
||||
} else if ((nvalues < nwords) ||
|
||||
((nvalues > nwords) && (!utils::strmatch(values[nwords],"^#")))) {
|
||||
error->all(FLERR, "Incorrect atom format in {}: {}", location, utils::trim(buf));
|
||||
error->all(FLERR, "Incorrect format in {}: {}", location, utils::trim(buf));
|
||||
} else {
|
||||
int imx = 0, imy = 0, imz = 0;
|
||||
if (imageflag) {
|
||||
|
||||
@ -108,46 +108,50 @@ void CreateBox::command(int narg, char **arg)
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg], "bond/types") == 0) {
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box bond/type", error);
|
||||
if (!atom->avec->bonds_allow) error->all(FLERR, "No bonds allowed with this atom style");
|
||||
if (!atom->avec->bonds_allow)
|
||||
error->all(FLERR, "No bonds allowed with atom style {}", atom->get_style());
|
||||
atom->nbondtypes = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "angle/types") == 0) {
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box angle/types", error);
|
||||
if (!atom->avec->angles_allow) error->all(FLERR, "No angles allowed with this atom style");
|
||||
if (!atom->avec->angles_allow)
|
||||
error->all(FLERR, "No angles allowed with atom style {}", atom->get_style());
|
||||
atom->nangletypes = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "dihedral/types") == 0) {
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box dihedral/types", error);
|
||||
if (!atom->avec->dihedrals_allow)
|
||||
error->all(FLERR, "No dihedrals allowed with this atom style");
|
||||
error->all(FLERR, "No dihedrals allowed with atom style {}", atom->get_style());
|
||||
atom->ndihedraltypes = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "improper/types") == 0) {
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box improper/types", error);
|
||||
if (!atom->avec->impropers_allow)
|
||||
error->all(FLERR, "No impropers allowed with this atom style");
|
||||
error->all(FLERR, "No impropers allowed with atom style {}", atom->get_style());
|
||||
atom->nimpropertypes = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "extra/bond/per/atom") == 0) {
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/bond/per/atom", error);
|
||||
if (!atom->avec->bonds_allow) error->all(FLERR, "No bonds allowed with this atom style");
|
||||
if (!atom->avec->bonds_allow)
|
||||
error->all(FLERR, "No bonds allowed with atom style {}", atom->get_style());
|
||||
atom->bond_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "extra/angle/per/atom") == 0) {
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/angle/per/atom", error);
|
||||
if (!atom->avec->angles_allow) error->all(FLERR, "No angles allowed with this atom style");
|
||||
if (!atom->avec->angles_allow)
|
||||
error->all(FLERR, "No angles allowed with atom style {}", atom->get_style());
|
||||
atom->angle_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "extra/dihedral/per/atom") == 0) {
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/dihedral/per/atom", error);
|
||||
if (!atom->avec->dihedrals_allow)
|
||||
error->all(FLERR, "No dihedrals allowed with this atom style");
|
||||
error->all(FLERR, "No dihedrals allowed with atom style {}", atom->get_style());
|
||||
atom->dihedral_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "extra/improper/per/atom") == 0) {
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/improper/per/atom", error);
|
||||
if (!atom->avec->impropers_allow)
|
||||
error->all(FLERR, "No impropers allowed with this atom style");
|
||||
error->all(FLERR, "No impropers allowed with atom style {}", atom->get_style());
|
||||
atom->improper_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "extra/special/per/atom") == 0) {
|
||||
|
||||
@ -906,13 +906,23 @@ void ReadData::command(int narg, char **arg)
|
||||
// at end of 1st pass, error check for required sections
|
||||
// customize for new sections
|
||||
|
||||
if ((nbonds && !bondflag) || (nangles && !angleflag) || (ndihedrals && !dihedralflag) ||
|
||||
(nimpropers && !improperflag))
|
||||
error->one(FLERR, "A required molecular topology section not found in data file");
|
||||
if (nbonds && !bondflag)
|
||||
error->one(FLERR, "Bonds section for {} bonds not found", nbonds);
|
||||
if (nangles && !angleflag)
|
||||
error->one(FLERR, "Angles section for {} angles not found", nangles);
|
||||
if (ndihedrals && !dihedralflag)
|
||||
error->one(FLERR, "Dihedrals section for {} dihedrals not found", ndihedrals);
|
||||
if (nimpropers && !improperflag)
|
||||
error->one(FLERR, "Impropers section for {} impropers not found", nimpropers);
|
||||
|
||||
if ((nellipsoids && !ellipsoidflag) || (nlines && !lineflag) || (ntris && !triflag) ||
|
||||
(nbodies && !bodyflag))
|
||||
error->one(FLERR, "Required bonus data not found in data file");
|
||||
if (nellipsoids && !ellipsoidflag)
|
||||
error->one(FLERR, "Ellipsoids section for {} ellipsoids not found", nellipsoids);
|
||||
if (nlines && !lineflag)
|
||||
error->one(FLERR, "Lines section for {} lines not found", nlines);
|
||||
if (ntris && !triflag)
|
||||
error->one(FLERR, "Triangles section for {} triangles not found", ntris);
|
||||
if (nbodies && !bodyflag)
|
||||
error->one(FLERR, "Bodies section for {} bodies not found", nbodies);
|
||||
|
||||
// break out of loop if no molecular topology in file
|
||||
// else make 2nd pass
|
||||
@ -2124,6 +2134,8 @@ void ReadData::typelabels(int mode)
|
||||
int lntypes = 0;
|
||||
std::vector<std::string> *labels;
|
||||
std::unordered_map<std::string, int> *labels_map;
|
||||
if (me == 0)
|
||||
utils::logmesg(lmp, " reading {} labelmap ...\n", utils::lowercase(labeltypes[mode]));
|
||||
|
||||
switch (mode) {
|
||||
case Atom::ATOM:
|
||||
|
||||
Reference in New Issue
Block a user