Tabulated function for 1-4 interactions

Hi,

I was trying to understand how the force is computed for 14 interactions (like coulomb and LJ). I was able to correctly calculate the LJ 14 energy using the standard formula (sum over (c6 / r6 - c12 / r12)) over the pairs defined in LJ14 directive. But when calculating the forces, when I took the derivative of the above function, it did not give me the same answer.

I debugged the code more and found that it uses Tabulated functions to calculate these values. I am trying further to debug, but I have a few questions regarding these tables:

  1. Should the answers from the mathematical tables and the derivative function be the same? I wanted to just check that the theoretical value should be the same using the derivative function with the tabulated splines.
  2. Where does gromacs source this table from?
  3. Is there any research paper outlining the derivation of the spline interpolation for tabulated functions versus the standard derivative function?

Nevermind, I realized that it was indeed an approximation for the true functional form.

What I was missing was that the forces for ftype == InteractionFunction::LennardJones14 accounts for LJ and Coulomb 14 together, but reports the total energies separately.