---
name: "gmx-extract-cluster"
section: "1"
platform: "linux"
package: "gromacs-data"
version: "2025.2-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/gmx-extract-cluster"
---

# gmx-extract-cluster(1)

Allows extracting frames corresponding to clusters from trajectory

## NAME

gmx-extract-cluster - Allows extracting frames corresponding to clusters from trajectory

## SYNOPSIS

```
gmx extract-cluster [-f [<.xtc/.trr/...>]] [-s [<.tpr/.gro/...>]]
             [-n [<.ndx>]] [-clusters [<.ndx>]]
             [-o [<.xtc/.trr/...>]] [-b <time>] [-e <time>]
             [-dt <time>] [-tu <enum>] [-fgroup <selection>]
             [-xvg <enum>] [-[no]rmpbc] [-[no]pbc] [-sf <file>]
             [-selrpos <enum>] [-select <selection>] [-vel <enum>]
             [-force <enum>] [-atoms <enum>] [-precision <int>]
             [-starttime <time>] [-timestep <time>] [-box <vector>]
```

## DESCRIPTION

**gmx extract-cluster** can be used to extract trajectory frames that correspond to clusters obtained from running gmx cluster with the -clndx option. The module supports writing all GROMACS supported trajectory file formats.

Included is also a selection of possible options to change additional information.

It is possible to write only a selection of atoms to the output trajectory files for each cluster.

## OPTIONS

Options to specify input files:

- **-f \[\<.xtc/.trr/...\>\] (traj.xtc) (Optional)**

  Input trajectory or single configuration: *xtc* *trr* *cpt* *gro* *g96* *pdb* *tng*

- **-s \[\<.tpr/.gro/...\>\] (topol.tpr) (Optional)**

  Input structure: *tpr* *gro* *g96* *pdb* brk ent

- **-n \[\<.ndx\>\] (index.ndx) (Optional)**

  Extra index groups

- **-clusters \[\<.ndx\>\] (cluster.ndx)**

  Name of index file containing frame indices for each cluster, obtained from gmx cluster -clndx.

Options to specify output files:

- **-o \[\<.xtc/.trr/...\>\] (trajout.xtc)**

  Prefix for the name of the trajectory file written for each cluster.: *xtc* *trr* *cpt* *gro* *g96* *pdb* *tng*

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

- **-select \<selection\>**

  Selection of atoms to write to the file

- **-vel \<enum\> (preserved-if-present)**

  Save velocities from frame if possible: preserved-if-present, always, never

- **-force \<enum\> (preserved-if-present)**

  Save forces from frame if possible: preserved-if-present, always, never

- **-atoms \<enum\> (preserved-if-present)**

  Decide on providing new atom information from topology or using current frame atom information: preserved-if-present, always-from-structure, never, always

- **-precision \<int\> (3)**

  Set output precision to custom value

- **-starttime \<time\> (0)**

  Change start time for first frame

- **-timestep \<time\> (0)**

  Change time between different frames

- **-box \<vector\>**

  New diagonal box vector for output frame

## SEE ALSO

**[gmx(1)](/gmx/1.md)**

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

## COPYRIGHT

2025, GROMACS development team
