research papers
Coordinate transformations in modern crystallographic computing
aDepartment of Biochemistry, UT Southwestern Medical Center at Dallas, 5323 Harry Hines Boulevard, Dallas, TX 75390-9038, USA
*Correspondence e-mail: zbyszek@chop.swmed.edu
A review of 4 × 4-matrix notation and of tensor formalism focused on crystallographic applications is presented. A discussion of examples shows how this notation simplifies tasks encountered in crystallographic computing.
Keywords: matrix notation; tensor formalism; coordinate transformations.
1. Introduction
This paper presents a summary of tensor formalism, which is very important in crystallography, and especially in crystallographic computations. Most of the material described here is well known but was published in very old books and papers (Einstein, 1916; Seitz, 1936; Bienenstock & Ewald, 1962; Bradley & Cracknell, 1972; Hall, 1981 etc.). We feel that it is high time to recall this formalism in a review focused on its application to crystallographic computing and adaptation to high-level programming languages.
Crystallography deals with objects defined in various coordinate systems, e.g. the fractional coordinate system (used for data or symmetry operators), the grid coordinate system (in which computations are done), the Protein Data Bank (PDB) coordinate system, or the graphics coordinate system (used to display data on a computer screen). Moreover, these objects may have different transformation properties.
Distinguishing mathematical objects with respect to their transformation properties is very important when writing crystallographic software. In particular, keeping track of coordinate systems and transformation properties of variables allows for more efficient and less error-prone programming.
The importance of consistency in notation for further development of the field has been recognized by the IUCr by appointing the Commission on Crystallographic Nomenclature. In one of their reports (Trueblood et al., 1996), a uniform notation for atomic displacement parameters is proposed, including distinguishing between contravariant and covariant quantities. The present article follows this recommendation by providing a review of a uniform notation for coordinate changes for all crystallographic quantities.
A natural way of coupling program variables to their crystallographic properties is the object-oriented programming style. With its use, one can implicitly define operations allowed for each type of variable. Operations explicitly defined for one coordinate system may be implicitly extended to other cases by the compiler. This is especially important when new functionality is added to an already existing application. In the present paper, we recall a mathematical formalism, which can be naturally used for defining classes of basic objects encountered in crystallographic calculations. We start by presenting a consistent representation for the basic variable types encountered in crystallography (§§2 and 3). Later, we discuss more complex applications and demonstrate how this notation works. This will include examples of defining view-ports for graphics display and transforming the anisotropic temperature factor. These rules apply to both real and reciprocal space, including calculation of derivatives.
2. Crystallographic 4-vector notation
In this section, we present the 4-vector notation, which proves very useful for changing coordinate systems in crystallography. For the purposes of this section, it is enough to distinguish between vectors and covectors. A more detailed discussion of covariant and contravariant quantities will be presented in §3.
2.1. Real-space 4-vector notation
The real-space 4-vector notation is well known in crystallography (Hahn, 1995; Hall, 1981) as well as in general computing (Bradley & Cracknell, 1972; Seitz, 1936). Throughout the paper, we will write 3-vectors and 3-matrices in bold type and 4-vectors and 4-matrices in bold-italic type. Let
where is a real-space vector. Let denote a
operator. operators are isometries. They can be represented as a superposition of a matrix (with ) and a non-primitive translation by vector . Then, the symmetry operator transforms a vector in the real space as follows:One can represent the transformation as a 4×4 matrix as follows:
In this notation, the action of is represented by multiplication only:
The composition of two isometries is traditionally described by a somewhat complicated formula
In the 4-vector notation, a composition of transformations is expressed as a multiplication of their corresponding 4×4 matrices:
A consequence of this equation is another convenient feature of this notation:
where
Note that and
Moreover,
which allows us to use the determinant of in place of the determinant of , for example when distinguishing between rotations and reflections.
2.2. Reciprocal-space 4-vector notation
The convention presented in this subsection has been partially described by Bienenstock & Ewald (1962) and was subsequently used by Ten Eyck (1973). However, they did not distinguish between vectors and covectors, and consequently the transposed form of the symmetry operator had to be used in the We present a means of keeping the same form of the symmetry operator in both real and The data in the real space, , are related to the reciprocal-space data by the Fourier transform defined by
In the
we will use a 4-vector notation as well. Vectors from transform differently to real-space vectors. To distinguish them, we will call reciprocal-space vectors (and any other vectors transforming in the same way) covectors and we will write vectors as columns and covectors as rows. A detailed discussion of vectors and covectors will follow in the next section. As in the real-space case, 3-covectors can be extended to 4-covectors. Unlike in the real space, the last entry in such a 4-covector is generally different from 1:The symbol denotes a phase angle associated with the vector (calculations involving will be performed modulo 1). The meaning of the symbol is the following:
Note that this definition should be changed if a different Fourier transform definition is used. In this setting, the action of a symmetry operator (which corresponds to the action of in the real space) in the :
can be described simply by multiplying a general 4-covector by the matrix of , as introduced by (1)where denotes the usual scalar product. Note that, owing to the special property of matrix [see equation (2)], one can use instead of in equation (5). However, this cannot be done for non-orthogonal (see discussion in §3). The symmetry operator in the is represented by the same matrix as in the real space (transposition not needed).
Let us show how our notation works with the Fourier transform. The symmetry operator acting on vectors in the real space induces a corresponding operator acting in the ; Rowicka et al., 2003)
on the Fourier transforms of the real-space functions. Let denote the Fourier transform of a function . Then (Bricogne, 1993Using (5) and (3), we can compute
Furthermore,
Thus we have shown that in our formalism the description of the interaction between
and the Fourier transform has the formwhich is better suited for description of the composition of multiple affine transformations than the traditionally used equation (5).
3. Covariant and contravariant quantities
Vectors and tensors in crystallography were quite extensively dealt with by Patterson (1959) and Sands (1982). In this section, we outline the theory of transformation first, and then we show how to extend and apply that theory to the 4-vector notation.
3.1. Scalars, vectors and covectors
Depending on their transformation properties, objects encountered in crystallography can be classified as scalars, vectors, covectors, covariant or contravariant tensors etc. (see Tables 1 and 2).
|
|
By definition, scalars are quantities that remain invariant during coordinate changes.
In the previous section, we were distinguishing between vectors and covectors with no thorough explanation, now we will discuss this subject in more detail.
The difference between a vector and a covector is in how they behave during coordinate changes. Let xi denote coordinates of a vector (such as a position vector of an atom), expressed in a certain basis (for example, in the crystallographic basis , and : ). Let us consider a coordinate change from the coordinates xi (i = 1,2,3) to the coordinates , given by functions fi,
such that the coordinate change (6) is invertible. Then, the relationship between the differentials of the new coordinates and the differentials of the old ones is the following:
where . From now on, we shall use the Einstein summation convention (Einstein, 1916): if an index appears twice in an expression, once as a subscript and once as a superscript, a summation over this index is thereby implied and the summation sign is suppressed. For example, within this convention, equation (7) reads
where the implicit sum is over j = 1,2,3. The repeating indices are often called dummy indices. In what follows, we will use the Einstein notation extensively, instead of using transposed matrices etc.
The components of a vector are transformed in the same way as differentials of coordinates [see equation (8)]. By definition, such quantities are called contravariant and are denoted by superscripts. They transform as basis vectors of the dual base, that is in crystallography as the reciprocal-lattice basis vectors , and .
One can compute the derivatives of a scalar a with respect to the new and old coordinates. Their relationship is the following:
where [hji] is the inverse of the matrix [ fij]:
Quantities transformed as derivatives with respect to coordinates are called covariant. Vectors whose components transform in the same way are called covectors. In crystallography, covariant quantities are reflection indices hkl. Covectors transform as the basis vectors, in crystallography as the direct-lattice basis vectors , and . It is now obvious that derivatives of a scalar with respect to components of a vector form a covector.
Crystallographic examples and transformation properties of vectors and covectors are provided in Table 1.
3.2. Tensors
Let d be the dimensionality of the space. Objects consisting of dN components that transform as products of k covariant quantities and l contravariant quantities, where k+l = N, are called k-covariant l-contravariant Nth-order tensors. In general, many quantities may be viewed as tensors: scalars are tensors of order zero, vectors are contravariant tensors of order one, while covectors are covariant first-order tensors. Usually, the term tensor is applied only to tensors of order two or higher.
For example, a second-order contravariant tensor Tij would be transformed as
The second-order covariant tensor Tij transforms as
The second-order tensor Tij with both covariant and contravariant components would transform as
Crystallographic examples and transformation properties of second-order covariant and contravariant tensors are provided in Table 2.
3.3. Transformation of coordinates in 4-vector notation
In our notation, the fourth component of a vector is of a different nature to the other ones, in particular, in the real space it always equals 1. Therefore, in the real space, the only coordinate transformations that are allowed are such that preserve the fourth component. In the notation introduced in the previous section, this condition restricts the form of the coordinate changes to
We need to introduce a convention to define a derivative with respect to this fourth coordinate. It is crucial that, with the assumed convention, the transformation properties of the fourth component are compatible with those of the first three coordinates. In this paper, we show that a good choice is to assume
and
The Kronecker symbol is defined as follows:
3.3.1. Affine transformations
Most coordinate systems used in crystallography are related by affine transformations.1 By affine transformation, we understand a transformation such that, for any 3-vector ,
In the 4-vector notation, such an is given by
Here, in contrast to the , the matrix is a general invertible matrix. In particular, affine transformations may not preserve distances (i.e. be non-orthogonal) or they may not preserve angles (i.e. be non-conformal).
operator given by equation (1)The 4-vector notation allows simplification of affine transformations of vectors and covectors. For a 4-vector , its transformed coordinates are related to the original coordinates by
where is given by equation (13). In the matrix form,
On the other hand, a 4-covector transforms as follows:
where
In the matrix form, the transformation of a covector reads
Observe that, during an affine transformation of a covector, the fourth component of the transformed covector changes, in contrast to the case of vectors. The reason is that, in the covariant (reciprocal) space, the translational part of is not realized as translation of coordinates but as phase shift, in the sense of equations (3), (4) and (5).
Many objects encountered in crystallography can be described by quadratic forms (cf. Table 2). Affine transformations of symmetric tensors corresponding to quadratic forms can also be simplified by the 4-vector notation. A quadratic form is defined by
where is a symmetric matrix. Provided that is a contravariant vector, the matrix transforms as a 2-order covariant tensor. In order to perform affine transformations of tensors conveniently, we switch to the 4-vector notation. This will involve extending 3×3 tensors to 4×4 tensors, compatible with the 4-vectors and 4-covectors introduced in §§2.1 and 2.2, respectively. Quadratic forms are commonly applied to describing quadratic surfaces. In three dimensions, the general equation of a quadratic surface centered at is given by
where c is a real number.
We propose a simpler form of the general quadratic surface equation:
where
Let be an affine transformation given by (13). Then will transform as follows:
Using formula (19), one can compute that has the same form as . Namely,
where
As expected, the 3×3 tensor transforms as a second-order covariant tensor. Observe also that the transformed quadratic form corresponds to a surface centered at , that is the image of , the center of the surface related to the original form .
In some cases, the quantity of interest in (17) is defined by the inverse of a given matrix. Then we can rewrite (17) with :
In the 4-vector notation,
and
It follows that
Observe that is a contravariant tensor, whereas is a covariant one.
One can also define a quadratic form for a covector by
The corresponding matrix transforms as a 2-order contravariant tensor. However, in this case, there will be no quadratic surfaces centered at . The intuitive explanation is the same as in the case of the affinely transformed covector: in the covariant space (such as the
space of normal covectors or space of derivatives), translation of the coordinates is not possible. Therefore, the centers of the quadratic surfaces in the covariant space do not change during affine transformations. For simplicity, we consider in the only quadratic surfaces that are centered at . This leads to the following definition of the symbol in the 4-vector notation:The symbol encoding the form transforms as a contravariant second-order four-dimensional tensor
In matrix notation,
where
4. Examples
Now we will show several examples of our notation facilitating issues encountered in practice.
4.1. 3D graphics view-port: definition and transformations
In graphical rendering programs, one has to define a view-port, that is a region of considered space that is displayed at a given moment. Below we discuss two widely used types of view-ports and show how easily one can perform affine (i.e. in general not orthogonal) transformation of them using our notation.
4.1.1. Polyhedral view-ports
The most commonly used type of view-port has the shape of a polyhedron, i.e. a volume delimited by a number of polygons. An example of a polyhedron specific to crystallography is the A convenient way of defining a polyhedral view-port is by listing a number of (usually six) cutting planes, with distinguishable sides. In fact, this is how the standard asymmetric units are defined in International Tables for Crystallography (Hahn, 1995). For a plane , its positive side will be identified with the half-space , which contains the view-port. A point belongs to the view-port when it belongs to all half-spaces defining it,
The condition for a point to belong to a positive half-space can be described by four numbers, a, b, c and d:
In particular, one can describe such a half-space by giving a point with coordinates (p1,p2,p3), belonging to the cutting plane, and providing three numbers a, b and c that specify the orientation of the plane. Then,
From the above equation, it follows that a, b, c transform as components of a covector. Let us denote this three-dimensional covector by . Observe that is normal to the cutting plane and it points towards the inside of the view-port.
We will now switch to 4-vector notation and demonstrate how easily affine transformations of the thus defined view-port can be performed within the 4-vector formalism. In this notation, is a 4-covector:
Now, the condition for a 4-vector
to belong to the half-space reads
where the implicit summation is over . Let us transform the coordinates by an affine transformation . The transformed coordinates are related to the original coordinates according to equation (14), the coordinates of transform as in equation (15). Let us show that condition (25) is preserved during this transformation:
This proves that the description of view-port cutting planes by points from these planes and normal covectors is invariant with respect to affine transformations.
To show how it works in practice, we shall now give a simple example of this procedure. Let us consider an affine transformation given for a point by
Let be the half-space described by the point and the covector (see Fig. 1), according to the inequality (23):
In the 4-vector notation,
Moreover,
To transform the covector , we need to invert first:
After the transformation by , the half space will be defined by the following 4-covector :
Observe that, from the fourth component of , one can recover coordinates of points belonging to the transformed cutting plane (we need this to know where to anchor the normal covector ). According to the formula (24),
The above is satisfied in particular by
The transformed , and are presented in the center panel of Fig. 1. The lower panel shows the consequences of transforming incorrectly (that is as a contravariant vector instead of a covector).
The above discussion is only an example of usage of covectors for defining planes. Another example, important in crystallography, is defining lattice planes by their Miller indices.
4.1.2. Spherical view-ports
In some cases, it is convenient to display objects located in the neighborhood of some point . Then, a natural choice for a view-port is a sphere centered at , with a given radius r. In Cartesian coordinates, the condition for to belong to the spherical view-port reads
or, in the Einstein notation,
Here, the 3×3 second-order covariant tensor Gij is trivial, that is . The left-hand side of the definition of the sphere (27) is a quadratic form in the contravariant variable . Hence, it can be encoded into a 4×4 covariant tensor, as in equation (18):
Now the view-port can be defined as simply as:
The left-hand side of the view-port condition (28) transforms as follows:
where is an affine transformation given by equation (1). The transformed tensor defines the image of the sphere (27) in the same manner as the original sphere is encoded in :
The sphere (27) is expressed in the new coordinates by :
Note that we have never used the fact that we are dealing with a sphere and not e.g. with an ellipsoid. This means that the above argument is valid for any quadratic surface.
4.1.3. Transformations of anisotropic atomic temperature factor
Let , with crystallographic coordinates , denote the equilibrium position of an atom. The measured atomic electron density can be described (Giacovazzo et al., 1992) by the convolution of the probability distribution of the equilibrium position of the center of the atom, p, and of the atomic electron density relative to this position, :
The probability p is expressed in crystallographic coordinates relative to the center of the atom. In the first approximation of p, we consider only rigid-body thermal motions of an atom. These thermal motions result from many interactions. Therefore, from the central limit theorem, it follows that they can be well described by an anisotropic Gaussian distribution:
where is the variance–covariance matrix, that is , where denotes mean values of xi xj. Since is expressed in coordinates relative to the center of the atom, clearly it does not change with translations (see also discussion in §3.3.1). Under rotations, the tensor transforms as a contravariant tensor.
On the other hand, is a covariant tensor and transforms according to (19). Note that the equation
describes a quadratic surface of constant probability. Since we consider only localized atoms, the only allowed type of surface is an ellipsoid. Therefore, all eigenvalues of the matrix [(U-1)ij] must be positive, and so must the eigenvalues of the matrix [Uij].
The ellipsoids of constant probability, or vibrational ellipsoids, are often employed in the graphical description of thermal motions of atoms. The three-dimensional tensor can be extended to the four-dimensional tensor such that equation (32) is preserved during the transformation. This is done as described in §3.3.1. Namely, we extend [(U-1)ij] to as follows:
and transform under affine transformations given by (13) according to (19). Namely, the resulting tensor is
where .
5. Discussion
The main objective of this paper is to summarize a formalism for efficient description of various tasks encountered in computational crystallography. The history of science shows that the right language is often important in the solution of a problem. The best known example is the derivation of Einstein's theory of relativity. The presented approach to describing coordinate system transformations will simplify both presentation and implementation of subjects such as ab initio phasing of macromolecules using and application of the maximum-entropy principle to ensure positive definition of the atomic anisotropic temperature factors. This paper forms a foundation for designing object classes that will be a part of a versatile crystallographic library.
Footnotes
1Except for radial coordinate systems used in Bessel-function expansion, which will be treated elsewhere.
Acknowledgements
The authors are grateful to the referees for helpful suggestions. This research was supported by National Institute of Health grants GM 53163 and GM 62414.
References
Bienenstock, A. & Ewald, P. P. (1962). Acta Cryst. 15, 1253–1261. CrossRef CAS IUCr Journals Web of Science Google Scholar
Bradley, C. J. & Cracknell, A. P. (1972). The Mathematical Theory of Symmetry in Solids. Oxford: Clarendon Press. Google Scholar
Bricogne, G. (1993). In International Tables for Crystallography, Vol. B. Dordrecht: Kluwer Academic Publishers. Google Scholar
Einstein, A. (1916). Ann. Phys. (Leipzig), 49, 769. CrossRef Google Scholar
Giacovazzo, C., Monaco, H. L., Viterbo, D., Scordari, F., Gill, G., Zanotti, G. & Catti, M. (1992). Fundamentals of Crystallography. Oxford Science Publications. Google Scholar
Hahn, T. (1995). Editor. International Tables for Crystallography, Vol A. Dordrecht: Kluwer Academic Publishers. Google Scholar
Hall, S. (1981). Acta Cryst. A37, 517–525. CrossRef CAS IUCr Journals Web of Science Google Scholar
Patterson, A. (1959). In International Tables for X-ray Crystallography, Vol. II. Birmingham: Kynoch Press. Google Scholar
Rowicka, M., Kudlicki, A. & Otwinowski, Z. (2003). Acta Cryst. A59, 172–182. Web of Science CrossRef CAS IUCr Journals Google Scholar
Sands, D. (1982). Vectors and Tensors in Crystallography. Reading, MA: Addison-Wesley. Google Scholar
Seitz, F. (1936). Ann. Math. 37, 17–28. CrossRef Google Scholar
Ten Eyck, L. (1973). Acta Cryst. A29, 183–191. CrossRef IUCr Journals Web of Science Google Scholar
Trueblood, K. N., Bürgi, H.-B., Burzlaff, H., Dunitz, J. D., Gramaccioli, C. M., Schulz, H. H., Shmueli, U. & Abrahams, S. C. (1996). Acta Cryst. A52, 770–781. CrossRef CAS Web of Science IUCr Journals Google Scholar
© International Union of Crystallography. Prior permission is not required to reproduce short quotations, tables and figures from this article, provided the original authors and source are cited. For more information, click here.