---
name: "g_dist_d"
section: "1"
platform: "linux"
package: "gromacs-data"
version: "5.0.2-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/gmx-distance"
---

# g\_dist\_d(1)

Calculate distances between pairs of positions

Part of [gmx-distance(1)](/gmx-distance/1.md).

## NAME

gmx-distance - Calculate distances between pairs of positions

## SYNOPSIS

gmx distance \[-f \[\<.xtc/.trr/...\>\]\] \[-s \[\<.tpr/.tpb/...\>\]\]\
              \[-n \[\<.ndx\>\]\] \[-oav \[\<.xvg\>\]\] \[-oall \[\<.xvg\>\]\]\
              \[-oxyz \[\<.xvg\>\]\] \[-oh \[\<.xvg\>\]\] \[-oallstat \[\<.xvg\>\]\]\
              \[-b \<time\>\] \[-e \<time\>\] \[-dt \<time\>\] \[-tu \<enum\>\]\
              \[-xvg \<enum\>\] \[-\[no\]rmpbc\] \[-\[no\]pbc\] \[-sf \<file\>\]\
              \[-selrpos \<enum\>\] \[-select \<selection\>\] \[-len \<real\>\]\
              \[-tol \<real\>\] \[-binw \<real\>\]

## DESCRIPTION

**gmx distance** calculates distances between pairs of positions as a function of time. Each selection specifies an independent set of distances to calculate. Each selection should consist of pairs of positions, and the distances are computed between positions 1-2, 3-4, etc.

**-oav** writes the average distance as a function of time for each selection. **-oall** writes all the individual distances. **-oxyz** does the same, but the x, y, and z components of the distance are written instead of the norm. **-oh** writes a histogram of the distances for each selection. The location of the histogram is set with **-len** and **-tol**. Bin width is set with **-binw**. **-oallstat** writes out the average and standard deviation for each individual distance, calculated over the frames.

## OPTIONS

Options to specify input and output files:

**-f** *\[\<.xtc/.trr/...\>\] (traj.xtc) (Input, Optional)*\
     Input trajectory or single configuration: xtc trr cpt trj gro g96 pdb tng

**-s** *\[\<.tpr/.tpb/...\>\] (topol.tpr) (Input, Optional)*\
     Input structure: tpr tpb tpa gro g96 pdb brk ent

**-n** *\[\<.ndx\>\] (index.ndx) (Input, Optional)*\
     Extra index groups

**-oav** *\[\<.xvg\>\] (distave.xvg) (Output, Optional)*\
     Average distances as function of time

**-oall** *\[\<.xvg\>\] (dist.xvg) (Output, Optional)*\
     All distances as function of time

**-oxyz** *\[\<.xvg\>\] (distxyz.xvg) (Output, Optional)*\
     Distance components as function of time

**-oh** *\[\<.xvg\>\] (disthist.xvg) (Output, Optional)*\
     Histogram of the distances

**-oallstat** *\[\<.xvg\>\] (diststat.xvg) (Output, Optional)*\
     Statistics for individual distances

Other options:

**-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 if t MOD dt == first time (ps)

**-tu** *\<enum\> (ps)*\
     Unit for time values: fs, ps, ns, us, ms, s

**-xvg** *\<enum\> (xmgrace)*\
     Plot formatting: none, xmgrace, xmgr

**-\[no\]rmpbc**  *(yes)*\
     Make molecules whole for each frame

**-\[no\]pbc**  *(yes)*\
     Use periodic boundary conditions for distance calculation

**-sf** *\<file\>*\
     Provide selections from files

**-selrpos** *\<enum\> (atom)*\
     Selection reference positions: atom, res\_com, res\_cog, mol\_com, mol\_cog, whole\_res\_com, whole\_res\_cog, whole\_mol\_com, whole\_mol\_cog, part\_res\_com, part\_res\_cog, part\_mol\_com, part\_mol\_cog, dyn\_res\_com, dyn\_res\_cog, dyn\_mol\_com, dyn\_mol\_cog

**-select** *\<selection\>*\
     Position pairs to calculate distances for

**-len** *\<real\> (0.1)*\
     Mean distance for histogramming

**-tol** *\<real\> (1)*\
     Width of full distribution as fraction of **-len**

**-binw** *\<real\> (0.001)*\
     Bin width for histogramming

## SEE ALSO

**[gromacs(7)](/gromacs/7.md)**

More information about **GROMACS** is available at \<*http://www.gromacs.org/*\>.
