matrix [out <filename>] [start <#>] [stop|end <#>] [offset <#>]
[name <name>] [ byatom | byres [mass] | bymask [mass] ]
[ ired [order <#>] ]
[ {distcovar | idea} <mask1> ]
[ {dist | correl | covar | mwcovar} <mask1> [<mask2>] ]
[ dihcovar dihedrals <dataset arg> ]
[out <filename>] If specified, write matrix to <filename>.
[start <#>] [stop|end <#>] [offset <#>] Start, stop, and offset frames to use (as a
subset of all frames read in).
[name <name>] Name of the matrix dataset (for referral in subsequent analysis).
byatom Write results by atom (default). This is the sole option for covar,
mwcovar, and ired.
byres Write results by calculating an average for each residue (mass weighted
if mass is specified).
bymask Write average over <mask1>, and if <mask2> is specified <mask1> x
<mask2> and <mask2> as well (mass weighted if mass is specified).
Calculate matrix of the specified type from input coordinate frames:
dist <mask1> [<mask2>] Distance matrix (default).
correl <mask1> [<mask2>] Correlation matrix (aka dynamic cross correlation[564]).
covar <mask1> [<mask2>] Coordinate covariance matrix.
mwcovar <mask1> [<mask2>] Mass-weighted coordinate covariance matrix.
distcovar <mask1> Distance covariance matrix.
idea <mask1> Isotropically Distributed Ensemble Analysis matrix.[565]
ired [order <#>] Isotropic Reorientational Eigenmode Dynamics matrix[566] with Legendre polynomials of specified
order (default 1). IRED vectors must have been specified previously with ’vector ired’ (see 28.9.79 on
page 645).
dihcovar dihedrals <dataset arg> Dihedral covariance matrix. Dihedral data sets must have been previously
defined with e.g. dihedral or multidihedral commands or read in externally with readdata and marked as
Matrix dimensions will be of the order of N x M for dist, correl, idea, and ired, 2N x 2N for dihcovar, 3N x 3M
for covar and mwcovar, and N(N-1) x N(N-1) / 4 for distcovar (with N being the number of data sets in the case of
ired and dihcovar and the number of atoms in <mask1> otherwise, andMbeing the number of atoms in <mask2>
if specified or <mask1> otherwise). No mask is required for ired; the matrix will be made up of previously defined

IRED vectors (see the vector command on page 645). Similarly no mask is required for dihcovar; dihedral data
sets must have been previously defined. Only one mask can be used with distcovar and idea matrices (i.e. they
can be symmetric only), otherwise one or two masks can be used (for symmetric and full matrices respectively).
If two masks are specified the number of atoms covered by mask1 must be greater than or equal to the number of
atoms covered by mask2, and on output <mask1> corresponds to columns while <mask2> corresponds to rows.
As a simple example, a distance matrix of all CA atoms is generated and output to distmat.dat.
matrix dist @CA out distmat.dat