[lammps-users] FW: Is the table interpolation correct?


Thank you Paul!

1. I looked at the archived topics. Unfortunately my problem is not that
common. :slight_smile: I didn't find some discussion directly related to this or giving
a solution.

2. Before posting new topic to the mailing list, I do read the document
every time.
But you know for a newbie, it's not always that obvious to find the answer
for some particular issues.
However, once you know the solution, you know it. That's why we need this
mailing list and your help.

3. Thank you for the hint. Now I know why the linear interpolation is NOT
linear. :slight_smile: I suggest this should be clearly mentioned in the document. It's

4. This time I used a large N for my tabulated potential, N=27600 for a
simple LJ 12-6 potential.
Again I tried both pair_style table linear and spline, both give better
fitting to the original energy data, but neither of them is good enough!

From a overall look, it's not bad. But if I zoom in and compare the

interpolated curve and the original one, there seems a systematic deviation!
Especially close to the minimum of the potential, there is a shift to the
left. I could not say this is satisfactory for such a simple case. Of
course, I first suspect myself. But if somebody can, please check it. I'd
like to know your findings.

5. You are right. FPRIME is not really obsolete. But it's replaced by his
brother 'FP'. At least in the latest version of lammps, only the keyword FP
is supported not FPRIME. Apparently there is no much people using tabulated
potential or this keyword and complain about it. If this will be remained
the same in the future version, I suggest also updating the online document
please. It's misled and leads to potentially danger of wasting people's
precious time.:slight_smile:

6. I know the developers tried your best to maintain lammps. Still I suggest
there should be a more open and interactive bug reporting feature on the
website. Instead of sending email individually to the authors, people can
report bug online and the status will be shown and known by everyone. (like
debian, drupal projects) And I think this will also reduce the authors work
to response users' email. They can focus on resolving the problem. And users
do not have to ask similar questions repeatly.

7. My problem is still there. For simple LJ potential I expect
better/perfect interpolation, especially when I can provide that many data
points N=27600. And the simplest linear interpolation between two adjacent
data points should work perfectly. But as said in point 4, the interpolation
in lammps does not do as good as expected.

For the convenience of somebody who may help, I attached my tabulated
potential data file (very long) and the input script. I think you can easily
reproduce the problem. (make a plot of "pot_lj.out" and compare with the
original in pot.lj.table) Or maybe you can find where I'm doing wrong. Thank



The problem is that you're over-specifying the values for R in your tabulation file. One way to specify it is by this line:

N 27600 R 2.5 30.0 FP 330000 0

The other way is giving the r values listed in each line of the table. LAMMPS is using the former, while you expected LAMMPS to use the latter. So all of your values are shifted relative to what you thought. See the LAMMPS docs:


"If used, the parameters "R" or "RSQ" are followed by 2 values rlo and rhi. If specified, the distance associated with each energy and force value is computed from these 2 values (at high accuracy), rather than using the (low-accuracy) value listed in each line of the table. For "R", distances uniformly spaced between rlo and rhi are computed; for "RSQ", squared distances uniformly spaced between rlo*rlo and rhi*rhi are computed."

So if you use:

N 27600 FP 330000 0

The problem you're seeing goes away.

I admit that this aspect of LAMMPS's pair_table feature is confusing and it is quite understandable how someone could get their foot caught in this trap. Sorry.