Calculate translational diffusion of molecules.

Note that although the syntax for diffusion has changed as of version 16, the old syntax is still supported.

diffusion [{out <filename> | separateout <suffix>}] [time <time per frame>] [noimage] [<mask>] [<set name>] [individual] [diffout <filename>] [nocalc]

[out <filename>] Write mean-square displacement (MSD) data set output to file specified by <filename>.
[separateout <suffix>] Write each MSD data set type to files with suffix <suffix>; see description below.
[time <time_per_frame>] Time in-between each coordinate frame in ps; default is 1.0.
[noimage] If specified do not perform imaging. If this is specified coordinates should be unwrapped prior to this command.
[<mask>] Mask of atoms to calculate diffusion for; default all atoms.
[<set name>] MSD data set name.
[individual] Write diffusion for each individual atom as well as average diffusion for atoms in mask.
[diffout <filename>] Write diffusion contants calculated from fits of MSD data sets to <filename>.
[nocalc] Do not calculate diffusion constants.

DataSet Aspects:
[X] MSD(s) in the X direction.
[Y] MSD(s) in the Y direction.
[Z] MSD(s) in the Z direction.
[R] Overall MSD(s).
[A] Overall displacement(s).
[D] Diffusion constants.
[Label] Diffusion constant lablels.
[Slope] Linear regression slopes.
[Intercept] Linear refression Y-intercepts.
[Corr] Linear regression correlation coefficients.

Compute mean square displacement (MSD) plots (using distance traveled from initial position) for the atoms in <mask>. By default only the diffusion averaged over all atoms in <mask> is calculated; if individual is specified diffusion for individual atoms is calculated as well. In order to correctly calculate diffusion molecules should take continuous paths, so imaging of atoms is automatically performed. If the trajectory is already unwrapped (or the unwrap command is used prior to this command)
the noimage keyword can be used.

The following types of displacements are calculated. If separateout is specfied the following files will be created:

x_<suffix> Mean square displacement(s) in the X direction (in Å2/ps).
y_<suffix> Mean square displacement(s) in the Y direction (in Å2/ps).
z_<suffix> Mean square displacement(s) in the Z direction (in Å2/ps).
r_<suffix> Overall mean square displacement(s) (in Å2/ps).
a_<suffix> Total distance traveled (in Å/ps).

The diffusion coefficient D can be calculated using the Einstein relation:

2nD = \lim_{t  \rightarrow \inf} \frac{MSD}{t}

Where n is the number of dimensions; for overall MSD n = 3, for single dimension MSD (e.g. X) n = 1, etc. Unless nocalc is specified, the diffusion constant is calculated automatically from MSD data sets (and written to the file specified by diffout) in the following manner. The slope the plot of MSD versus time is obtained via linear regression. To convert from units of Å^2/ps to 1×10-5 cm^2/s, the slope is multiplied by 10.0/(2n). Both the calculated diffusion constants as well as the results of the fit are reported.

Due to the fact that diffusion is currently calculated from initial positions only, diffusion calculated for small numbers of atoms will be inherently stochastic, so the results are most sensible when averaged over many atoms; for example, the diffusion of water should be calculated using all waters in the system.

For example, to calculate the diffusion of water in a system:

diffusion :WAT@O out WAT_O.agr WAT_O diffout DC.dat