From 991034b632c7c36a283082416e2575eefbd4d27e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer <akohlmey@gmail.com> Date: Fri, 21 Oct 2016 13:54:34 -0400 Subject: [PATCH] have bond style table exit when bond length is outside table range --- src/MOLECULE/bond_table.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/MOLECULE/bond_table.cpp b/src/MOLECULE/bond_table.cpp index 3a9f7cc4d0..858bc83a36 100644 --- a/src/MOLECULE/bond_table.cpp +++ b/src/MOLECULE/bond_table.cpp @@ -585,17 +585,26 @@ double BondTable::splint(double *xa, double *ya, double *y2a, int n, double x) /* ---------------------------------------------------------------------- calculate potential u and force f at distance x - insure x is between bond min/max + insure x is between bond min/max, exit with error if not ------------------------------------------------------------------------- */ void BondTable::uf_lookup(int type, double x, double &u, double &f) { int itable; double fraction,a,b; + char estr[128]; Table *tb = &tables[tabindex[type]]; - x = MAX(x,tb->lo); - x = MIN(x,tb->hi); + if (x < tb->lo) { + sprintf(estr,"Bond length < table inner cutoff: " + "type %d length %g",type,x); + error->one(FLERR,estr); + } + if (x > tb->hi) { + sprintf(estr,"Bond length > table outer cutoff: " + "type %d length %g",type,x); + error->one(FLERR,estr); + } if (tabstyle == LINEAR) { itable = static_cast<int> ((x - tb->lo) * tb->invdelta); -- GitLab