diff --git a/src/fix_wall.cpp b/src/fix_wall.cpp index f7293ffd06..4c4406a34c 100644 --- a/src/fix_wall.cpp +++ b/src/fix_wall.cpp @@ -105,9 +105,11 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), nwall } if (utils::strmatch(style, "^wall/lepton")) { + estyle[nwall] = sstyle[nwall] = CONSTANT; lstr[nwall] = utils::strdup(arg[iarg + 2]); cutoff[nwall] = utils::numeric(FLERR, arg[iarg + 3], false, lmp); } else if (utils::strmatch(style, "^wall/table")) { + estyle[nwall] = sstyle[nwall] = CONSTANT; fstr[nwall] = utils::strdup(arg[iarg + 2]); kstr[nwall] = utils::strdup(arg[iarg + 3]); cutoff[nwall] = utils::numeric(FLERR, arg[iarg + 4], false, lmp); diff --git a/src/fix_wall_table.cpp b/src/fix_wall_table.cpp index c44864a7bd..dc1dda4504 100644 --- a/src/fix_wall_table.cpp +++ b/src/fix_wall_table.cpp @@ -90,8 +90,13 @@ void FixWallTable::precompute(int m) { double u, mdu; + // always use linear interpolation to determine the offset, since we may be at the + // outer table cutoff and spline interpolation would cause out-of-bounds array accesses + int savedtabstyle = tabstyle; + tabstyle = LINEAR; uf_lookup(m, cutoff[m], u, mdu); offset[m] = u; + tabstyle = savedtabstyle; } /* ----------------------------------------------------------------------