# Molecular Simulation/Diffusion Coefficients

## Einstein Equation

${\displaystyle \langle |r(t)-r(0)|^{2}\rangle =6Dt}$

The mean square displacement as a function of time of an oxygen molecule diffusing water and pentane. The plots were calculated from a molecular dynamics simulation of a periodic simulation cell containing the oxygen molecule and the solvent. These plots can be used to calculate the diffusion coefficient of the solute using the Einstein relation.
A molecular dynamics simulation of liquid argon in a periodic simulation cell where the particle positions are not "wrapped" to be placed in the opposing face of the cell when they cross the boundary. This is used to calculate diffusion coefficients using the Einstein equation.

## Green-Kubo Theory

The diffusion coefficient of a liquid can be calculated from the velocity autocorrelation function of an MD simulation in the canonical ensemble,

${\displaystyle D=\int _{0}^{\infty }\langle v(t)\cdot v(t+\tau )\rangle d\tau }$

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.