## g_msd

Main Table of Contents

VERSION 4.0
Sun 18 Jan 2009

### 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 time between additional starting points for the MSD calculation is set with `-trestart`. 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.

There are three, mutually exclusive, options to determine different types of mean square displacement: `-type`, `-lateral` and `-ten`. Option `-ten` writes the full MSD tensor for each group, the order in the output is: trace xx yy zz yx zx zy.

Option `-mol` plots the MSD for molecules, this implies With option `-rmcomm` center of mass motion can be removed. For trajectories produced with GROMACS this is usually not necessary as mdrun usually already removes the center of mass motion. When you use this option be sure that the whole system is stored in the trajectory file.

`-mw`, i.e. for each inidividual molecule an diffusion constant is computed for its center of mass. The chosen index group will be split into molecules. The diffusion coefficient is determined by linear regression of the MSD, where, unlike for the normal output of D, the times are weighted according to the number of restart point, i.e. short times have a higher weight. Also when `-beginfit`=-1,fitting starts at 0 and when `-endfit`=-1, fitting goes to the end. Using this option one also gets an accurate error estimate based on the statistics between individual molecules. Note that this diffusion coefficient and error estimate are only accurate when the MSD is completely linear between `-beginfit` and `-endfit`.

Option `-pdb` writes a pdb file with the coordinates of the frame at time `-tpdb` with in the B-factor field the square root of the diffusion coefficient of the molecule. This option implies option `-mol`.

### Files

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

### Other options

option | type | default | description
--- | --- | --- | ---
`-[no]h` | bool | `no` | Print help info and quit
`-nice` | int | `19` | Set the nicelevel
`-b` | time | `0` | First frame (ps) to read from trajectory
`-e` | time | `0` | Last frame (ps) to read from trajectory
`-dt` | time | `0` | Only use frame when t MOD dt = first time (ps)
`-tu` | enum | `ps` | Time unit: `ps`, `fs`, `ns`, `us`, `ms` or `s`
`-[no]w` | bool | `no` | View output xvg, xpm, eps and pdb files
`-[no]xvgr` | bool | `yes` | Add specific codes (legends etc.) in the output xvg files for the xmgrace program
`-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`
`-[no]ten` | bool | `no` | Calculate the full tensor
`-ngroup` | int | `1` | Number of groups to calculate MSD for
`-[no]mw` | bool | `yes` | Mass weighted MSD
`-[no]rmcomm` | bool | `no` | Remove center of mass motion
`-tpdb` | time | `0` | The frame to use for option -pdb (ps)
`-trestart` | time | `10` | Time between restarting points in trajectory (ps)
`-beginfit` | time | `-1` | Start time for fitting the MSD (ps), -1 is 10%
`-endfit` | time | `-1` | End time for fitting the MSD (ps), -1 is 90%

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