| ## g_msd Main Table of Contents | VERSION 3.2.0 Sun 25 Jan 2004

### Description

g_msd computes the mean square displacement (MSD) of atoms from their initial positions. This provides an easy way to compute the diffusion constant using the Einstein relation. The diffusion constant is calculated by least squares fitting a straight line through the MSD from `-beginfit` to `-endfit`. An error estimate given, which is the difference of the diffusion coefficients obtained from fits over the two halfs of the fit interval.

Option `-mol` plots the MSD for molecules, this implies `-mw`, i.e. for each inidividual molecule an diffusion constant is computed. When using an index file, it should contain molecule numbers instead of atom numbers. Using this option one also gets an accurate error estimate based on the statistics between individual molecules. Since one usually is interested in self-diffusion at infinite dilution this is probably the most useful number.

### Files

option | filename | type | description
--- | --- | --- | ---
`-f` | `traj.xtc` | Input | Generic trajectory: xtc trr trj gro g96 pdb
`-s` | `topol.tpr` | Input | Structure+mass(db): tpr tpb tpa gro g96 pdb xml
`-n` | `index.ndx` | Input, Opt. | Index file
`-o` | `msd.xvg` | Output | xvgr/xmgr file
`-mol` | `diff_mol.xvg` | Output, Opt. | xvgr/xmgr file

### Other options

option | type | default | description
--- | --- | --- | ---
`-[no]h` | bool | `no` | Print help info and quit
`-nice` | int | `19` | Set the nicelevel
`-b` | time | `-1` | First frame (ps) to read from trajectory
`-e` | time | `-1` | Last frame (ps) to read from trajectory
`-dt` | time | `-1` | Only use frame when t MOD dt = first time (ps)
`-tu` | enum | `ps` | Time unit: `ps`, `fs`, `ns`, `us`, `ms`, `s`, `m` or `h`
`-[no]w` | bool | `no` | View output xvg, xpm, eps and pdb files
`-type` | enum | `no` | Compute diffusion coefficient in one direction: `no`, `x`, `y` or `z`
`-lateral` | enum | `no` | Calculate the lateral diffusion in a plane perpendicular to: `no`, `x`, `y` or `z`
`-ngroup` | int | `1` | Number of groups to calculate MSD for
`-[no]mw` | bool | `yes` | Mass weighted MSD
`-trestart` | time | `0` | Time between restarting points in trajectory (ps)
`-beginfit` | time | `0` | Start time for fitting the MSD (ps)
`-endfit` | time | `-1` | End time for fitting the MSD (ps), -1 is till end

http://www.gromacs.org
gromacs@gromacs.org