mirror of https://github.com/lammps/lammps.git
stop with detailed parser error message with incorrect potential tables
This commit is contained in:
parent
886ad8359e
commit
5f811f852f
|
@ -402,26 +402,20 @@ void AngleTable::read_table(Table *tb, char *file, char *keyword)
|
|||
|
||||
// read a,e,f table values from file
|
||||
|
||||
int cerror = 0;
|
||||
reader.skip_line();
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
line = reader.next_line(4);
|
||||
line = reader.next_line();
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
values.next_int();
|
||||
tb->afile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
tb->ffile[i] = values.next_double();
|
||||
} catch (TokenizerException &) {
|
||||
++cerror;
|
||||
} catch (TokenizerException &e) {
|
||||
error->one(FLERR, "Error parsing angle table '{}' line {} of {}. {}\nLine was: {}", keyword,
|
||||
i + 1, tb->ninput, e.what(), line);
|
||||
}
|
||||
}
|
||||
|
||||
// warn if data was read incompletely, e.g. columns were missing
|
||||
|
||||
if (cerror)
|
||||
error->warning(FLERR, "{} of {} lines in table incomplete or could not be parsed", cerror,
|
||||
tb->ninput);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
@ -325,20 +325,20 @@ void BondTable::read_table(Table *tb, char *file, char *keyword)
|
|||
|
||||
// read r,e,f table values from file
|
||||
|
||||
int cerror = 0;
|
||||
int r0idx = -1;
|
||||
|
||||
reader.skip_line();
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
line = reader.next_line(4);
|
||||
line = reader.next_line();
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
values.next_int();
|
||||
tb->rfile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
tb->ffile[i] = values.next_double();
|
||||
} catch (TokenizerException &) {
|
||||
++cerror;
|
||||
} catch (TokenizerException &e) {
|
||||
error->one(FLERR, "Error parsing bond table '{}' line {} of {}. {}\nLine was: {}", keyword,
|
||||
i + 1, tb->ninput, e.what(), line);
|
||||
}
|
||||
|
||||
if (tb->efile[i] < emin) {
|
||||
|
@ -373,23 +373,13 @@ void BondTable::read_table(Table *tb, char *file, char *keyword)
|
|||
if (f > fleft && f > fright) ferror++;
|
||||
}
|
||||
|
||||
if (ferror) {
|
||||
if (ferror)
|
||||
error->warning(FLERR,
|
||||
"{} of {} force values in table are inconsistent with -dE/dr.\n"
|
||||
"WARNING: Should only be flagged at inflection points",
|
||||
ferror, tb->ninput);
|
||||
}
|
||||
|
||||
// warn if data was read incompletely, e.g. columns were missing
|
||||
|
||||
if (cerror) {
|
||||
error->warning(FLERR,
|
||||
"{} of {} lines in table were incomplete or could not be"
|
||||
" parsed completely",
|
||||
cerror, tb->ninput);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
build spline representation of e,f over entire range of read-in table
|
||||
this function sets these values in e2file,f2file
|
||||
|
|
|
@ -1020,23 +1020,24 @@ void DihedralTable::read_table(Table *tb, char *file, char *keyword)
|
|||
// read a,e,f table values from file
|
||||
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
line = reader.next_line();
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
if (tb->f_unspecified) {
|
||||
ValueTokenizer values = reader.next_values(3);
|
||||
values.next_int();
|
||||
tb->phifile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
} else {
|
||||
ValueTokenizer values = reader.next_values(4);
|
||||
values.next_int();
|
||||
tb->phifile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
tb->ffile[i] = values.next_double();
|
||||
}
|
||||
} catch (TokenizerException &e) {
|
||||
error->one(FLERR, e.what());
|
||||
error->one(FLERR, "Error parsing dihedral table '{}' line {} of {}. {}\nLine was: {}",
|
||||
keyword, i + 1, tb->ninput, e.what(), line);
|
||||
}
|
||||
}
|
||||
} //for (int i = 0; (i < tb->ninput) && fp; i++) {
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
@ -395,20 +395,18 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
|
|||
union_int_float_t rsq_lookup;
|
||||
|
||||
int rerror = 0;
|
||||
int cerror = 0;
|
||||
|
||||
reader.skip_line();
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
line = reader.next_line(4);
|
||||
|
||||
line = reader.next_line();
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
values.next_int();
|
||||
rfile = values.next_double();
|
||||
tb->efile[i] = conversion_factor * values.next_double();
|
||||
tb->ffile[i] = conversion_factor * values.next_double();
|
||||
} catch (TokenizerException &) {
|
||||
++cerror;
|
||||
} catch (TokenizerException &e) {
|
||||
error->one(FLERR, "Error parsing pair table '{}' line {} of {}. {}\nLine was: {}", keyword,
|
||||
i + 1, tb->ninput, e.what(), line);
|
||||
}
|
||||
|
||||
rnew = rfile;
|
||||
|
@ -474,14 +472,6 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
|
|||
"{} of {} distance values in table {} with relative error\n"
|
||||
"WARNING: over {} to re-computed values",
|
||||
rerror, tb->ninput, EPSILONR, keyword);
|
||||
|
||||
// warn if data was read incompletely, e.g. columns were missing
|
||||
|
||||
if (cerror)
|
||||
error->warning(FLERR,
|
||||
"{} of {} lines in table {} were incomplete\n"
|
||||
"WARNING: or could not be parsed completely",
|
||||
cerror, tb->ninput, keyword);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue