# Initial conditions – uniform random rotations

In theoretical chemistry we often simulate dynamics by propagating trajectories on potential energy surfaces. From these trajectories one can derive, e.g. a reaction rate constant. For each trajectories, initial conditions, i.e velocities and coordinates, need to be defined for the molecules. One interesting part of the process is defining uniformly distributed random rotations in three dimensions (uniform distribution on SO(3)).  In fact usually we want to give the molecules a random rotation. For a detailed theoretical description of this, please see e.g. Ref [1].

At first, one may be tempted to extract three random Euler angles $\alpha, \beta$ and $\gamma$, each from a uniform distribution and to compute the rotation matrix R as $\sf{R=R_x(\alpha)\cdot R_y(\beta) \cdot R_z(\gamma)}$. If this procedure is repeated, a set of random matrices will be obtained. However, this set will not be uniformly distributed. In fact, if we take a vector $v=(1,0,0)$ and rotate it 1000 times using the above procedure, where angles are extracted from uniform distributions $\alpha,\gamma\in[-\pi,\pi]$ and $\beta\in[-\pi/2,\pi/2]$ we get

We can see a higher density of points around the north and south poles. This happens because in three dimensions, the Haar measure of a matrix R in SO(3) can be written as $[dR]=cos\beta d\beta d\alpha d\gamma$. The cosine term is fundamental. If we do not take it into account when sampling  $\beta$, as we get closer to the poles, circles have a smaller circumference than near the equator thus if the $\beta$ angle is sampled uniformly one gets more rotations in those locations (see e.g. Ref. [2]).

One of the solutions was proposed by Arvos (Ref. [3]): “To generate uniformly distributed random rotations of a unit sphere, first perform a random rotation about the vertical axis, then rotate the north pole to a random position.”   This is straightforward to implement and we can see (image below) that indeed we get a uniform distribution of rotations

Also, we can extract the angles from the random matrices and see that the distributions are as expected

Now we can apply this to a molecule and generate uniformly distributed rotations. I will show an image of this in the next post!

[1] David Kirk, Graphic Gems III, San Diego: Academic Press Professional (1992).

[2] John T. Kent and Asaad M. Ganeiber: Simulation of random rotation matrices, Events and Meetings of Italian Statistical Society, 46th scientific meeting of the Italian statistical society (2012).

[3] James Arvo, Fast random rotation matrices, Graphics Gems III, p117-120 (2012).