compute_msd
This keyword computes the self-diffusion coefficient (SDC) from the mean-square displacement (MSD) function. If this keyword appears in a run, the MSD function will be computed and the SDC is also calculated as a time derivative of it. The results will be written to msd.out output file.
Syntax
For this keyword, the command looks like:
compute_msd <sample_interval> <Nc> [<optional_arg>]
with parameters defined as
- sample_interval: Sampling interval of the position data
- Nc: Maximum number of correlation steps
The optional argument optional_arg allows three additional special keyword.
The first special keyword is group.
The parameters are:
- group, where- group_methodis the grouping method to use for computation and- groupis the group in the grouping method to use
The second special keyword is all_groups.
This keyword computes the MSD and SDC for each group in the specified grouping method.
Note that group and all_groups cannot be used together.
A typical usecase could be to compute the MSD for each molecule in a system.
The parameters are:
- all_groups, where- group_methodis the grouping method to use for computation
Finally, the third special keyword is save_every.
This keyword saves the internal MSD and SDC computed so far during the simulation, which can be helpful during long running simulations.
The file will have a name formatted as msd_step[step].out.
The parameters are:
- save_every, where- intervalis the number of steps between saving a copy. Note that the copy can only be written at most every- sample_intervalsteps. Furthermore, the first- msd_step[step].outfile will be written after- Nctimes- sample_intervalsteps. Subsequent files will be written every- interval.
Examples
An example of this function is:
compute_msd 5 200 group 1 1
This means that you
- want to calculate the MSD 
- the position data will be recorded every 5 steps 
- the maximum number of correlation steps is 200 
- you would like to compute only over group 1 in group method 1. 
To compute the MSD for all groups in group method 1 and save a copy of the MSD every 100 000 steps, one can write:
compute_msd 5 200 all_groups 1 save_every 100000