# Fractional coordinates

In crystallography, a fractional coordinate system (crystal coordinate system) is a coordinate system in which basis vectors used to describe the space are the lattice vectors of a crystal (periodic) pattern. The selection of an origin and a basis define a unit cell, a parallelotope (i.e., generalization of a parallelogram (2D) or parallelepiped (3D) in higher dimensions) defined by the lattice basis vectors $\mathbf {a} _{1},\mathbf {a} _{2},\dots ,\mathbf {a} _{d}$ where $d$ is the dimension of the space. These basis vectors are described by lattice parameters (lattice constants) consisting of the lengths of the lattice basis vectors $a_{1},a_{2},\dots ,a_{d}$ and the angles between them $\alpha _{1},\alpha _{2},\dots ,\alpha _{\frac {d(d-1)}{2}}$.
Most cases in crystallography involve two- or three-dimensional space. In the three-dimensional case, the basis vectors $\mathbf {a} _{1},\mathbf {a} _{2},\mathbf {a} _{3}$ are commonly displayed as $\mathbf {a} ,\mathbf {b} ,\mathbf {c}$ with their lengths denoted by $a,b,c$ respectively, and the angles denoted by $\alpha ,\beta ,\gamma$, where conventionally, $\alpha$ is the angle between $\mathbf {b}$ and $\mathbf {c}$, $\beta$ is the angle between $\mathbf {c}$ and $\mathbf {a}$, and $\gamma$ is the angle between $\mathbf {a}$ and $\mathbf {b}$.
    A unit cell in 3-dimensions (shown in dashed lines) defined by the three lattice basis vectors $\mathbf {a} _{1}$, $\mathbf {a} _{2}$, and $\mathbf {a} _{3}$ shown within a Cartesian coordinate system.

## Crystal Structure

A crystal structure is defined as the spatial distribution of the atoms within a crystal, usually modeled by the idea of an infinite crystal pattern. An infinite crystal pattern refers to the infinite 3D periodic array which corresponds to a crystal, in which the lengths of the periodicities of the array may not be made arbitrarily small. The geometrical shift which takes a crystal structure coincident with itself is termed a symmetry translation (translation) of the crystal structure. The vector which is related to this shift is called a translation vector $\mathbf {t}$. Since a crystal pattern is periodic, all integer linear combinations of translation vectors are also themselves translation vectors,
$\mathbf {t} =c_{1}\mathbf {t} _{1}+c_{2}\mathbf {t} _{2}{\text{ where }}c_{1},c_{2}\in \mathbb {Z}$

## Lattice

The vector lattice (lattice) $\mathbf {T}$ is defined as the infinite set consisting of all of the translation vectors of a crystal pattern. Each of the vectors in the vector lattice are called lattice vectors. From the vector lattice it is possible to construct a point lattice. This is done by selecting an origin $X_{0}$ with position vector $\mathbf {x} _{0}$. The endpoints $X_{i}$ of each of the vectors $\mathbf {x} _{i}=\mathbf {x} _{0}+\mathbf {t} _{i}$ make up the point lattice of $X_{0}$ and $\mathbf {T}$. Each point in a point lattice has periodicity i.e., each point is identical and has the same surroundings. There exist an infinite number of point lattices for a given vector lattice as any arbitrary origin $X_{0}$ can be chosen and paired with the lattice vectors of the vector lattice. The points or particles that are made coincident with one another through a translation are called translation equivalent.

## Coordinate systems
### General coordinate systems

Usually when describing a space geometrically, a coordinate system is used which consists of a choice of origin and a basis of $d$ linearly independent, non-coplanar basis vectors $\mathbf {a} _{1},\mathbf {a} _{2},\dots ,\mathbf {a} _{d}$, where $d$ is the dimension of the space being described. With reference to this coordinate system, each point in the space can be specified by $d$ coordinates (a coordinate $d$-tuple). The origin has coordinates $(0,0,\dots ,0)$ and an arbitrary point has coordinates $(x_{1},x_{2},...,x_{d})$. The position vector ${\vec {OP}}$ is then,
${\vec {OP}}=\mathbf {x} =\sum _{i=1}^{d}x_{i}\mathbf {a} _{i}$
In $d$-dimensions, the lengths of the basis vectors are denoted $a_{1},a_{2},\dots ,a_{d}$ and the angles between them $\alpha _{1},\alpha _{2},\dots ,\alpha _{\frac {d(d-1)}{2}}$. However, most cases in crystallography involve two- or three-dimensional space in which the basis vectors $\mathbf {a} _{1},\mathbf {a} _{2},\mathbf {a} _{3}$ are commonly displayed as $\mathbf {a} ,\mathbf {b} ,\mathbf {c}$ with their lengths and angles denoted by $a,b,c$ and $\alpha ,\beta ,\gamma$ respectively.

### Cartesian coordinate system

A widely used coordinate system is the Cartesian coordinate system, which consists of orthonormal basis vectors. This means that,
$a_{1}=|\mathbf {a} _{1}|=a_{2}=|\mathbf {a} _{2}|=\dots =a_{d}=|\mathbf {a} _{d}|=1$ and $\alpha _{1}=\alpha _{2}=\dots =\alpha _{\frac {d(d-1)}{2}}=90^{\circ }$
However, when describing objects with crystalline or periodic structure a Cartesian coordinate system is often not the most useful as it does not often reflect the symmetry of the lattice in the simplest manner.

### Fractional (crystal) coordinate system

In crystallography, a fractional coordinate system is used in order to better reflect the symmetry of the underlying lattice of a crystal pattern (or any other periodic pattern in space). In a fractional coordinate system the basis vectors of the coordinate system are chosen to be lattice vectors and the basis is then termed a crystallographic basis (or lattice basis).
In a lattice basis, any lattice vector $\mathbf {t}$ can be represented as,
$\mathbf {t} =\sum _{i=1}^{d}c_{i}\mathbf {a} _{i}{\text{ where }}c_{i}\in \mathbb {Q}$
There are an infinite number of lattice bases for a crystal pattern. However, these can be chosen in such a way that the simplest description of the pattern can be obtained. These bases are used in the International Tables of Crystallography Volume A and are termed conventional bases. A lattice basis $\mathbf {a} _{1},\mathbf {a} _{2},...,\mathbf {a} _{d}$ is called primitive if the basis vectors are lattice vectors and all lattice vectors $\mathbf {t}$ can be expressed as,
$\mathbf {t} =\sum _{i=1}^{d}c_{i}\mathbf {a} _{i}{\text{ where }}c_{i}\in \mathbb {Z}$
However, the conventional basis for a crystal pattern is not always chosen to be primitive. Instead, it is chosen so the number of orthogonal basis vectors is maximized. This results in some of the coefficients of the equations above being fractional. A lattice in which the conventional basis is primitive is called a primitive lattice, while a lattice with a non-primitive conventional basis is called a centered lattice.
The choice of an origin and a basis implies the choice of a unit cell which can further be used to describe a crystal pattern. The unit cell is defined as the parallelotope (i.e., generalization of a parallelogram (2D) or parallelepiped (3D) in higher dimensions) in which the coordinates of all points are such that, $0\leq x_{1},x_{2},\dots ,x_{d}<1$.
Furthermore, points outside of the unit cell can be transformed inside of the unit cell through standardization, the addition or subtraction of integers to the coordinates of points to ensure $0\leq x_{1},x_{2},\dots ,x_{d}<1$. In a fractional coordinate system, the lengths of the basis vectors $\mathbf {a} _{1},\mathbf {a} _{2},...,\mathbf {a} _{d}$ and the angles between them $\alpha _{1},\alpha _{2},\dots ,\alpha _{\frac {d(d-1)}{2}}$ are called the lattice parameters (lattice constants) of the lattice. In two- and three-dimensions, these correspond to the lengths and angles between the edges of the unit cell.
The fractional coordinates of a point in space $\rho =(\rho _{x_{1}},\rho _{x_{2}},\dots ,\rho _{x_{d}})$ in terms of the lattice basis vectors is defined as,
$\rho =\rho _{x_{1}}\mathbf {a} _{1}+\rho _{x_{2}}\mathbf {a} _{2}+\dots +\rho _{x_{d}}\mathbf {a} _{d}{\text{ where }}\rho \in [0,1)$

## Calculations involving the unit cell
### General transformations between fractional and Cartesian coordinates
#### Three Dimensions

The relationship between fractional and Cartesian coordinates can be described by the matrix transformation $\mathbf {r} =\mathbf {A} {\boldsymbol {\rho }}$:
${\begin{pmatrix}r_{x_{1}}\\r_{x_{2}}\\r_{x_{3}}\end{pmatrix}}={\begin{pmatrix}a_{1}\sin(\alpha _{2}){\sqrt {1-(\cot(\alpha _{1})\cot(\alpha _{2})-\csc(\alpha _{1})\csc(\alpha _{2})\cos(\alpha _{3}))^{2}}}&0&0\\a_{1}\csc(\alpha _{1})\cos(\alpha _{3})-a_{1}\cot(\alpha _{1})\cos(\alpha _{2})&a_{2}\sin(\alpha _{1})&0\\a_{1}\cos(\alpha _{2})&a_{2}\cos(\alpha _{1})&a_{3}\\\end{pmatrix}}{\begin{pmatrix}\rho _{x_{1}}\\\rho _{x_{2}}\\\rho _{x_{3}}\end{pmatrix}}$
Similarly, the Cartesian coordinates can be converted back to fractional coordinates using the matrix transformation ${\boldsymbol {\rho }}=\mathbf {A} ^{-1}\mathbf {r}$:
${\begin{pmatrix}\rho _{x_{1}}\\\rho _{x_{2}}\\\rho _{x_{3}}\end{pmatrix}}={\begin{pmatrix}{\frac {\csc(\alpha _{2})}{a_{1}{\sqrt {1-(\cot(\alpha _{1})\cot(\alpha _{2})-\csc(\alpha _{1})\csc(\alpha _{2})\cos(\alpha _{3}))^{2}}}}}&0&0\\{\frac {\csc ^{2}(\alpha _{1})\csc(\alpha _{2})(\cos(\alpha _{1})\cos(\alpha _{2})-\cos(\alpha _{3}))}{a_{2}{\sqrt {1-(\cot(\alpha _{1})\cot(\alpha _{2})-\csc(\alpha _{1})\csc(\alpha _{2})\cos(\alpha _{3}))^{2}}}}}&{\frac {\csc(\alpha _{1})}{a_{2}}}&0\\{\frac {\csc(\alpha )(\cot(\alpha _{1})\csc(\alpha _{2})\cos(\alpha _{3})-\csc(\alpha _{1})\cot(\alpha _{2}))}{a_{3}{\sqrt {1-(\cot(\alpha _{1})\cot(\alpha _{2})-\csc(\alpha _{1})\csc(\alpha _{2})\cos(\alpha _{3}))^{2}}}}}&-{\frac {\cot(\alpha _{1})}{a_{3}}}&{\frac {1}{a_{3}}}\\\end{pmatrix}}{\begin{pmatrix}r_{x_{1}}\\r_{x_{2}}\\r_{x_{3}}\end{pmatrix}}$

### Transformations using the cell tensor

Another common method of converting between fractional and Cartesian coordinates involves the use of a cell tensor $\mathbf {h}$ which contains each of the basis vectors of the space expressed in Cartesian coordinates.

#### Two Dimensions
##### Cell tensor

In Cartesian coordinates the 2 basis vectors are represented by a $2\times 2$ cell tensor $\mathbf {h}$:
$\mathbf {h} ={\begin{pmatrix}\mathbf {a} _{1}&\mathbf {a} _{2}\end{pmatrix}}^{\operatorname {T} }={\begin{pmatrix}a_{1,x_{1}}&a_{1,x_{2}}\\a_{2,x_{1}}&a_{2,x_{2}}\end{pmatrix}}$
The area of the unit cell, $A$, is given by the determinant of the cell matrix:
$A=\det(\mathbf {h} )=a_{1,x_{1}}a_{2,x_{2}}-a_{1,x_{2}}a_{2,x_{2}}$
For the special case of a square or rectangular unit cell, the matrix is diagonal, and we have that:
$A=\det(\mathbf {h} )=a_{1,x_{1}}a_{2,x_{2}}$

##### Relationship between fractional and Cartesian coordinates

The relationship between fractional and Cartesian coordinates can be described by the matrix transformation $\mathbf {r} =\mathbf {h} {\boldsymbol {\rho }}$:
${\begin{pmatrix}r_{x_{1}}\\r_{x_{2}}\end{pmatrix}}={\begin{pmatrix}a_{1,x_{1}}&a_{1,x_{2}}\\a_{2,x_{1}}&a_{2,x_{2}}\end{pmatrix}}{\begin{pmatrix}\rho _{x_{1}}\\\rho _{x_{2}}\end{pmatrix}}$
Similarly, the Cartesian coordinates can be converted back to fractional coordinates using the matrix transformation ${\boldsymbol {\rho }}=\mathbf {h} ^{-1}\mathbf {r}$:
${\begin{pmatrix}\rho _{x_{1}}\\\rho _{x_{2}}\end{pmatrix}}={\begin{pmatrix}a_{1,x_{1}}&a_{1,x_{2}}\\a_{2,x_{1}}&a_{2,x_{2}}\end{pmatrix}}^{-1}{\begin{pmatrix}r_{x_{1}}\\r_{x_{2}}\end{pmatrix}}$

#### Three Dimensions
##### Cell tensor

In Cartesian coordinates the 3 basis vectors are represented by a $3\times 3$ cell tensor $\mathbf {h}$:
$\mathbf {h} ={\begin{pmatrix}\mathbf {a} _{1}&\mathbf {a} _{2}&\mathbf {a} _{3}\end{pmatrix}}^{\operatorname {T} }={\begin{pmatrix}a_{1,x_{1}}&a_{1,x_{2}}&a_{1,x_{3}}\\a_{2,x_{1}}&a_{2,x_{2}}&a_{2,x_{3}}\\a_{3,x_{1}}&a_{3,x_{2}}&a_{3,x_{3}}\end{pmatrix}}$
The volume of the unit cell, $V$, is given by the determinant of the cell tensor:
$V=\det(\mathbf {h} )=a_{1,x_{1}}(a_{2,x_{2}}a_{3,x_{3}}-a_{2,x_{3}}a_{3,x_{2}})-a_{1,x_{2}}(a_{2,x_{1}}a_{3,x_{3}}-a_{2,x_{3}}a_{3,x_{1}})-a_{1,x_{3}}(a_{2,x_{1}}a_{3,x_{2}}-a_{2,x_{2}}a_{3,x_{1}})$
For the special case of a cubic, tetragonal, or orthorhombic cell, the matrix is diagonal, and we have that:
$V=\det(\mathbf {h} )=a_{1,x_{1}}a_{2,x_{2}}a_{3,x_{3}}$

##### Relationship between fractional and Cartesian coordinates

The relationship between fractional and Cartesian coordinates can be described by the matrix transformation $\mathbf {r} =\mathbf {h} {\boldsymbol {\rho }}$:
${\begin{pmatrix}r_{x_{1}}\\r_{x_{2}}\\r_{x_{3}}\end{pmatrix}}={\begin{pmatrix}a_{1,x_{1}}&a_{1,x_{2}}&a_{1,x_{3}}\\a_{2,x_{1}}&a_{2,x_{2}}&a_{2,x_{3}}\\a_{d,x_{1}}&a_{d,x_{2}}&a_{d,x_{d}}\end{pmatrix}}{\begin{pmatrix}\rho _{x_{1}}\\\rho _{x_{2}}\\\rho _{x_{3}}\end{pmatrix}}$
Similarly, the Cartesian coordinates can be converted back to fractional coordinates using the matrix transformation ${\boldsymbol {\rho }}=\mathbf {h} ^{-1}\mathbf {r}$:
${\begin{pmatrix}\rho _{x_{1}}\\\rho _{x_{2}}\\\rho _{x_{3}}\end{pmatrix}}={\begin{pmatrix}a_{1,x_{1}}&a_{1,x_{2}}&a_{1,x_{3}}\\a_{2,x_{1}}&a_{2,x_{2}}&a_{2,x_{3}}\\a_{d,x_{1}}&a_{d,x_{2}}&a_{d,x_{d}}\end{pmatrix}}^{-1}{\begin{pmatrix}r_{x_{1}}\\r_{x_{2}}\\r_{x_{3}}\end{pmatrix}}$

#### Arbitrary number of dimensions
##### Cell tensor

In Cartesian coordinates the $d$ basis vectors are represented by a $d\times d$ cell tensor $\mathbf {h}$:
$\mathbf {h} ={\begin{pmatrix}\mathbf {a} _{1}&\mathbf {a} _{2}&\dots &\mathbf {a} _{d}\end{pmatrix}}^{\operatorname {T} }={\begin{pmatrix}a_{1,x_{1}}&a_{1,x_{2}}&\dots &a_{1,x_{d}}\\a_{2,x_{1}}&a_{2,x_{2}}&\dots &a_{2,x_{d}}\\\vdots &\vdots &\ddots &\vdots \\a_{d,x_{1}}&a_{d,x_{2}}&\dots &a_{d,x_{d}}\end{pmatrix}}$
The hypervolume of the unit cell, $V$, is given by the determinant of the cell tensor:
$V=\det(\mathbf {h} )$

##### Relationship between fractional and Cartesian coordinates

The relationship between fractional and Cartesian coordinates can be described by the matrix transformation $\mathbf {r} =\mathbf {h} {\boldsymbol {\rho }}$:
${\begin{pmatrix}r_{x_{1}}\\r_{x_{2}}\\\vdots \\r_{x_{d}}\end{pmatrix}}={\begin{pmatrix}a_{1,x_{1}}&a_{1,x_{2}}&\dots &a_{1,x_{d}}\\a_{2,x_{1}}&a_{2,x_{2}}&\dots &a_{2,x_{d}}\\\vdots &\vdots &\ddots &\vdots \\a_{d,x_{1}}&a_{d,x_{2}}&\dots &a_{d,x_{d}}\end{pmatrix}}{\begin{pmatrix}\rho _{x_{1}}\\\rho _{x_{2}}\\\vdots \\\rho _{x_{d}}\end{pmatrix}}$
Similarly, the Cartesian coordinates can be converted back to fractional coordinates using the transformation ${\boldsymbol {\rho }}=\mathbf {h} ^{-1}\mathbf {r}$:
${\begin{pmatrix}\rho _{x_{1}}\\\rho _{x_{2}}\\\vdots \\\rho _{x_{d}}\end{pmatrix}}={\begin{pmatrix}a_{1,x_{1}}&a_{1,x_{2}}&\dots &a_{1,x_{d}}\\a_{2,x_{1}}&a_{2,x_{2}}&\dots &a_{2,x_{d}}\\\vdots &\vdots &\ddots &\vdots \\a_{d,x_{1}}&a_{d,x_{2}}&\dots &a_{d,x_{d}}\end{pmatrix}}^{-1}{\begin{pmatrix}r_{x_{1}}\\r_{x_{2}}\\\vdots \\r_{x_{d}}\end{pmatrix}}$

### Determination of cell properties in two and three dimensions using the metric tensor

The metric tensor $\mathbf {G}$ is sometimes used for calculations involving the unit cell and is defined (in matrix form) as:
In two dimensions,
$\mathbf {G} ={\begin{pmatrix}g_{11}&g_{12}\\g_{21}&g_{22}\end{pmatrix}}={\begin{pmatrix}\mathbf {a} _{1}\cdot \mathbf {a} _{1}&\mathbf {a} _{1}\cdot \mathbf {a} _{2}\\\mathbf {a} _{2}\cdot \mathbf {a} _{1}&\mathbf {a} _{2}\cdot \mathbf {a} _{2}\end{pmatrix}}={\begin{pmatrix}a_{1}^{2}&a_{1}a_{2}\cos(\alpha _{1})\\a_{1}a_{2}\cos(\alpha _{1})&a_{2}^{2}\end{pmatrix}}$
In three dimensions,
$\mathbf {G} ={\begin{pmatrix}g_{11}&g_{12}&g_{13}\\g_{21}&g_{22}&g_{23}\\g_{31}&g_{32}&g_{33}\end{pmatrix}}={\begin{pmatrix}\mathbf {a} _{1}\cdot \mathbf {a} _{1}&\mathbf {a} _{1}\cdot \mathbf {a} _{2}&\mathbf {a} _{1}\cdot \mathbf {a} _{3}\\\mathbf {a} _{2}\cdot \mathbf {a} _{1}&\mathbf {a} _{2}\cdot \mathbf {a} _{2}&\mathbf {a} _{2}\cdot \mathbf {a} _{3}\\\mathbf {a} _{3}\cdot \mathbf {a} _{1}&\mathbf {a} _{3}\cdot \mathbf {a} _{2}&\mathbf {a} _{3}\cdot \mathbf {a} _{3}\end{pmatrix}}={\begin{pmatrix}a_{1}^{2}&a_{1}a_{2}\cos(\alpha _{3})&a_{1}a_{3}\cos(\alpha _{2})\\a_{1}a_{2}\cos(\alpha _{3})&a_{2}^{2}&a_{2}a_{3}\cos(\alpha _{1})\\a_{1}a_{3}\cos(\alpha _{2})&a_{2}a_{3}\cos(\alpha _{1})&a_{3}^{2}\end{pmatrix}}$
The distance between two points $Q$ and $R$ in the unit cell can be determined from the relation:
$d_{qr}^{2}=\sum _{i,j}g_{ij}(r_{i}-q_{i})(r_{j}-q_{j})$
The distance from the origin of the unit cell to a point $Q$ within the unit cell can be determined from the relation:
$OQ=r_{q};r_{q}^{2}=\sum _{i,j}g_{ij}q_{i}q_{j}$
The angle formed from three points $Q$, $P$ (apex), and $R$ within the unit cell can determined from the relation:
$\cos(QPR)=(r_{pq})^{-1}(r_{pr})^{-1}\sum _{i,j}g_{ij}(q_{i}-p_{i})(r_{j}-p_{j})$
The volume of the unit cell, $V$ can be determined from the relation:
$V^{2}=\det(\mathbf {G} )$