GMX-RDF(1)

✨ NAME ✨

gmx-rdf β€” bestie, it calculates radial distribution functions πŸ’–

(also this whole thing lives in the GROMACS manual, just so u know 🫢)


🌈 SYNOPSIS 🌈

gmx rdf [-f [<.xtc/.trr/...>]] [-s [<.tpr/.gro/...>]] [-n [<.ndx>]]
        [-o [<.xvg>]] [-cn [<.xvg>]] [-b <time>] [-e <time>]
        [-dt <time>] [-tu <enum>] [-fgroup <selection>] [-xvg <enum>]
        [-[no]rmpbc] [-[no]pbc] [-sf <file>] [-selrpos <enum>]
        [-seltype <enum>] [-bin <real>] [-norm <enum>] [-[no]xy]
        [-[no]excl] [-cut <real>] [-rmax <real>] [-surf <enum>]
        [-ref <selection>] [-sel <selection>]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so gmx rdf computes radial distribution functions, going from one reference set of positions (that's the one u set with -ref) out to one or more sets of positions (those are the ones u set with -sel). iconic behaviour fr fr.

But wait πŸ’… β€” if u wanna compute the RDF with respect to the closest position in a set from -ref instead, use -surf: when it's set, -ref gets partitioned into sets based on the value of -surf, and the closest position in each set is what gets used. and if u want the RDF around axes parallel to the z-axis, meaning only in the x-y plane, that's what -xy is for ✨.

To pick your bin width and your max distance for the RDF, u use -bin and -rmax. no cap, -rmax is also the move when u wanna limit computational cost β€” like if the RDF just isn't interesting to u all the way out to the default. and what is the default, u ask? it's half of the box size with PBC, or three times the box size without PBC πŸ‘‘

Wanna use exclusions from the topology (-s)? Set -excl, and make sure both -ref and -sel only select atoms. A rougher alternative for excluding intra-molecular peaks is setting -cut to a non-zero value so the RDF gets cleared at small distances. it's giving "quick and dirty" but it works 🫢

Now, the RDFs are normalized by three things:

  1. average number of positions in -ref (and it's the number of groups when u use -surf)
  2. volume of the bin
  3. average particle density of -sel positions for that selection

and to switch up the normalization, u use -norm:

  • rdf β€” uses all the factors for normalization. this produces a normal RDF πŸ’–
  • number_density β€” uses the first two factors only. this produces a number density as a function of distance 🌸
  • none β€” uses only the first factor. in this case the RDF is only scaled with the bin width, so that the integral of the curve represents the number of pairs within a range ✨
⚠️ heads up bestie: exclusions do NOT affect the normalization. even if -excl is set, or -ref and -sel contain the same selection, the normalization factor is still N*M, not N*(M-excluded). 😭

For -surf, the selection u hand to -ref must select atoms β€” centers of mass are not supported, sorry babe πŸ’€. And further, -nonorm is implied, because the bins have irregular shapes and the volume of a bin is not easily computable. geometry said "not today" πŸ™ˆ

Option -cn produces the cumulative number RDF, i.e. the average number of particles within a distance r. cute lil running total, obsessed πŸŽ€


πŸ’… OPTIONS πŸ’…

πŸ“ Options to specify input files

  • -f [<.xtc/.trr/...>] β€” (traj.xtc) (Optional) β€” Input trajectory or single configuration: xtc trr cpt gro g96 pdb tng h5md 🌈
  • -s [<.tpr/.gro/...>] β€” (topol.tpr) (Optional) β€” Input structure: tpr gro g96 pdb brk ent πŸ¦‹
  • -n [<.ndx>] β€” (index.ndx) (Optional) β€” Extra index groups ✨

🌸 Options to specify output files

  • -o [<.xvg>] β€” (rdf.xvg) β€” Computed RDFs πŸ’–
  • -cn [<.xvg>] β€” (rdf_cn.xvg) (Optional) β€” Cumulative RDFs πŸŽ€

πŸ‘‘ 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 πŸ’«
  • -bin <real> β€” (0.002) β€” Bin width (nm) πŸ“
  • -norm <enum> β€” (rdf) β€” Normalization: rdf, number_density, none βš–οΈ
  • -[no]xy β€” (no) β€” Use only the x and y components of the distance ✨
  • -[no]excl β€” (no) β€” Use exclusions from topology 🚫
  • -cut <real> β€” (0) β€” Shortest distance (nm) to be considered βœ‚οΈ
  • -rmax <real> β€” (0) β€” Largest distance (nm) to calculate πŸ“
  • -surf <enum> β€” (no) β€” RDF with respect to the surface of the reference: no, mol, res 🌊
  • -ref <selection> β€” Reference selection for RDF computation 🎯
  • -sel <selection> β€” Selections to compute RDFs for from the reference 🎯

🧚 SEE ALSO 🧚

More information about GROMACS is available at http://www.gromacs.org/ 🌈


2026, GROMACS development team β€” thank u for ur service, legends 🫢


version 2026.4, dated Oct 02, 2026 β€” that's the whole page bestie, go compute some RDFs and slay πŸ’…βœ¨πŸ’– no cap, u ate πŸŽ€

πŸ“¦ where this page comes from