question about pair_coul_long_soft potential

Dear Lammps user and developer,

I have a question about pair_coul_long_soft.cpp.

Why it is " (dencdencdenc)" in “prefactor = qqrd2e * lam1[itype][jtype] * qtmpq[j] / (dencdenc*denc);” in line 144, but not a single “denc” ?

From the equation in
E = lambda^n ( C qi qj/{epsilon[ alpha_c*(1-lambda)^2 + r^2 ]^1/2})

Since denc = sqrt(lam2[itype][jtype] + rsq), it should equals to “epsilon*[ alpha_c*(1-lambda)^2 + r^2 ]^1/2”. So if we divide “denc”
by once, we will get the above equation, why do we need to divide it three times?

Thank you so much for your help!


Yang Hong

I cannot answer your question directly, you better contact the author of that pair style for that, but I have a couple of comments.

  1. the force that LAMMPS computes is usually not exactly the force but force divided by the distance. the reason for that can be most easily seen by looking at pair style lj/cut.
    by computing fpair as force/r, one avoids a division and taking the square root of rsq, since the x-, y-, z- force components become fpairdelx, fpairdely, and fpair*delz
    the same applies to the Pair::single() API.

  2. when people write new pair styles by modifying existing pair styles, they do not always update all functions related to the computing of forces. The Pair::single() API is regularly overlooked. This is ultimately a shortcoming of the testing done in LAMMPS, but that is understandable if you consider the size and complexity of the software.
    You can verify that you get consistent results by using a simple test system with just one atom type and use the pair_write command (which uses Pair::single) to generate a tabulated potential file. and then you set up the same simulation using pair style table and compare the resulting energies and forces. apart from some numerical noise and errors from the tabulation interpolation, the results sould be comparable. if they differ wildly, then most likely the Pair::single function has a bug, which again is something to discuss first with the original author of that file.