GMX-TRJORDER(1)

πŸ’– gmx-trjorder(1) β€” the GROMACS orderer-upper πŸ’–

okay bestie, pull up a chair because we're about to order molecules like it's a group chat and everyone's getting sorted by who's closest to the protein 🫢 this little guy lives under the GROMACS umbrella and honestly? iconic.


✨ NAME ✨

gmx-trjorder β€” sorts molecules by how close they are to a group, no cap πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

gmx trjorder [-f [<.xtc/.trr/...>]] [-s [<.tpr/.gro/...>]] [-n [<.ndx>]]
             [-o [<.xtc/.trr/...>]] [-nshell [<.xvg>]] [-b <time>]
             [-e <time>] [-dt <time>] [-xvg <enum>] [-na <int>]
             [-da <int>] [-[no]com] [-r <real>] [-[no]z]

🌸 DESCRIPTION 🌸

so the whole vibe is: gmx trjorder puts your molecules in order based on the smallest distance to atoms in a reference group β€” or, if you pass -z, on the z-coordinate instead. two whole flavors, pick your fighter. ✨

when you're doing distance ordering, it's gonna ask you for a group of reference atoms and a group of molecules. (yes, it asks. be ready. πŸ™ˆ) For each frame of the trajectory, the selected molecules get reordered according to the shortest distance between atom number -da in the molecule and all the atoms in the reference group. and here's the sneaky part: you can use the center of mass of the molecules instead of a reference atom, just by setting -da to 0. πŸ’« every atom in the trajectory gets written out to the output trajectory, so nothing gets ghosted.

gmx trjorder is lowkey the moment for stuff like analyzing the n waters closest to a protein. in that case your reference group would be the protein and your group of molecules would be all the water atoms. once you've made an index group out of the first n waters, that ordered trajectory can go straight into any GROMACS program to analyze the n closest waters. it's giving pipeline. πŸ”₯

if your output file is a .pdb file, the distance to the reference target gets stored in the B-factor field so you can color it with e.g. Rasmol. cute and functional, we love to see it. πŸŽ€

and with option -nshell, the number of molecules within a shell of radius -r around the reference group gets printed. count them bestie, they're yours. 🌈


πŸ’… OPTIONS πŸ’…

πŸ“₯ Options to specify input files:

  • -f [<.xtc/.trr/...>] (traj.xtc) β€” Trajectory: xtc trr cpt gro g96 pdb tng h5md
  • -s [<.tpr/.gro/...>] (topol.tpr) β€” Structure+mass(db): tpr gro g96 pdb brk ent
  • -n [<.ndx>] (index.ndx) (Optional) β€” Index file

πŸ“€ Options to specify output files:

  • -o [<.xtc/.trr/...>] (ordered.xtc) (Optional) β€” Trajectory: xtc trr gro g96 pdb tng h5md
  • -nshell [<.xvg>] (nshell.xvg) (Optional) β€” xvgr/xmgr file

🧚 Other options:

  • -b <time> (0) β€” Time of first frame to read from trajectory (default unit ps)
  • -e <time> (0) β€” Time of last frame to read from trajectory (default unit ps)
  • -dt <time> (0) β€” Only use frame when t MOD dt = first time (default unit ps)
  • -xvg <enum> (xmgrace) β€” xvg plot formatting: xmgrace, xmgr, none
  • -na <int> (3) β€” Number of atoms in a molecule
  • -da <int> (1) β€” Atom used for the distance calculation, 0 is COM
  • -[no]com (no) β€” Use the distance to the center of mass of the reference group
  • -r <real> (0) β€” Cutoff used for the distance calculation when computing the number of molecules in a shell around e.g. a protein
  • -[no]z (no) β€” Order molecules on z-coordinate

πŸ‘€ SEE ALSO πŸ‘€


2026, GROMACS development team


and that's the whole page bestie β€” you now know everything this little orderer knows, fr fr. go sort some waters, you absolute main character. πŸ’œ

GROMACS 2026.4 β€” Oct 02, 2026 πŸŽ€ slay, periodt, take care of your trajectories ✨

πŸ“¦ where this page comes from