## Wednesday, 22 August 2007

### RMSD

RMSD (root mean square deviation) is the typical measure to compare different structures of a molecule. The nice thing for people with a linear algebra fetish is that the RMSD is nothing but the distance in the appropriate euclidian space. Let's see why, using this neat script for making LATEX formulae I found at A Zephyr in Time.

I don't know which indeces are least confusing but let's do it like this:
In structure A of our molecule with N atoms, the atoms have the following coordinates:

$(\begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix}, \begin{pmatrix} x_4 \\ x_5 \\ x_6 \end{pmatrix}, ..., \begin{pmatrix} x_{3N-2} \\ x_{3N-1} \\ x_{3N} \end{pmatrix})$

Structure B is the same molecule but bond lengths and angles are changed (or it is moved in space). The coordinates are

$(\begin{pmatrix} y_1 \\ y_2 \\ y_3 \end{pmatrix}, \begin{pmatrix} y_4 \\ y_5 \\ y_6 \end{pmatrix}, ..., \begin{pmatrix} y_{3N-2} \\ y_{3N-1} \\ y_{3N} \end{pmatrix})$

With the chosen coordinates the RMSD is defined as follows:

$RMSD(A,B) = \sqrt{ \frac{(x_1 - y_1)^2 + (x_2 - y_2)^2 + (x_3 - y_3)^2 + ... + (x_{3N} y_{3N})^2}{N} }$

This reminds the attentive reader of the dot product she has been using since high school.

$RMSD(A,B) = \sqrt{\frac{\begin{pmatrix} x_1 - y_1 \\.\\.\\.\\ x_{3N} - y_{3N} \end{pmatrix} \cdot \begin{pmatrix} x_1 - y_1 \\.\\.\\.\\ x_{3N} - y_{3N} \end{pmatrix}}{N}}$

This is the length of the difference vector divided by $\sqrt{N}$, in other words the distance.

If you want some more linear algebra you can go on:

With two coordinate vectors a and b

$a = \begin{pmatrix} x_1 \\.\\.\\.\\ x_{3N} \end{pmatrix}, b = \begin{pmatrix} y_1 \\.\\.\\.\\ y_{3N} \end{pmatrix}$

we define the scalar product (using the Dirac notation to remind us that a typical overlap matrix element can be interpreted as a scalar product)

$ = \frac{1}{N}(x_1 y_1 + ... + x_{3N} y_{3N})$

Now the RMSD between two structures A and B can be computed as the length of the difference vector between the two coordinate vectors a and b (containing the coordinates of all the atoms).

$RMSD(A,B) = ||a-b||$

RMSD is brought down to something anyone can handle: a distance. And it is brought down to a clean mathematical construct, e.g. triangle inequalities immediately follow. I thought that was pretty cool.