GMX-PAIRDIST(1)

πŸ’– GMX-PAIRDIST(1) πŸ’–

okay bestie, welcome to GROMACS section 1 β€” this is gmx-pairdist, and no cap, it's the little tool that ✨ measures how far apart your stuff is ✨


πŸ’… NAME πŸ’…

gmx-pairdist β€” calculate pairwise distances between groups of positions. that's it, that's the whole job, and it does it gorgeously 🫢


πŸŽ€ SYNOPSIS πŸŽ€

gmx pairdist [-f [<.xtc/.trr/...>]] [-s [<.tpr/.gro/...>]] [-n [<.ndx>]]
             [-o [<.xvg>]] [-b <time>] [-e <time>] [-dt <time>]
             [-tu <enum>] [-fgroup <selection>] [-xvg <enum>]
             [-[no]rmpbc] [-[no]pbc] [-sf <file>] [-selrpos <enum>]
             [-seltype <enum>] [-cutoff <real>] [-type <enum>]
             [-refgrouping <enum>] [-selgrouping <enum>]
             [-ref <selection>] [-sel <selection>]

like yes she has a lot of flags, but she's worth it πŸ’–


✨ DESCRIPTION ✨

so gmx pairdist computes pairwise distances between one reference selection (you give her that with -ref) and one or more other selections (those go in -sel). iconic behavior tbh.

she can calculate either the minimum distance (that's the default, she's a lowballer bestie πŸ’€) or the maximum distance (that's with -type max). and the distances to each selection you hand over with -sel are computed independently β€” no crossover drama, they mind their own business 🧚

by default she computes the global minimum/maximum distance. but bestie, if you want more distances β€” like, say, minimum distances to each residue in -ref β€” then you use -refgrouping and/or -selgrouping to specify how the positions within each selection should be grouped. that's the whole trick πŸŽ€

computed distances get written to the file you specify with -o. now here's the math, and I need you to lock in: if there are N groups in -ref and M groups in the first selection in -sel, then the output contains N*M columns for the first selection. the columns contain distances like this: r1-s1, r2-s1, ..., r1-s2, r2-s2, ..., where rn is the n'th group in -ref and sn is the n'th group in the other selection. and the distances for the second selection come as separate columns after the first selection, and so on. periodt. πŸ’…

if some selections are dynamic, only the selected positions are used in the computation β€” but the same number of columns is always written out. the column count does not care about your feelings, she is consistent πŸ‘‘

and if there are no positions contributing to some group pair? then the cutoff value is written instead (see below). imagine being that group pair. couldn't be me 😭

-cutoff sets a cutoff for the computed distances. if the result would contain a distance over the cutoff, the cutoff value is written to the output file instead. by default, no cutoff is used β€” but!! if you're not interested in values beyond a cutoff, or if you know that the minimum distance is smaller than a cutoff, you should set this option, because it lets the tool use grid-based searching and be significantly faster. glow up via one flag, we love to see it πŸ”₯

ngl, if you want to compute distances between fixed pairs, gmx distance may be a more suitable tool. just saying, don't make pairdist do a job that isn't hers 🫢

🌸 OPTIONS 🌸

πŸ’œ Options to specify input files:

  • -f [<.xtc/.trr/...>] (traj.xtc) (Optional) β€” input trajectory or single configuration. formats she eats: xtc trr cpt gro g96 pdb tng h5md
  • -s [<.tpr/.gro/...>] (topol.tpr) (Optional) β€” input structure. formats: tpr gro g96 pdb brk ent
  • -n [<.ndx>] (index.ndx) (Optional) β€” extra index groups

πŸ’– Options to specify output files:

  • -o [<.xvg>] (dist.xvg) β€” distances as function of time πŸ“ˆ

πŸ¦‹ 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
  • -fgroup <selection> β€” atoms stored in the trajectory file (if not set, assume first N atoms)
  • -xvg <enum> (xmgrace) β€” plot formatting: xmgrace, xmgr, none
  • -[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
  • -seltype <enum> (atom) β€” default selection output 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
  • -cutoff <real> (0) β€” maximum distance to consider
  • -type <enum> (min) β€” type of distances to calculate: min, max
  • -refgrouping <enum> (all) β€” grouping of -ref positions to compute the min/max over: all, res, mol, none
  • -selgrouping <enum> (all) β€” grouping of -sel positions to compute the min/max over: all, res, mol, none
  • -ref <selection> β€” reference positions to calculate distances from
  • -sel <selection> β€” positions to calculate distances for

πŸ‘‘ SEE ALSO πŸ‘‘

more info about GROMACS is available at <http://www.gromacs.org/>. bestie, go read it, it's giving knowledge 🌈


2026, GROMACS development team


that's the whole page, you ate it, I'm so proud of you πŸ’–βœ¨

this was GROMACS 2026.4, dated Oct 02, 2026, brought to you by the GROMACS development team β€” mwah, kisses, go measure some distances πŸŽ€πŸ’…πŸ«Ά

πŸ“¦ where this page comes from