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

Hello, Paul,

Thank you for the reply! Now I know the reason why it's shifted. I didn't
understand it well.
However, I don't understand yet why lammps doesn't use a simple linear
interpolation for
the keyword 'linear'? If we could have that large amount of input data, I
expect a simple
linear interpolation gives a better fitting. Due to the splining, both
'spline' and 'linear' table
style do not produce a fitted curve exactly crossing all the original data
points. You can
see this if you zoom in the plot even you think the fitting is good enough.
The simplest
linear interpolation can at least pass all the original data points, which
should be trusted
for a known function or when you trust your input data. For unknown function
form, we
cannot say the original data are always trustable than the fitted ones. But
I don't see
a way to do this in lammps. (lookup method is not good, it makes step
function.)

The pair_table routine reads in the user's tabulated potential, builds a spline representation of that user-provided data, then from the spline representation creates the lookup, linear, cubic-splined, or bitmapped table that is actually used during the simulation. This procedure allows the user to provide N data points in their file while LAMMPS uses M data points for the calculation. This is useful for cases when the user wants to provide a small N data points and have LAMMPS fill in the gaps with something reasonable, then use a higher precision large M data points in the actual simulation. Your suggestion would require N=M, which reduces flexibility. Still, you can set N=M and have LAMMPS do as you are suggesting.

Paul

Hi. This is a little off topic, but not completely. I want to calculate
the shear viscosity of some liquids. The standard textbook formula is
(apologies to those who don't read LaTeX)

eta = (V/(k_B T)) lim_{T->\infty} \integrate_{0}^{T} <P_{xy}(0)P_{xy}(t)>
dt

This integral is to be evaluated by MD simulation of a quiescent system.

I'm unsure about a couple of things:

1) For 3D systems, do you sum over the correlations of all 3 off-diagonal
terms of P? i. e. is the integrand

<P_xy(y)P_xy(t) + P_xz(0)P_xz(t) + P_yz(0)P_yz(t)>?

Any factors of 3 or 1/3? I'm correct to only include off-diagonal
stresses, right?

2) The _equilibrium_ pressure tensor should be intrinsic (independent of
system size) in the thermodynamic limit, yet there is a factor of V in the formula for
eta. Is this because shear stresses in a quiescent system arise from
thermal _fluctuations_, and so have magnitude \propto V^{-1/2}? Or
another reason?

3) Are the quantities pxy, pxz, pyz output by LAMMPS thermo_style
custom the correct quantities to put into the integral for eta? (I think they are
but am not sure)

Thanks,
Rob

Hi Rob,

1. Yes, you need a factor of (1/3) if you sum over the three time correlation functions of off-diagonal components.

2. I am not sure if I understand this question completely. However, the relation for eta can be derived using linear response theory, starting from the equations of motion/Hamiltonian. Please see McQuarrie (Stat. Mech.) or Evans and Morriss (Stat. Mech. of Non equilibrium liquids). Note that in the standard definition of pressure (Allen & Tildesley, for instance), there is a (1/V) factor in front of the contributions from the kinetic and the virial parts.

3. Yes. I suppose that is correct.

Best,
Bala
http://www.jncasr.ac.in/bala