I have used the following script as I see in (http://lammps.sandia.gov/doc/compute_vacf.html)
compute 2 all vacf
fix 5 all vector 1 c_2
variable diff equal dt*trap(f_5)
thermo_style custom step v_diff
During the simulation time I see both positive and negative values of v_diff.
The negative numbers are not make sense to me, because the diffusion coefficient of any type of particles is positive.
I would appreciate if I have your advice.
compute vacf computes velocity auto-correlation function, which does not correspond to diffusion coefficient. You should be using compute msd. Please look at its doc page for more info.
But the area under the velocity auto correlation is proportional to the diffusion coeff?
Yes, but you have to numerically integrate the vacf out to very long times since vacf is a very slowly decaying function. You got to integrate everything under the very long tail. This makes it not so reliable for estimating transport properties. If you didn’t run your simulations long enough, I wouldn’t be surprised if you got unreasonable diffusion coefficients. Just use mean square displacement. It is much more straightforward, faster, and more accurate.