The diffusion coefficient of a liquid can be calculated from the velocity autocorrelation function of an MD simulation in the canonical ensemble,
where v(t) is the velocity of the particle at time t. Note that care must be taken in using an MD simulation with a stochastic thermostat, which introduce an external source of friction and random force.