Rotations and rotation matrices

# 2001 International Union of Crystallography Printed in Denmark ± all rights reserved In molecular replacement, a model, described as a list of orthogonal coordinates, is to be moved into a new position and orientation. The orthogonal coordinate system also has to be related to the crystallographic system, which may not be orthogonal, and crystallographic symmetry must be considered, which applies to coordinates expressed as fractions of the unit cell. Elementary properties of rotation matrices and their representation as polar or Eulerian angles are discussed. Received 13 February 2001 Accepted 12 June 2001


Introduction
In the search process implicit in molecular replacement, a known model structure is rotated and translated into all possible orientations and positions for comparison with diffraction data for an unknown structure. This needs a mathematical description of the rotation and translation operations. In a Cartesian coordinate system, translations are straightforward, but rotations are not and their description is often confusing for the novice. This paper tries to provide an elementary introduction to rotations. This material is discussed with much more rigour and much greater detail in many places, including mathematical textbooks and in several articles in International Tables for Crystallography, Volume B, notably in the article by Diamond (1993).

Rotations and translations
The transformation of a positional vector x i describing the ith atom in a molecule can be written as a multiplication of the vector by a rotation matrix R and addition of a translation vector t. For this purpose, we work in an orthogonal Cartesian system in a Ê ngstro È ms: conversion to fractional crystallographic coordinates is discussed in x6. The new positional vector x H i is then given by Translations are not usually confusing, except that the order of rotation and translation matters. Rotating then translating by a vector t is not the same as translating by a vector s then rotating: the rotation operation remains the same but the translation vector needs to be rotated, t RsX

Rotation matrices
A rotation matrix transforms the set of coordinates representing a three-dimensional object, in an orthogonal Cartesian frame, without changing its shape or size, i.e. the length of any vector and the angle between any pair of vectors are unchanged. Such a matrix is called orthonormal and has several properties which follow from this de®nition.

The columns of a rotation matrix are orthogonal unit vectors
A rotation matrix may transform any set of vectors, so we can consider transforming the three unit vectors along the x, y and z axes, which by de®nition are orthogonal to each other.
Since the starting vectors x, y, z are orthogonal and of unit length, then the resultant vectors r 1 , r 2 , r 3 must be also; these are the columns of the rotation matrix R.

The transpose of a rotation matrix is its inverse
Premultiplying the rotation matrix R by its transpose R T (in which the columns of R become the rows of R T ), Since r 1 , r 2 and r 3 are orthogonal unit vectors, then r 1 Ár 1 = 1, r 1 Ár 2 = 0 etc. (generally r i Ár j = ij ), thus hence R T = R À1 , since this is the de®nition of an inverse matrix R À1 .

The rows of a rotation matrix are orthogonal unit vectors
This follows from xx3.1 and 3.2, since the inverse (transposed) matrix must also be a rotation matrix, representing a rotation in exactly the opposite direction.

The determinant of a rotation matrix = +1
The determinant of a matrix is the triple product of its column vectors, r 1 Á(r 2 Â r 3 ). This also corresponds to the volume of the parallelopiped with these vectors as edges. If the columns are orthogonal unit vectors, the determinant will be AE1. Considering the equation in x3.1, the volume of the parallelopiped de®ned by the unit matrix is +1, so for R to be a rotation matrix its determinant must also be +1. An orthogonal matrix with determinant À1 corresponds to an inversion: such a matrix may for example be obtained by interchanging any two columns or rows of a rotation matrix.

Rotations and angles
A rotational transformation is uniquely de®ned by a rotation matrix, but the natural expression of a rotation is as an angle; if we wish to enumerate all possible rotations for a systematic search, then angles are the usual way of doing this. However, a  rotation may be expressed as angles in many different ways and this can be confusing. Within one program system it is not usually essential to understand the convention used, but it is essential when converting to another system. There are a number of programs available for converting conventions, including CONVROT (Urzhumtseva & Urzhumtsev, 1997) and ROTMAT from the CCP4 suite (Collaborative Computational Project, Number 4, 1994). Since the matrix itself is unique, conversions may be performed by generating the matrix from angles in one convention and decomposing the matrix into angles in the new convention.
In two dimensions, a single angle de®nes a rotation (Fig. 1a). We can write the transformation as a 2 Â 2 matrix, Note that this already implies a convention: that is measured from x towards y. As an alternative to rotating the object, we can consider rotating the coordinate frame by an equal amount in the opposite direction, i.e by À (Fig. 1b). In using angles produced by computer programs, it is important to know which convention the author has used. Extending this to three dimensions, we can write down rotation matrices for rotations around the principal axes x, y, z,

Rotation angles in three dimensions
In three dimensions, we need three angles to describe a rotational transformation and to generate the corresponding rotation matrix, but this can be performed in many different ways. The different ways correspond to different starting points for measuring the angle, as in two dimensions, and also to alternative paths from the start point to the end point. Common angular descriptions fall into three classes.
(i) Polar angles. Any rotation may be described as a single rotation around speci®ed axis. One angle describes the rotation, the other two describe the direction of the axis.
(ii) Eulerian angles. The rotation may be described as three successive rotations around principal axes: (a) the ®rst and third rotations are around the same axes, e.g. rotate around z, then around the new y, then the new z or (b) the three rotations are around different axes, e.g. rotate around z, then the new y, then the new x.

Polar angles
Polar angles are perhaps easier to visualize than Eulerian angles, but are algebraically less convenient for many purposes. The convention described is that used by the CCP4 programs and others: rotate by an angle around an axis whose direction is de®ned by angles 3 (sometimes called 2) and 9 (Fig. 2). The direction of the axis may also be written as the components of a unit vector, the direction cosines l, m and n, The rotation matrix may be constructed by ®rst rotating the rotation axis by À9 and À3 to put it along (say) the z axis, then rotating by around z, the ®nally rotating the axis back to its original position by 3 and 9, R R z 9R y 3R z R y À3R z À9 l 2 m 2 n 2 cos lm1 À cos À n sin lm1 À cos n sin m 2 n 2 l 2 cos nl1 À cos À m sin mn1 À cos l sin P T R nl1 À cos m sin mn1 À cos À l sin n 2 l 2 m 2 cos Q U SX 5.1.1. Decomposing a matrix into polar angles. The rotation angle can be derived from the trace, i.e. the sum of the diagonal elements, Trace R 11 R 22 R 33 l 2 m 2 n 2 2 l 2 m 2 n 2 À Á cos 1 2 cos X In the general case, l, m and n, and hence 9 and 3, can be calculated from the off-diagonal elements: R 32 À R 23 = 2lsin ; R 13 À R 31 = 2m sin ; R 21 À R 12 = 2n sin . Note that the full De®nition of polar angles, rotation by about an axis whose direction is de®ned by the angles 3 and 9.
range of rotations can be generated with angles , 3, 9 either in the range À% < < %, 0 < 3 < %/2, 0 < 9 < 2% or in the range 0 < < %, 0 < 3 < %, 0 < 9 < 2%, since the same matrix is generated by (À , % À 3, % + 9) as from ( , 3, 9). This decomposition does not work if sin = 0 (i.e. = 0 or %). If = 0, there is no rotation and 9 and 3 can take any value. If = % (180 ), then the matrix simpli®es to 2 sin 2 3 cos 2 9 À 1 2 sin 2 3 sin 9 cos 9 2 sin 3 cos 3 cos 9 2 sin 2 3 sin 9 cos 9 2 sin 2 3 sin 2 9 À 1 2 sin 3 cos 3 sin 9 2 sin 3 cos 3 cos 9 2 sin 3 cos 3 sin 9 2 cos 2 3 À 1 H d I e and the off-diagonal elements are all zero for rotations of % around x, y or z. Note that for a rotation of % or 180 , the matrix is symmetric: this must be so, since a rotation by +% is identical to a rotation by À%, so the rotation matrix is the same as its inverse, i.e. R = R À1 = R T . All angular decompositions have special cases where some angles are indeterminate or where the simplest method of decomposition fails. This is typically when all off-diagonal terms are zero, i.e. either no rotation (the identity matrix) or a rotation of 180 around x, y or z.

Eulerian angles
Eulerian angles are algebraically simpler than polar angles, since we just rotate successively around three principal axes. For instance, the convention used in AMoRe (Navaza, 1994) and other CCP4 programs (Collaborative Computational Project, Number 4, 1994) is to rotate by around z, then by around the new y, then by around the new z again, cos cos cos À sin sin À cos cos sin À sin cos cos sin sin cos cos cos sin À sin cos sin cos cos sin sin À sin cos sin sin cos H f d

I g eX
Note that if = 0 or %, the central matrix is diagonal, so rotations about and have exactly the same effect (or exactly opposite effect if = %). In these cases, only the combination + or À is determined.

Interaction with crystallographic symmetry
When superimposing a known model on an unknown structure in a crystal, equivalent solutions will be found for each An example of crystallographic symmetry: space group P3. The directions of the orthogonal axes are x along a, y along c* Â a, z along c*. There are three possible solutions related by the threefold axis.

Figure 4
A non-crystallographic dyad axis parallel to a crystallographic screw dyad gives rise to a non-crystallographic translation which will produce a peak in the native Patterson function. Molecules related by this translation are shaded in the same way. molecule in the crystal, but it is not always obvious from the angles which alternate solutions are equivalent by crystallographic symmetry. Crystallographic symmetry is expressed as operations working on fractional cell coordinates, which are referred to crystal axes which are not necessarily orthogonal. For example, in Fig. 3, in space group P3, there are three solutions equivalent by the three crystallographic symmetry operations (x, y, z), (Ày, x À y, z) and (y À x, Àx, z). To combine these operators with the rotation matrices de®ning the solution, which work on orthogonal coordinates, we need the conversion matrices from orthogonal coordinates x o to fractional coordinates x f and its inverse, such that x f = Fx o . In the most common convention (x, y, z along a, c* Â a, c*), Then, if the rotation from the model to molecule 1 is given by R, the three solutions are given by R j = F À1 S j FR, for j = 1, 3, where S j is the matrix corresponding to the jth crystallographic symmetry operator, e.g.
in this case. Computer programs will usually identify solutions related by crystallographic symmetry or just present the user with a unique set.

Non-crystallographic symmetry
Multiple solutions to a molecular-replacement search may also be produced by non-crystallographic symmetry. Unlike crystallographic symmetry, this is not generally known in advance, so no special relationship can be assumed. A common special case arises when a non-crystallographic rotation is parallel or nearly parallel to a crystallographic axis of the same order. In this case, the combination creates a non-crystallographic translation relating all atoms, which should be detectable in the native Patterson function. Either axis may contain a screw component. For example, in Fig. 4 the combination of a crystallographic screw dyad and a non-crystallographic dyad creates a pure translation. The native Patterson function should always be examined for non-crystallographic translations.

Conclusions
Descriptions of rotations in terms of three angles can be confusing and in all conventions the angles have inconvenient properties of non-equivalence in the variables and singularities at certain points. Alternative descriptions exist in terms of variables other than angles, such as`rotation vectors' or quaternions; these may have advantages in some circumstances, but have been less commonly used than angle descriptions. Three alternative descriptions are discussed, for example, by Diamond (1993).