add "Incorrect format in ... section of data file" to Error_details and url
This commit is contained in:
@ -37,3 +37,20 @@ but the :doc:`read_data <read_data>` command is missing the (optional)
|
||||
arguments that identify the fix and the header keyword and section
|
||||
keyword or those arguments are inconsistent with the keywords in the
|
||||
data file.
|
||||
|
||||
.. _err0002:
|
||||
|
||||
Incorrect format in ... section of data file
|
||||
--------------------------------------------
|
||||
|
||||
This error happens when LAMMPS reads the contents of a section of a
|
||||
:doc:`data file <read_data>` and the number of parameters in the line
|
||||
differs from what is expected. This most commonly happens, when the
|
||||
atom style is different from what is expected for a specific data file
|
||||
since changing the atom style usually changes the format of the line.
|
||||
|
||||
This error can also happen when the number of entries indicated in the
|
||||
header of a data file (e.g. the number of atoms) is larger than the
|
||||
number of lines provided (e.g. in the corresponding Atoms section)
|
||||
and then LAMMPS will continue reading into the next section and that
|
||||
would have a completely different format.
|
||||
|
||||
@ -970,7 +970,8 @@ void FixCMAP::read_data_section(char * /*keyword*/, int /*n*/, char *buf,
|
||||
atom5 = values.next_tagint();
|
||||
if (values.has_next()) throw TokenizerException("too many items",line);
|
||||
} catch (std::exception &e) {
|
||||
error->all(FLERR,"Incorrect format of CMAP section: {}", e.what());
|
||||
error->all(FLERR,"Incorrect format of CMAP section in data file: {}{}",
|
||||
e.what(), utils::errorurl(2));
|
||||
}
|
||||
|
||||
atom1 += id_offset;
|
||||
|
||||
28
src/atom.cpp
28
src/atom.cpp
@ -1068,7 +1068,8 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
|
||||
}
|
||||
|
||||
if ((nwords != avec->size_data_atom) && (nwords != avec->size_data_atom + 3))
|
||||
error->all(FLERR,"Incorrect format in {}: {}", location, utils::trim(buf));
|
||||
error->all(FLERR,"Incorrect format in {}: {}{}", location,
|
||||
utils::trim(buf), utils::errorurl(2));
|
||||
|
||||
*next = '\n';
|
||||
// set bounds for my proc
|
||||
@ -1149,7 +1150,8 @@ 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 format in {}: {}", location, utils::trim(buf));
|
||||
error->all(FLERR, "Incorrect format in {}: {}{}", location,
|
||||
utils::trim(buf), utils::errorurl(2));
|
||||
} else {
|
||||
int imx = 0, imy = 0, imz = 0;
|
||||
if (imageflag) {
|
||||
@ -1243,7 +1245,8 @@ void Atom::data_vels(int n, char *buf, tagint id_offset)
|
||||
if (values.size() == 0) {
|
||||
// skip over empty or comment lines
|
||||
} else if ((int)values.size() != avec->size_data_vel) {
|
||||
error->all(FLERR, "Incorrect velocity format in data file: {}", utils::trim(buf));
|
||||
error->all(FLERR, "Incorrect format in Velocities section of data file: {}{}",
|
||||
utils::trim(buf), utils::errorurl(2));
|
||||
} else {
|
||||
tagint tagdata = utils::tnumeric(FLERR,values[0],false,lmp) + id_offset;
|
||||
if (tagdata <= 0 || tagdata > map_tag_max)
|
||||
@ -1287,7 +1290,9 @@ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset,
|
||||
// skip over empty or comment lines
|
||||
// Bonds line is: number(ignored), bond type, atomID 1, atomID 2
|
||||
if (nwords > 0) {
|
||||
if (nwords != 4) error->all(FLERR, "Incorrect format in {}: {}", location, utils::trim(buf));
|
||||
if (nwords != 4)
|
||||
error->all(FLERR, "Incorrect format in {}: {}{}", location,
|
||||
utils::trim(buf), utils::errorurl(2));
|
||||
typestr = utils::utf8_subst(values[1]);
|
||||
atom1 = utils::tnumeric(FLERR, values[2], false, lmp);
|
||||
atom2 = utils::tnumeric(FLERR, values[3], false, lmp);
|
||||
@ -1378,7 +1383,9 @@ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset,
|
||||
// skip over empty or comment lines
|
||||
// Angles line is: number(ignored), angle type, atomID 1, atomID 2, atomID 3
|
||||
if (nwords > 0) {
|
||||
if (nwords != 5) error->all(FLERR, "Incorrect format in {}: {}", location, utils::trim(buf));
|
||||
if (nwords != 5)
|
||||
error->all(FLERR, "Incorrect format in {}: {}{}", location,
|
||||
utils::trim(buf), utils::errorurl(2));
|
||||
typestr = utils::utf8_subst(values[1]);
|
||||
atom1 = utils::tnumeric(FLERR, values[2], false, lmp);
|
||||
atom2 = utils::tnumeric(FLERR, values[3], false, lmp);
|
||||
@ -1485,7 +1492,9 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset,
|
||||
// skip over empty or comment lines
|
||||
// Dihedrals line is: number(ignored), bond type, atomID 1, atomID 2, atomID 3, atomID 4
|
||||
if (nwords > 0) {
|
||||
if (nwords != 6) error->all(FLERR, "Incorrect format in {}: {}", location, utils::trim(buf));
|
||||
if (nwords != 6)
|
||||
error->all(FLERR, "Incorrect format in {}: {}{}", location,
|
||||
utils::trim(buf), utils::errorurl(2));
|
||||
typestr = utils::utf8_subst(values[1]);
|
||||
atom1 = utils::tnumeric(FLERR, values[2], false, lmp);
|
||||
atom2 = utils::tnumeric(FLERR, values[3], false, lmp);
|
||||
@ -1611,7 +1620,9 @@ void Atom::data_impropers(int n, char *buf, int *count, tagint id_offset,
|
||||
// skip over empty or comment lines
|
||||
// Impropers line is: number(ignored), bond type, atomID 1, atomID 2, atomID 3, atomID 4
|
||||
if (nwords > 0) {
|
||||
if (nwords != 6) error->all(FLERR, "Incorrect format in {}: {}", location, utils::trim(buf));
|
||||
if (nwords != 6)
|
||||
error->all(FLERR, "Incorrect format in {}: {}{}", location,
|
||||
utils::trim(buf), utils::errorurl(2));
|
||||
typestr = utils::utf8_subst(values[1]);
|
||||
atom1 = utils::tnumeric(FLERR, values[2], false, lmp);
|
||||
atom2 = utils::tnumeric(FLERR, values[3], false, lmp);
|
||||
@ -1727,7 +1738,8 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset)
|
||||
if (values.size() == 0) {
|
||||
// skip over empty or comment lines
|
||||
} else if ((int)values.size() != avec_bonus->size_data_bonus) {
|
||||
error->all(FLERR, "Incorrect bonus data format in data file: {}", utils::trim(buf));
|
||||
error->all(FLERR, "Incorrect format in Bonus section of data file: {}{}",
|
||||
utils::trim(buf), utils::errorurl(2));
|
||||
} else {
|
||||
tagint tagdata = utils::tnumeric(FLERR,values[0],false,lmp) + id_offset;
|
||||
if (tagdata <= 0 || tagdata > map_tag_max)
|
||||
|
||||
@ -328,8 +328,9 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, tagint
|
||||
try {
|
||||
ValueTokenizer values(buf);
|
||||
if ((int) values.count() != values_peratom + 1)
|
||||
error->all(FLERR, "Incorrect format in {} section of data file: {} expected {} and got {}",
|
||||
keyword, buf, values_peratom + 1, values.count());
|
||||
error->all(FLERR, "Incorrect format in {} section of data file: {}\n"
|
||||
"expected {} parameters and got {}{}", keyword, utils::trim(buf),
|
||||
values_peratom + 1, values.count(), utils::errorurl(2));
|
||||
|
||||
itag = values.next_tagint() + id_offset;
|
||||
if (itag <= 0 || itag > map_tag_max)
|
||||
|
||||
Reference in New Issue
Block a user