Perform best fit of coordinates to reference and calculate coordinate RMSD.

rmsd [<name>] 
     [out <filename>] 
     [nofit | norotate | nomod] 
     [savematrices [matricesout <file>]] 
     [savevectors {combined|separate} [vecsout <file>]] 
     [ first | reference | ref <name> | refindex <#> | previous | reftraj <name> 
          [parm <name> | parmindex <#>] ] 
     [perres perresout <filename> [perresavg <avgfile>] 
          [range <resRange>] [refrange <refRange>] [perresmask <additional mask>]
          [perrescenter] [perresinvert]

[<name>] Output data set name.
[<mask>] Mask of atoms to calculate RMSD for; if not specified, calculate for all atoms.
[<refmask>] Reference mask; if not specified, use <mask>.
[out <filename>] Output data file name.
[mass] Mass-weight the RMSD calculation.
[nofit] Do not perform best-fit RMSD.
[norotate] If calculating best-fit RMSD, translate but do not rotate coordinates.
[nomod] If calculating best-fit RMSD, do not modify coordinates.
[savematrices] If specified save rotation matrices to data set with aspect [RM].
matricesout <file> Write rotation matrices to specified file.
[savevectors {combined|separate}] If specified save translation vectors: combined means save target-to-origin plus the origin-to-reference translation vectors, separate means save target-to-origin as Vx, Vy, Vz and save origin-to-reference as Ox Oy Oz in the output vector data set.
vecsout <file> Output translation vector data set to <file>.

Reference keywords:
first Use the first trajectory frame processed as reference.
reference Use the first previously read in reference structure (refindex 0).
ref <name> Use previously read in reference structure specified by filename/tag.
refindex <#> Use previously read in reference structure specified by <#> (based on order read in).
previous Use frame prior to current frame as reference.
reftraj <name> Use frames from COORDS set <name> or read in from trajectory file <name> as references. Each frame from <name> is used in turn, so that frame 1 is compared to frame 1 from <name>, frame 2 is compared to frame 2 from <name> and so on. If <trajname> runs out of frames before processing is complete, the last frame of <trajname> continues to be used as the reference.
parm <parmname> | parmindex <#> If reftraj specifies a trajectory file, associate it with specified topology; if not specified the first topology is used.

Per-residue RMSD keywords:
perres Activate per-residue no-fit RMSD calculation.
perresout <perresfile> Write per-residue RMSD to <perresfile>.
perresavg <avgfile> Write average per-residue RMSDs to <avgfile>.
range <res range> Calculate per-residue RMSDs for residues in <res range> (default all solute residues).
refrange <ref range> Calculate per-residue RMSDs to reference residues in <ref range> (use <res range> if not specified).
perresmask <additional mask> By default residues are selected using the mask ’:X’ where X is residue number; this appends <additional mask> to the mask expression.
perrescenter Translate residues to a common center of mass prior to calculating RMSD.
perresinvert Make X-axis residue number instead of frame number.

Data Sets Created:
<name> RMSD of atoms in mask to reference.
<name>[RM] (savematrices only) Rotation matrices of target to reference.
<name>[res] (perres only) Per-residue RMSDs; index is residue number.
<name>[Avg] (perres only) Average per-residue RMSD for each residue.
<name>[Stdev] (perres only) Standard deviation of RMSD for each residue.

Note that perres data sets are not generated until run is called.

An introductory tutorial for the RMSD command is available here.

Calculate the coordinate RMSD of input frames to a reference frame (or reference trajectory). Both <mask> and <refmask> must specify the same number of atoms, otherwise an error will occur.

For example, say you have a trajectory and you want to calculate RMSD to two separate reference structures. To calculate the best-fit RMSD of the C, CA, and N atoms of residues 1 to 20 in each frame to the C, CA, and N atoms of residues 3 to 23 in StructX.crd, and then calculate the no-fit RMSD of residue 7 to residue 7 in another structure named Struct-begin.rst7, writing both results to Grace-format file “rmsd1.agr”:

reference StructX.crd [structX]
reference md_begin.rst7 [struct0]
rmsd BB :1-20@C,CA,N ref [structX] :3-23@C,CA,N out rmsd1.agr
rmsd Res7 :7 ref [struct0] out rmsd1.agr nofit

Per-residue RMSD calculation
If the perres keyword is specified, after the initial RMSD calculation the no-fit RMSD of specified residues is also calculated. So for example:

rmsd :10-260 reference perres perresout PRMS.dat range 190-211 perresmask &!(@H=)

will first perform a best-fit RMSD calculation to the first specified reference structure using residues 10 to 260, then calculate the no-fit RMSD of residues 190 to 211 (excluding any hydrogen atoms), writing the results to PRMS.dat. Two additional recommendations for the ’perres’ option: 1) try not including backbone atoms by using the ’perresmask’ keyword, e.g. “perresmask &!@H,N,CA,HA,C,O”, and 2) try using the ’perrescenter’ keyword, which centers each residue prior to the ’nofit’ calculation; this is useful for isolating changes in residue conformation.