Information in this page is valid for spglib 1.8.1 or later. The definitions of transformation matrix and origin shift were different in the previous versions.

- References
- Basis vectors \((\mathbf{a}, \mathbf{b}, \mathbf{c})\) or \((\mathbf{a}_1, \mathbf{a}_2, \mathbf{a}_3)\)
- Atomic point coordinates \(\boldsymbol{x}\)
- Symmetry operation \((\boldsymbol{W}, \boldsymbol{w})\)
- Transformation matrix \(\boldsymbol{P}\) and origin shift \(\boldsymbol{p}\)
- Conventions of standardized unit cell

Some references about crystallographic definitions and conventions are shown below. Though spglib may not follow them fully, it doesn’t mean spglib doesn’t respect them, rather it is due to the lack of understanding by the author of spglib.

- International Tables for Crystallography.
- Bilbao Crystallographic Server. The references of many useful papers are found at http://www.cryst.ehu.es/wiki/index.php/Articles.
- Ulrich Müller, “Symmetry Relationships between Crystal Structures”
- E. Parthé, K. Cenzual, and R. E. Gladyshevskii, “Standardization of
crystal structure data as an aid to the classification of crystal
structure types”, Journal of Alloys and Compounds,
**197**, 291-301 (1993). [doi2] - E. Parthé and L. M. Gelato, “The ’best’ unit cell for monoclinic
structures consistent with b axis unique and cell choice 1
of international tables for crystallography (1983)”, Acta
Cryst. A
**41**, 142-151 (1985) [doi3] - E. Parthé and L. M. Gelato, “The standardization of inorganic
crystal-structure data”, Acta Cryst. A
**40**, 169-183 (1984) [doi4] - S. Hall, “Space-group notation with an explicit origin”, Acta
Cryst. A
**37**, 517-525 (1981) [doi1]

In spglib, basis vectors are represented by three column vectors:

\[\begin{split}\mathbf{a}= \begin{pmatrix}
a_x \\
a_y \\
a_z \\
\end{pmatrix},
\mathbf{b}= \begin{pmatrix}
b_x \\
b_y \\
b_z \\
\end{pmatrix},
\mathbf{c}= \begin{pmatrix}
c_x \\
c_y \\
c_z \\
\end{pmatrix},\end{split}\]

in Cartesian coordinates. Depending on the situation, \((\mathbf{a}_1, \mathbf{a}_2, \mathbf{a}_3)\) is used instead of \((\mathbf{a}, \mathbf{b}, \mathbf{c})\).

Coordinates of an atomic point \(\boldsymbol{x}\) are represented as three fractional values relative to basis vectors as follows,

\[\begin{split}\boldsymbol{x}= \begin{pmatrix}
x_1 \\
x_2 \\
x_3 \\
\end{pmatrix},\end{split}\]

where \(0 \le x_i < 1\). A position vector \(\mathbf{x}\) in Cartesian coordinates is obtained by

\[\mathbf{x} = (\mathbf{a}, \mathbf{b}, \mathbf{c}) \boldsymbol{x}.\]

or

\[\mathbf{x} = \sum_i x_i \mathbf{a}_i.\]

A symmetry operation consists of a pair of the rotation part \(\boldsymbol{W}\) and translation part \(\boldsymbol{w}\), and is represented as \((\boldsymbol{W}, \boldsymbol{w})\) in the spglib document. The symmetry operation transfers \(\boldsymbol{x}\) to \(\tilde{\boldsymbol{x}}\) as follows:

\[\tilde{\boldsymbol{x}} = \boldsymbol{W}\boldsymbol{x} + \boldsymbol{w}.\]

The transformation matrix \(\boldsymbol{P}\) changes choice of basis vectors as follows

\[( \mathbf{a} \; \mathbf{b} \; \mathbf{c} )
= ( \mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \;
\mathbf{c}_\mathrm{s} ) \boldsymbol{P},\]

where \(( \mathbf{a} \; \mathbf{b} \; \mathbf{c} )\) and \((
\mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \;
\mathbf{c}_\mathrm{s} )\) are the basis vectors of an arbitrary system
and of a starndardized system, respectively. Transformation matrix
**doesn’t** rotate a crystal in Cartesian coordinates, but just
changes the choices of basis vectors.

The origin shift \(\boldsymbol{p}\) gives the vector from the origin of the standardized system \(\boldsymbol{O}_\mathrm{s}\) to the origin of the arbitrary system \(\boldsymbol{O}\),

\[\boldsymbol{p} = \boldsymbol{O} - \boldsymbol{O}_\mathrm{s}.\]

Origin shift **doesn’t** move a crystal in Cartesian coordinates, but
just changes the origin to measure the coordinates of atomic points.

A change of basis is described by the combination of the transformation matrix and the origin shift denoted by \((\boldsymbol{P}, \boldsymbol{p})\) where first the transformation matrix is applied and then origin shift. The points in the standardized system \(\boldsymbol{x}_\mathrm{s}\) and arbitrary system \(\boldsymbol{x}\) are related by

\[\boldsymbol{x}_\mathrm{s} = \boldsymbol{P}\boldsymbol{x} +
\boldsymbol{p},\]

or equivalently,

\[\boldsymbol{x} = \boldsymbol{P}^{-1}\boldsymbol{x}_\mathrm{s} -
\boldsymbol{P}^{-1}\boldsymbol{p}.\]

A graphical example is shown below.

(click the figure to enlarge)

In this example,

\[\begin{split}\renewcommand*{\arraystretch}{1.4}
\boldsymbol{P} = \begin{pmatrix}
\frac{1}{2} & \frac{1}{2} & 0 \\
\frac{\bar{1}}{2} & \frac{1}{2} & 0 \\
0 & 0 & 1
\end{pmatrix}.\end{split}\]

Using the APIs `spg_get_dataset`

,
`spg_get_dataset_with_hall_number`

, or `spg_standardize_cell`

, the
starndardized unit cell is obtained. The “starndardized unit cell” in
this document means that the (conventional) unit cell structure is
standardized by the crystal symmetry and lengths of basis vectors.
Crystals are categorized by Hall symbols in 530 different types in
terms of 230 space group types, unique axes, settings, and cell
choices. Moreover in spglib, lengths of basis vectors are used to
choose the order of \((\mathbf{a}, \mathbf{b}, \mathbf{c})\) if
the order can not be determined only by the symmetrical conventions.

In the standardized unit cells, there are five different centring types available, base centrings of A and C, rhombohedral (R), body centred (I), and face centred (F). The transformation is applied to the standardized unit cell by

\[( \mathbf{a}_\mathrm{p} \; \mathbf{b}_\mathrm{p} \; \mathbf{c}_\mathrm{p} )
= ( \mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \;
\mathbf{c}_\mathrm{s} ) \boldsymbol{P}_\mathrm{c},\]

where \(\mathbf{a}_\mathrm{p}\), \(\mathbf{b}_\mathrm{p}\), and \(\mathbf{c}_\mathrm{p}\) are the basis vectors of the primitive cell and \(\boldsymbol{P}_\mathrm{c}\) is the transformation matrix from the standardized unit cell to the primitive cell. \(\boldsymbol{P}_\mathrm{c}\) for centring types are given as follows:

\[\begin{split}\renewcommand*{\arraystretch}{1.4}
\boldsymbol{P}_\mathrm{A} =
\begin{pmatrix}
1 & 0 & 0 \\
0 & \frac{1}{2} & \frac{\bar{1}}{2} \\
0 & \frac{1}{2} & \frac{{1}}{2}
\end{pmatrix},
\renewcommand*{\arraystretch}{1.4}
\boldsymbol{P}_\mathrm{C} =
\begin{pmatrix}
\frac{1}{2} & \frac{{1}}{2} & 0 \\
\frac{\bar{1}}{2} & \frac{1}{2} & 0\\
0 & 0 & 1
\end{pmatrix},
\boldsymbol{P}_\mathrm{R} =
\begin{pmatrix}
\frac{2}{3} & \frac{\bar{1}}{3} & \frac{\bar{1}}{3} \\
\frac{1}{3} & \frac{{1}}{3} & \frac{\bar{2}}{3} \\
\frac{1}{3} & \frac{{1}}{3} & \frac{{1}}{3}
\end{pmatrix},
\boldsymbol{P}_\mathrm{I} =
\begin{pmatrix}
\frac{\bar{1}}{2} & \frac{{1}}{2} & \frac{{1}}{2} \\
\frac{{1}}{2} & \frac{\bar{1}}{2} & \frac{{1}}{2} \\
\frac{{1}}{2} & \frac{{1}}{2} & \frac{\bar{1}}{2}
\end{pmatrix},
\boldsymbol{P}_\mathrm{F} =
\begin{pmatrix}
0 & \frac{{1}}{2} & \frac{{1}}{2} \\
\frac{{1}}{2} & 0 & \frac{{1}}{2} \\
\frac{{1}}{2} & \frac{{1}}{2} & 0
\end{pmatrix}.\end{split}\]

For rhombohedral lattice systems with the choice of hexagonal axes, \(\boldsymbol{P}_\mathrm{R}\) is applied.

Spglib allows tolerance parameters to match a slightly distorted unit
cell structure to a space group type with some higher symmetry. Using
obtained symmetry operations, the distortion is removed to idealize
the unit cell structure. The coordinates of atomic points are
idealized using respective site-symmetries (Grosse-Kunstleve *et
al*. (2002)). The basis vectors are idealized by forceing them into
respective lattice shapes as follows. In this treatment, except for
triclinic crystals, crystals can be rotated in Cartesian coordinates,
which is the different type of transformation from that of the
change-of-basis transformation explained above.

- Niggli reduced cell is used for choosing \(\mathbf{a}, \mathbf{b}, \mathbf{c}\).
- \(\mathbf{a}\) is set along \(+x\) direction of Cartesian coordinates.
- \(\mathbf{b}\) is set in \(x\text{-}y\) plane of Cartesian coordinates so that \(\mathbf{a}\times\mathbf{b}\) is along \(+z\) direction of Cartesian coordinates.

- \(b\) axis is taken as the unique axis.
- \(\alpha = 90^\circ\) and \(\gamma = 90^\circ\)
- \(90^\circ < \beta < 120^\circ\).
- \(\mathbf{a}\) is set along \(+x\) direction of Cartesian coordinates.
- \(\mathbf{b}\) is set along \(+y\) direction of Cartesian coordinates.
- \(\mathbf{c}\) is set in \(x\text{-}z\) plane of Cartesian coordinates.

- \(\alpha = \beta = \gamma = 90^\circ\).
- \(\mathbf{a}\) is set along \(+x\) direction of Cartesian coordinates.
- \(\mathbf{b}\) is set along \(+y\) direction of Cartesian coordinates.
- \(\mathbf{c}\) is set along \(+z\) direction of Cartesian coordinates.

- \(\alpha = \beta = \gamma = 90^\circ\).
- \(a=b\).
- \(\mathbf{a}\) is set along \(+x\) direction of Cartesian coordinates.
- \(\mathbf{b}\) is set along \(+y\) direction of Cartesian coordinates.
- \(\mathbf{c}\) is set along \(+z\) direction of Cartesian coordinates.

- \(\alpha = \beta = \gamma\).
- \(a=b=c\).
- Let \(\mathbf{a}\), \(\mathbf{b}\), and \(\mathbf{c}\) projected on \(x\text{-}y\) plane in Cartesian coordinates be \(\mathbf{a}_{xy}\), \(\mathbf{b}_{xy}\), and \(\mathbf{c}_{xy}\), respectively, and their angles be \(\alpha_{xy}\), \(\beta_{xy}\), \(\gamma_{xy}\), respectively.
- Let \(\mathbf{a}\), \(\mathbf{b}\), and \(\mathbf{c}\) projected along \(z\)-axis in Cartesian coordinates be \(\mathbf{a}_{z}\), \(\mathbf{b}_{z}\), and \(\mathbf{c}_{z}\), respectively.
- \(\mathbf{a}_{xy}\) is set along \(+x\) direction of Cartesian coordinates, and \(\mathbf{b}_{xy}\) and \(\mathbf{c}_{xy}\) are placed by angles \(120^\circ\) and \(240^\circ\) from \(\mathbf{a}_{xy}\) counter-clockwise, respectively.
- \(\alpha_{xy} = \beta_{xy} = \gamma_{xy} = 120^\circ\).
- \(a_{xy} = b_{xy} = c_{xy}\).
- \(a_{z} = b_{z} = c_{z}\).

- \(\alpha = \beta = 90^\circ\).
- \(\gamma = 120^\circ\).
- \(a=b\).
- \(\mathbf{a}\) is set along \(+x\) direction of Cartesian coordinates.
- \(\mathbf{b}\) is set in \(x\text{-}y\) plane of Cartesian coordinates.
- \(\mathbf{c}\) is set along \(+z\) direction of Cartesian coordinates.

- \(\alpha = \beta = \gamma = 90^\circ\).
- \(a=b=c\).
- \(\mathbf{a}\) is set along \(+x\) direction of Cartesian coordinates.
- \(\mathbf{b}\) is set along \(+y\) direction of Cartesian coordinates.
- \(\mathbf{c}\) is set along \(+z\) direction of Cartesian coordinates.