pair_style table

Hello lammps community,

I ran into a little bit of trouble trying to use a tabulated potential and would appreciate any helpful comments about it. I am setting up a simulation using a slightly modified version of the Buckingham potential. The modification is aimed to guarantee that the potential is repulsive at small interactomic distances. The formulation is:

for r < rc1, V = Dr + B(1/r^n), and F = -dV/dr = -D + (Bn)(1/r^(n+1))

for r > rc1, V = Aexp(-r/ro) - C(1/r^6), and F = -dV/dr = (A/ro)exp(-r/ro) - 6C*(1/r^7)

The values of V, dV/dr and d2V/dr2 for both potential are equal at r=rc1

An example of my input file to read the table and to print out the values that lammps internally creates based on the table is as follow:

pair_style table linear 11000

pair_coeff 1 2 BuckPotMod.dat BUCK_SiO
pair_write 1 2 11000 rsq 0.001 10.0 LMP.BuckPotMod BUCK_SiO

My problem emerges when I compare the input table given in the input table BuckPotMod.dat and the output given in LMP.BuckPotMod.

The first data lines of the input table are:
N 11000 RSQ 0.001000000000000 10.000000000000000
1 0.001000000000000 2415892845889.488281250000000 8770990733164046.000000000000000
2 0.001007094970240 2354671709986.986816406250000 8488499423286188.000000000000000

645 0.094919395901693 160034.648498067603214 6121132.128131920471787
646 0.095592846190821 155979.194710976124043 5923986.194356862455606

694 0.134216493028082 45497.851983958076744 1230734.912589643150568
695 0.135168755051843 44344.868280710114050 1191096.238515381002799

The first few lines of the output file from lammps are:

N 11000 RSQ 0.001 10
1 0.001 2415892845889.49 8.77099073316404e+15
2 0.0953558363258958 2354671709986.99 8.48849942328619e+15
3 0.134849809205731 2295001978770.16 8.21510644022047e+15

The values of Energy and Force for the first distance in the table, r=0.001, is the same. However, for further distances r, the values from lammps vastly differ from the input table. Unfortunately I haven’t been able to determine why. I have tried increasing the resolution of the input table (1100, 5500 and 11000 points) and that of the output table (1100, 5500, 11000 and 22000 points); but the results present the same problematic behavior.

Thank you very much for your comments,


your table has the wrong spacing for the r coordinate and thus is not read correctly.
please keep in mind that for R and RSQ the second column is ignored on reading and the data instead generated from the rlo, rhi and N parameters.

the safest way to get tables, that are written the way LAMMPS expects it, is to use pair style python, where you write your piece-wise defined potential as a python script and then use pair write to generate the table.

it is also advisable to first practice and test the tabulation process with a known analytical potential like lj/cut of morse or soft.