implement suggestion by @rbberger

This commit is contained in:
Axel Kohlmeyer
2022-01-04 11:37:32 -05:00
parent f3c5593c50
commit f557bf6e20

View File

@ -1242,7 +1242,7 @@ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset,
tagint atom1,atom2;
char *next;
int newton_bond = force->newton_bond;
const std::string errtxt = "Bonds section of data file: ";
auto location = "Bonds section of data file";
for (int i = 0; i < n; i++) {
next = strchr(buf,'\n');
@ -1255,7 +1255,7 @@ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset,
atom2 = values.next_tagint();
if (values.has_next()) throw TokenizerException("Too many tokens","");
} catch (TokenizerException &e) {
error->one(FLERR,e.what() + std::string(" in ") + errtxt + utils::trim(buf));
error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf));
}
if (id_offset) {
atom1 += id_offset;
@ -1265,9 +1265,9 @@ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset,
if ((atom1 <= 0) || (atom1 > map_tag_max) ||
(atom2 <= 0) || (atom2 > map_tag_max) || (atom1 == atom2))
error->one(FLERR,"Invalid atom ID in " + errtxt + utils::trim(buf));
error->one(FLERR,"Invalid atom ID in {}: {}", location, utils::trim(buf));
if (itype <= 0 || itype > nbondtypes)
error->one(FLERR,"Invalid bond type in " + errtxt + utils::trim(buf));
error->one(FLERR,"Invalid bond type in {}: {}", location, utils::trim(buf));
if ((m = map(atom1)) >= 0) {
if (count) count[m]++;
else {
@ -1306,7 +1306,7 @@ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset,
tagint atom1,atom2,atom3;
char *next;
int newton_bond = force->newton_bond;
const std::string errtxt = "Angles section of data file: ";
auto location = "Angles section of data file";
for (int i = 0; i < n; i++) {
next = strchr(buf,'\n');
@ -1320,7 +1320,7 @@ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset,
atom3 = values.next_tagint();
if (values.has_next()) throw TokenizerException("Too many tokens","");
} catch (TokenizerException &e) {
error->one(FLERR,e.what() + std::string(" in ") + errtxt + utils::trim(buf));
error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf));
}
if (id_offset) {
atom1 += id_offset;
@ -1333,9 +1333,9 @@ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset,
(atom2 <= 0) || (atom2 > map_tag_max) ||
(atom3 <= 0) || (atom3 > map_tag_max) ||
(atom1 == atom2) || (atom1 == atom3) || (atom2 == atom3))
error->one(FLERR,"Invalid atom ID in " + errtxt + utils::trim(buf));
error->one(FLERR,"Invalid atom ID in {}: {}", location, utils::trim(buf));
if (itype <= 0 || itype > nangletypes)
error->one(FLERR,"Invalid angle type in " + errtxt + utils::trim(buf));
error->one(FLERR,"Invalid angle type in {}: {}", location, utils::trim(buf));
if ((m = map(atom2)) >= 0) {
if (count) count[m]++;
else {
@ -1386,7 +1386,7 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset,
tagint atom1,atom2,atom3,atom4;
char *next;
int newton_bond = force->newton_bond;
const std::string errtxt = "Dihedrals section of data file: ";
auto location = "Dihedrals section of data file";
for (int i = 0; i < n; i++) {
next = strchr(buf,'\n');
@ -1401,7 +1401,7 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset,
atom4 = values.next_tagint();
if (values.has_next()) throw TokenizerException("Too many tokens","");
} catch (TokenizerException &e) {
error->one(FLERR,e.what() + std::string(" in ") + errtxt + utils::trim(buf));
error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf));
}
if (id_offset) {
atom1 += id_offset;
@ -1417,9 +1417,9 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset,
(atom4 <= 0) || (atom4 > map_tag_max) ||
(atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) ||
(atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4))
error->one(FLERR, "Invalid atom ID in " + errtxt + utils::trim(buf));
error->one(FLERR, "Invalid atom ID in {}: {}", location, utils::trim(buf));
if (itype <= 0 || itype > ndihedraltypes)
error->one(FLERR, "Invalid dihedral type in " + errtxt + utils::trim(buf));
error->one(FLERR, "Invalid dihedral type in {}: {}", location, utils::trim(buf));
if ((m = map(atom2)) >= 0) {
if (count) count[m]++;
else {
@ -1484,7 +1484,7 @@ void Atom::data_impropers(int n, char *buf, int *count, tagint id_offset,
tagint atom1,atom2,atom3,atom4;
char *next;
int newton_bond = force->newton_bond;
const std::string errtxt = "Impropers section of data file: ";
auto location = "Impropers section of data file";
for (int i = 0; i < n; i++) {
next = strchr(buf,'\n');
@ -1499,7 +1499,7 @@ void Atom::data_impropers(int n, char *buf, int *count, tagint id_offset,
atom4 = values.next_tagint();
if (values.has_next()) throw TokenizerException("Too many tokens","");
} catch (TokenizerException &e) {
error->one(FLERR,e.what() + std::string(" in ") + errtxt + utils::trim(buf));
error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf));
}
if (id_offset) {
atom1 += id_offset;
@ -1515,9 +1515,9 @@ void Atom::data_impropers(int n, char *buf, int *count, tagint id_offset,
(atom4 <= 0) || (atom4 > map_tag_max) ||
(atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) ||
(atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4))
error->one(FLERR, "Invalid atom ID in " + errtxt + utils::trim(buf));
error->one(FLERR, "Invalid atom ID in {}: {}", location, utils::trim(buf));
if (itype <= 0 || itype > nimpropertypes)
error->one(FLERR, "Invalid improper type in " + errtxt + utils::trim(buf));
error->one(FLERR, "Invalid improper type in {}: {}", location, utils::trim(buf));
if ((m = map(atom2)) >= 0) {
if (count) count[m]++;
else {