# [gmx-users] TRACE OF RMSD COMPARISON MATRIX

Tsjerk Wassenaar tsjerkw at gmail.com
Tue Jul 2 09:34:26 CEST 2013

```Hi Richa,

>From your explanation, I understand you want to know the sum of distances
between each frame and its corresponding filtered frame. I think it makes
more sense to sum squared distances, but that's a minor detail.
The (non-mass-weighted) RMSD between two structures, written as positional
vectors in 3N dimensional space, and properly rotated is:

RMSD(a,b) = sqrt((a-b)'(a-b))

In your case, the objective is comparing a frame x and the frame filtered
by a set of eigenvectors, represented as the skinny matrix P: y = PP'x

So, because the structures were fit prior to the covariance analysis
anyway, the MSD is

MSD = (x-PP'x)'(x-PP'x) = x'x + x'PP'PP'x - 2x'PP'x

Because the eigenvectors are an orthonormal set, P'P = I and we get

MSD = x'x - x'PP'x

Now, x'x is just the radius of gyration squared of the original structure,
so you can easily get that with g_gyrate for your trajectory. x'PP'x is the
inner product of the projections of x onto the eigenvectors in P, which you
get with g_anaeig -proj. So your objective is easily reached with some
relatively cheap calls to g_gyrate/g_anaeig and a bit of scripting in awk
or python, avoiding the determination of a whole RMSD matrix, just to get
the trace. In fact, it becomes rather trivial to do this for any subset of
eigenvectors you desire.

As for the final answer, I would sum the MSD and take the square root,
rather than summing the square roots, to get a more meaningful answer. But
it's already unclear to me what these numbers would signify to begin with.

Hope it helps,

Tsjerk

On Tue, Jul 2, 2013 at 8:53 AM, Gaurav Goel <gauravgoeluta at gmail.com> wrote:

> http://orbeckst.github.io/GromacsWrapper/gromacs/core/fileformats/xpm.html
>
> -g
> --
> Gaurav Goel
> Assistant Professor
> Department of Chemical Engineering
> Indian Institute of Technology, Delhi
> Hauz Khas, New Delhi 110016
> India
>
> On 02-Jul-2013, at 10:45 AM, Richa Singh <richa.s.rathorerr at gmail.com>
> wrote:
>
> > Hello users,
> >
> > I'm using g_rms to compare my actual trajectory obtained from
> > simulation with the filtered trajectory (along given set of
> > eigenvectors), this gives me an RMSD comparison matrix in xpm format
> > where the values of the plot are not clear. Is there any way which can
> > help me to get the values along the diagonal of the matrix?
> > the command that i followed is:
> > g_rms -s ref.tpr -f actual.xtc -f2 filtered.xtc -m rmsd.xpm
> >
> > I want to calculate the trace of the matrix basically.
> >
> >
> > Regards..
> > --
> > gmx-users mailing list    gmx-users at gromacs.org
> > http://lists.gromacs.org/mailman/listinfo/gmx-users
> > * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
> > * Please don't post (un)subscribe requests to the list. Use the
> > www interface or send it to gmx-users-request at gromacs.org.
> > * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> --
> gmx-users mailing list    gmx-users at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-users
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
> * Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-users-request at gromacs.org.
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>

--
Tsjerk A. Wassenaar, Ph.D.

```