Next: A simulation example script Up: RMSD and best-fit alignments Previous: RMSD Computation

## Computing the Alignment

The best-fit alignment is done in two steps. The first is to compute the matrix transformation that takes one set of coordinates onto the other. This is done with the measure fit command. Assuming the same selections as before:

```        set transformation_matrix [measure fit \$sel1 \$sel2]
Info) {0.971188 0.00716391 0.238206 -13.2877}
{0.0188176 0.994122 -0.106619 3.25415} {-0.23757 0.108029 0.965345 -2.97617}
{0.0 0.0 0.0 1.0}```
As with the RMSD calculation, you could also add an optional weight <keyword> term on the end.

The next step is to apply the matrix to a set of atoms using the move command. So far you have two coordinate sets. You might think you could do something like \$sel1 move \$transformation_matrix to apply the matrix to all the atoms of that selection. You could, but that's not the right selection.

The thing to recall is that \$sel1 is the selection for the backbone atoms. You really want to move the whole fragment to which it is attached, or even the whole molecule. (This is where the discussion earlier comes into play.) So you need to make a third selection containing all the atoms which are to be moved, and apply the transformation to those atoms.

```        # molecule 0 is the same molecule used for \$sel1
set move_sel [atomselect 0 "all"]
\$move_sel move \$transformation_matrix```

As a more complicated example, with the mouse you cannot do something like "align all of molecule 1 with molecule 9 using only the backbone atoms of residues 4 to 10 in both systems" with the mouse. However, you can do it with the text command. Here's how:

```        # compute the transformation matrix
set reference_sel  [atomselect 9 "backbone and resid 4 to 10"]
set comparison_sel [atomselect 1 "backbone and resid 4 to 10"]
set transformation_mat [measure fit \$comparison_sel \$reference_sel]

# apply it to all of the molecule 1
set move_sel [atomselect 1 "all"]
\$move_sel move \$transformation_mat```

Justin Gullingsrud
Tue Apr 6 09:22:39 CDT 1999