# [gmx-users] Principal axes of inertia and g_principal

Antonio Baptista baptista at itqb.unl.pt
Fri Sep 12 04:34:54 CEST 2014

```Hi Nicola,

On Thu, 11 Sep 2014, nicola staffolani wrote:

> ​Dear GMX community,
>
> regarding the program g_principal and acknowledged the bug reported here
> ​, I would like to understand what the meaning of the output of this
> program is.
> So, left aside moi.dat, the output files are axis1.dat, axis2.dat &
> axis3.dat.
> Supposing that I have already corrected the output files (or reinstalled
> GROMACS having fixed the bug in the source file as explained always here
> in each of the files, for each time instant there are three coordinates: x,
> y and z: what do they mean? My interpretation is that if I connect the
> point, whose coordinates are those printed out in the output files, with
> the origin of the Cartesian axes, then I get a line coinciding with the
> corresponding (principal) axis: is this interpretation correct?

Yes, that is correct. In other words, they are the coordinates of the
point P=O+v, where O is the origin and v is the vector of unit norm that
points along that principal axis. Of course, for graphical representation
purposes, you would displace each of those 3 principal axis vectors to
make them point away from the center of mass of your system, since the
whole idea is to get a reference frame which is "natural" to that system
(e.g., see Goldstein or any other book on rigid body mechanics).

>
> To get the principal axes, I have to diagonalize the moment of inertia
> symmetric 3×3 matrix; one way to do it is by solving the 3rd order equation
> for the eigenvalues: is this the way by which GROMACS finds then the
> eigenvectors of the moment of inertia matrix, from which it calculates the
> aforementioned coordinates?

As I pointed in the links you mentioned, I didn't look very deep into the
GROMACS code, but the vectors that g_principal writes (after the
correction) are exactly the ones obtained from the diagonalization you
describe. But check it yourself for a simple case. My rule of thumb: never
trust an analysis tool until you check it yourself... :)

Best,
Antonio

>
>
> Nicola       ​
>
> --
> Nicola Staffolani PhD
> Biophysics & Nanoscience Centre <http://www.unitus.it/biophysics>
> Università della Tuscia
> Largo dell'Università s.n.c., I-01100 Viterbo
> email: n.staffolani at unitus.it
> tel.: +39 0761 35 70 27; fax: +39 0761 35 71 36
> --
> Gromacs Users mailing list
>
> * Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send a mail to gmx-users-request at gromacs.org.
--
Antonio M. Baptista
Instituto de Tecnologia Quimica e Biologica, Universidade Nova de Lisboa
Av. da Republica - EAN, 2780-157 Oeiras, Portugal
phone: +351-214469619         email: baptista at itqb.unl.pt
fax:   +351-214411277         WWW:   http://www.itqb.unl.pt/~baptista
--------------------------------------------------------------------------
```