Subject: CCL:Re: Ambiguous rotation values

From: Michel Petitjean <ptitjean[at]itodys.jussieu.fr>
Date: Wed, 2 Jul 2003 12:07:22 +0200 (MEST)

To: CCL Mailing List <chemistry[at]ccl.net>
Subject: CCL:Re: Ambiguous rotation values

The relation between rotation matrix and axis+angle is usually
get from the quaternionic parametrization of the rotation,
rather than from the theta,phi,A system.
When you set theta=0 and phi=any_phi_value in:
a1x=sin(theta)*cos(phi),
a2x=sin(theta)*sin(phi),
a3x=cos(theta).
then you get (0,0,1) as direction of the axis, although I presume
that you would like to get independantly direction and angle.
The quaternionic formulation is available from numerous
textbooks and papers (e.g. J.Comput.Chem. 1995,16[1],80-90):
having a unit vector (p,a,b,c), where p=cos(angle/2) and
(a,b,c) is the direction, the rotation matrix R is:

    p^2+a^2-b^2-c^2    2*(ab-pc)        2*(ac+pb)
R =    2*(ab+pc)    p^2-a^2+b^2-c^2     2*(bc-pa)
       2*(ac-pb)       2*(bc+pa)     p^2-a^2-b^2+c^2

Conversely: p^2=(trace(R)+1)/4, and:

    a = ( R(3,2) - R(2,3) ) / 4p
    b = ( R(1,3) - R(3,1) ) / 4p
    c = ( R(2,1) - R(1,2) ) / 4p

Note also than (p,a,b,c) and (-p,-a,-b,-c) are the smae, and that
(a,b,c) is not a unit vector.
Sampling 3D rotations is get from random isotropically 3D directions
and random 2D angles (uniform law).
Regularly tessellated figures are sometimes used to get equally
spaced directions (e.g. from the vertices of the regular icosahedron),
but random sampling is much satisfacory for high number of points.

Michel Petitjean,                     Email: petitjean[at]itodys.jussieu.fr
ITODYS (CNRS, UMR 7086)                      ptitjean[at]ccr.jussieu.fr
1 rue Guy de la Brosse                Phone: +33 (0)1 44 27 48 57
75005 Paris, France.                  FAX  : +33 (0)1 44 27 68 14
http://petitjeanmichel.free.fr/itoweb.petitjean.html
http://petitjeanmichel.free.fr/itoweb.petitjean.freeware.html

Boris Gorelik <bgbg[at]pob.huji.ac.il> wrote:
>Dear All,
>We are trying to sample all possible rotations of a rigid ligand in a discrete 
>3D space. We define the rotation using a1x, a2x, a3x and A, where 
>(a1x,a2x,a3x) is the unit vector in the direction of the axis and A is the 
>angle of rotation in radians. The unit vector is defined by two degrees of 
>freedom namely: spherical angles theta and phi, and is calculated from them.
>We are using the rotate function from the BTL package 
>(http://bioinformatics.org/project/?group_id=184)
>Unfortunately, sometimes we get identical conformations, while using different 
>input to the function. How can this problem can be avoided?
>
>Every idea will be highly appreciated
>
>PS
>Some additional details:
>we use discrete value for phi, theta and A:
>0<phi<2*PI, 
>0<A<2*PI, 
>0<theta<PI
>
>a1x=sin(theta)*cos(phi),
>a2x=sin(theta)*sin(phi),
>a3x=cos(theta).
>
>The rotate function is based on the following rotation matrix:
>[cosA+a1x.a1x(1-cosA)      -a3xsinA+a1a2(1-cosA)	a2xsinA+a1xa3x(1-cosA) ]
>[a3xsinA+a1xa2(1-cosA)    cosA+a2xa2x(1-cosA)   	-a1xsinA+a2xa3x(1-cosA)]
>[-a2xsinA+a3xa1x(1-cosA)   a1xsinA+(1-cosA)a2xa3x 	cosA+(1-cosA)a3xa3x   ]
>-- 
>Boris Gorelik
>-= ( 2*b || !(2*b)) That's the question =-
>Sun, 29/Jun/2003, 30 Sivan 5763
>-------------------------------------------------
>! Molecular Modelling Group !
>! Pharmacy School, Hadassa Faculty of medicine !
>! The Hebrew University of Jerusalem !
>! http://www.md.huji.ac.il/models/group.html !
>!
>!------------------------------------------------