8.3.8. Calculate diffusion coefficients
The diffusion coefficient examples/DIFFUSE
directory for scripts that implement the 2 methods discussed here for
a simple Lennard-Jones fluid model.
The first method is to measure the mean-squared displacement (MSD) of
the system, via the compute msd command. The slope
of the MSD versus time is proportional to the diffusion coefficient.
The instantaneous MSD values can be accumulated in a vector via the
fix vector command, and a line fit to the vector to
compute its slope via the variable slope function, and
thus extract
The second method is to measure the velocity auto-correlation function
(VACF) of the system, via the compute vacf
command. The time-integral of the VACF is proportional to the
diffusion coefficient. The instantaneous VACF values can be
accumulated in a vector via the fix vector command,
and time integrated via the variable trap function,
and thus extract