## g_cluster

Main Table of Contents

VERSION 3.2.0
Sun 25 Jan 2004

### Description

g_cluster can cluster structures with several different methods. Distances between structures can be determined from a trajectory or read from an XPM matrix file with the `-dm` option. RMS deviation after fitting or RMS deviation of atom-pair distances can be used to define the distance between structures.

full linkage: add a structure to a cluster when its distance to any element of the cluster is less than `cutoff`.

Jarvis Patrick: add a structure to a cluster when this structure and a structure in the cluster have each other as neighbors and they have a least `P` neighbors in common. The neighbors of a structure are the M closest structures or all structures within `cutoff`.

Monte Carlo: reorder the RMSD matrix using Monte Carlo.

diagonalization: diagonalize the RMSD matrix.

gromos: use algorithm as described in Daura <it>et al.</it> (<it>Angew. Chem. Int. Ed.</it> 1999, <it>38</it>, pp 236-240). Count number of neighbors using cut-off, take structure with largest number of neighbors with all its neighbors as cluster and eleminate it from the pool of clusters. Repeat for remaining structures in pool.

When the clustering algorithm assigns each structure to exactly one cluster (full linkage, Jarvis Patrick and gromos) and a trajectory file is supplied, the structure with the smallest average distance to the others or the average structure or all structures for each cluster will be written to a trajectory file. When writing all structures, separate numbered files are made for each cluster.

Two output files are always written:
`-o` writes the RMSD values in the upper left half of the matrix and a graphical depiction of the clusters in the lower right half (depends on `-max` and `-keepfree`).
`-g` writes information on the options used and a detailed list of all clusters and their members.

Additionally, a number of optional output files can be written:
`-dist` writes the RMSD distribution.
`-ev` writes the eigenvectors of the RMSD matrix diagonalization.
`-sz` writes the cluster sizes.
`-tr` writes a matrix of the number transitions between cluster pairs.
`-ntr` writes the total number of transitions to or from each cluster.
`-clid` writes the cluster number as a function of time.
`-cl` writes average (with option `-av`) or central structure of each cluster or writes numbered files with cluster members for a selected set of clusters (with option `-wcl`, depends on `-nst` and `-rmsmin`).

### Files

option | filename | type | description
--- | --- | --- | ---
`-f` | `traj.xtc` | Input, Opt. | Generic trajectory: xtc trr trj gro g96 pdb
`-s` | `topol.tpr` | Input, Opt. | Structure+mass(db): tpr tpb tpa gro g96 pdb xml
`-n` | `index.ndx` | Input, Opt. | Index file
`-dm` | `rmsd.xpm` | Input, Opt. | X PixMap compatible matrix file
`-o` | `rmsd-clust.xpm` | Output | X PixMap compatible matrix file
`-g` | `cluster.log` | Output | Log file
`-dist` | `rmsd-dist.xvg` | Output, Opt. | xvgr/xmgr file
`-ev` | `rmsd-eig.xvg` | Output, Opt. | xvgr/xmgr file
`-sz` | `clust-size.xvg` | Output, Opt. | xvgr/xmgr file
`-tr` | `clust-trans.xpm` | Output, Opt. | X PixMap compatible matrix file
`-ntr` | `clust-trans.xvg` | Output, Opt. | xvgr/xmgr file
`-clid` | `clust-id.xvg` | Output, Opt. | xvgr/xmgr file
`-cl` | `clusters.pdb` | Output, Opt. | Generic trajectory: xtc trr trj gro g96 pdb

### Other options

option | type | default | description
--- | --- | --- | ---
`-[no]h` | bool | `no` | Print help info and quit
`-nice` | int | `19` | Set the nicelevel
`-b` | time | `-1` | First frame (ps) to read from trajectory
`-e` | time | `-1` | Last frame (ps) to read from trajectory
`-dt` | time | `-1` | Only use frame when t MOD dt = first time (ps)
`-tu` | enum | `ps` | Time unit: `ps`, `fs`, `ns`, `us`, `ms`, `s`, `m` or `h`
`-[no]w` | bool | `no` | View output xvg, xpm, eps and pdb files
`-[no]dista` | bool | `no` | Use RMSD of distances instead of RMS deviation
`-nlevels` | int | `40` | Discretize RMSD matrix in # levels
`-keepfree` | int | `-4` | if >0 # levels not to use when coloring clusters; if <0 nlevels/-keepfree+1 levels will not be used
`-cutoff` | real | `0.1` | RMSD cut-off (nm) for two structures to be neighbor
`-[no]fit` | bool | `yes` | Use least squares fitting before RMSD calculation
`-max` | real | `-1` | Maximum level in RMSD matrix
`-skip` | int | `1` | Only analyze every nr-th frame
`-[no]av` | bool | `no` | Write average iso middle structure for each cluster
`-wcl` | int | `0` | Write all structures for first # clusters to numbered files
`-nst` | int | `1` | Only write all structures if more than # per cluster
`-rmsmin` | real | `0` | minimum rms difference with rest of cluster for writing structures
`-method` | enum | `linkage` | Method for cluster determination: `linkage`, `jarvis-patrick`, `monte-carlo`, `diagonalization` or `gromos`
`-minstruct` | int | `1` | Minimum number of structures in cluster for coloring in the xpm file
`-[no]binary` | bool | `no` | Treat the RMSD matrix as consisting of 0 and 1, where the cut-off is given by -cutoff
`-M` | int | `10` | Number of nearest neighbors considered for Jarvis-Patrick algorithm, 0 is use cutoff
`-P` | int | `3` | Number of identical nearest neighbors required to form a cluster
`-seed` | int | `1993` | Random number seed for Monte Carlo clustering algorithm
`-niter` | int | `10000` | Number of iterations for MC
`-kT` | real | `0.001` | Boltzmann weighting factor for Monte Carlo optimization (zero turns off uphill steps)

http://www.gromacs.org
gromacs@gromacs.org