# LePage algorithm#

The algorithm for the Bravais lattice type identification is bases on the search for the twofold rotation axes and described in details in . Here we recall the algorithm from Table 1 of the original publication with minor modifications as implemented in lepage() function.

## 3D Lattice#

Relative coordinates are given with respect to the primitive direct unit cell as defined in  unless specified directly.

### Step I#

Compute niggli reduced cell via the call to the niggli() function. Define cell and reciprocal cell as Niggli cell and it's reciprocal pair.

### Step II#

Generate all (125) the Miller indices for direct ($$U$$) and reciprocal ($$h$$) lattice:

[-2,-2,-2],
...,
[2, 2, 2]


### Step III#

Run over all miller indices of direct cell and of all miller indices of reciprocal cell.

If $$\vert U \cdot h\vert = 2$$ or $$\vert U \cdot h\vert = 1$$ compute $$\delta$$:

$\delta = \frac{\vert \boldsymbol{t}\times\boldsymbol{\tau}\vert}{\vert \boldsymbol{t}\cdot\boldsymbol{\tau}\vert}$

where (@ - means matrix multiplication)

t = U @ cell
tau = h @ reciprocal_cell


If $$\delta$$ is less then a limit, keep the entry:

$(U, \frac{\boldsymbol{t}}{\vert\boldsymbol{t}\vert}, \vert U \cdot h\vert, \delta)$

### Step IV#

Filter results to eliminate "twins" of direct indices:

• $$[1, 2, 0]$$ and $$[1, 2, 0]$$

• $$[1, 2, 0]$$ and $$[-1, -2, 0]$$

• $$[1, 0, -1]$$ and $$[2, 0, -2]$$: $$[1, 0, -1]$$ is kept.

At this step the axes list is computed

### Step V#

Compute pairwise cosines between the twofold axes directions (angles):

$\cos(\alpha_{ij}) = \frac{\vert\boldsymbol{t}_i\cdot\boldsymbol{t}_j\vert}{\vert\boldsymbol{t}_i\vert\vert\boldsymbol{t}_j\vert}$

### Step VI#

If you came from go to: delete axes with the biggest delta from axes list.

Compute maximum $$\delta$$. If it is less then maximum delta, finish and return result. If not proceed with the consecutive checks for the system types.

### Step VII (cubic)#

Check for the cubic system. Cubic system has 9 even-order symmetry axis (in relative coordinates):

$\begin{split}\begin{matrix} 1:& (1, 0, 0) \\ 2:& (0, 1, 0) \\ 3:& (0, 0, 1) \\ 4:& (1, 1, 0) \\ 5:& (1, -1, 0) \\ 6:& (1, 0, 1) \\ 7:& (-1, 0, 1) \\ 8:& (0, 1, 1) \\ 9:& (0, -1, 1) \\ \end{matrix}\end{split}$

with the following angle matrix:

$\begin{split}\begin{matrix} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\ 1 & 0^{\circ} & 90^{\circ} & 90^{\circ} & 45^{\circ} & 45^{\circ} & 45^{\circ} & 45^{\circ} & 90^{\circ} & 90^{\circ} \\ 2 & 90^{\circ} & 0^{\circ} & 90^{\circ} & 45^{\circ} & 45^{\circ} & 90^{\circ} & 90^{\circ} & 45^{\circ} & 45^{\circ} \\ 3 & 90^{\circ} & 90^{\circ} & 0^{\circ} & 90^{\circ} & 90^{\circ} & 45^{\circ} & 45^{\circ} & 45^{\circ} & 45^{\circ} \\ 4 & 45^{\circ} & 45^{\circ} & 90^{\circ} & 0^{\circ} & 90^{\circ} & 60^{\circ} & 60^{\circ} & 60^{\circ} & 60^{\circ} \\ 5 & 45^{\circ} & 45^{\circ} & 90^{\circ} & 90^{\circ} & 0^{\circ} & 60^{\circ} & 60^{\circ} & 60^{\circ} & 60^{\circ} \\ 6 & 45^{\circ} & 90^{\circ} & 45^{\circ} & 60^{\circ} & 60^{\circ} & 0^{\circ} & 90^{\circ} & 60^{\circ} & 60^{\circ} \\ 7 & 45^{\circ} & 90^{\circ} & 45^{\circ} & 60^{\circ} & 60^{\circ} & 90^{\circ} & 0^{\circ} & 60^{\circ} & 60^{\circ} \\ 8 & 90^{\circ} & 45^{\circ} & 45^{\circ} & 60^{\circ} & 60^{\circ} & 60^{\circ} & 60^{\circ} & 0^{\circ} & 90^{\circ} \\ 9 & 90^{\circ} & 45^{\circ} & 45^{\circ} & 60^{\circ} & 60^{\circ} & 60^{\circ} & 60^{\circ} & 60^{\circ} & 0^{\circ} \end{matrix}\end{split}$

If angles is the same as the cubic angle matrix, then find three axes with the following set of angles: $$(0^{\circ} \times 1, 90^{\circ}\times 4, 45^{\circ} \times 4)$$, put their Miller indices in the matrix and compute its determinant $$\Delta$$.

• If $$\vert\Delta\vert = 1$$, then set system type to "CUB".

• If $$\vert\Delta\vert = 2$$, then set system type to "BCC".

• If $$\vert\Delta\vert = 4$$, then set system type to "FCC".

Go to Step VI.

### Step VIII (hexagonal)#

Check for the hexagonal system. Hexagonal system has 7 even-order symmetry axis (in relative coordinates):

$\begin{split}\begin{matrix} 1:& (1, 0, 0) \\ 2:& (2, 1, 0) \\ 3:& (1, 1, 0) \\ 4:& (1, 2, 0) \\ 5:& (0, 1, 0) \\ 6:& (-1, 1, 0) \\ 7:& (0, 0, 1) \end{matrix}\end{split}$

with the following angle matrix:

$\begin{split}\begin{matrix} & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ 1 & 0^{\circ} & 30^{\circ} & 60^{\circ} & 90^{\circ} & 60^{\circ} & 30^{\circ} & 90^{\circ} \\ 2 & 30^{\circ} & 0^{\circ} & 30^{\circ} & 60^{\circ} & 90^{\circ} & 60^{\circ} & 30^{\circ} \\ 3 & 60^{\circ} & 30^{\circ} & 0^{\circ} & 30^{\circ} & 60^{\circ} & 90^{\circ} & 90^{\circ} \\ 4 & 90^{\circ} & 60^{\circ} & 30^{\circ} & 0^{\circ} & 30^{\circ} & 60^{\circ} & 90^{\circ} \\ 5 & 60^{\circ} & 90^{\circ} & 60^{\circ} & 30^{\circ} & 0^{\circ} & 30^{\circ} & 90^{\circ} \\ 6 & 30^{\circ} & 60^{\circ} & 90^{\circ} & 60^{\circ} & 30^{\circ} & 0^{\circ} & 90^{\circ} \\ 7 & 90^{\circ} & 90^{\circ} & 90^{\circ} & 90^{\circ} & 90^{\circ} & 90^{\circ} & 0^{\circ} \end{matrix}\end{split}$

If angles is the same as the hexagonal angle matrix, then set system type to "HEX".

Go to Step VI.

### Step IX (tetragonal)#

Check for the tetragonal system. Tetragonal system has 5 even-order symmetry axis (in relative coordinates):

$\begin{split}\begin{matrix} 1:& (1, 0, 0) \\ 2:& (0, 1, 0) \\ 3:& (0, 0, 1) \\ 4:& (1, 1, 0) \\ 5:& (1, -1, 0) \end{matrix}\end{split}$

with the following angle matrix:

$\begin{split}\begin{matrix} & 1 & 2 & 3 & 4 & 5 \\ 1 & 0^{\circ} & 90^{\circ} & 90^{\circ} & 45^{\circ} & 45^{\circ} \\ 2 & 90^{\circ} & 0^{\circ} & 90^{\circ} & 45^{\circ} & 45^{\circ} \\ 3 & 90^{\circ} & 90^{\circ} & 0^{\circ} & 90^{\circ} & 90^{\circ} \\ 4 & 45^{\circ} & 45^{\circ} & 90^{\circ} & 0^{\circ} & 90^{\circ} \\ 5 & 45^{\circ} & 45^{\circ} & 90^{\circ} & 90^{\circ} & 0^{\circ} \end{matrix}\end{split}$

If angles is the same as the tetragonal angle matrix, then find one axes with the following set of angles: $$(0^{\circ} \times 1, 90^{\circ}\times 4)$$. Take two axes with minimal length form the remaining four. Make a matrix from the Miller indices of the three axes and compute its determinant $$\Delta$$.

• If $$\vert\Delta\vert = 1$$, then set system type to "TET".

• If $$\vert\Delta\vert = 2$$, then set system type to "BCT".

Go to Step VI.

### Step X (rhombohedral)#

Check for the rhombohedral system. Rhombohedral system has 3 even-order symmetry axis (in relative coordinates):

$\begin{split}\begin{matrix} 1:& (1, -1, 0) \\ 2:& (0, 1, -1) \\ 3:& (1, 0, -1) \\ \end{matrix}\end{split}$

with the following angle matrix:

$\begin{split}\begin{matrix} & 1 & 2 & 3 \\ 1 & 0^{\circ} & 60^{\circ} & 60^{\circ} \\ 2 & 60^{\circ} & 0^{\circ} & 60^{\circ} \\ 3 & 60^{\circ} & 60^{\circ} & 0^{\circ} \end{matrix}\end{split}$

If angles is the same as the rhombohedral angle matrix, then set system type to "RHL".

Go to Step VI.

### Step XI (orthorhombic)#

Check for the orthorhombic system. Orthorhombic system has 3 even-order symmetry axis (in relative coordinates):

$\begin{split}\begin{matrix} 1:& (1, 0, 0) \\ 2:& (0, 1, 0) \\ 3:& (0, 0, 1) \\ \end{matrix}\end{split}$

with the following angle matrix:

$\begin{split}\begin{matrix} & 1 & 2 & 3 \\ 1 & 0^{\circ} & 90^{\circ} & 90^{\circ} \\ 2 & 90^{\circ} & 0^{\circ} & 90^{\circ} \\ 3 & 90^{\circ} & 90^{\circ} & 0 \end{matrix}\end{split}$

If angles is the same as the orthorhombic angle matrix, then make a matrix from the Miller indices of the three symmetry axes and compute its determinant $$\Delta$$.

• If $$\vert\Delta\vert = 1$$, then set system type to "ORC".

• If $$\vert\Delta\vert = 4$$, then set system type to ""ORCF".

• If $$\vert\Delta\vert = 2$$, then check for "ORCC" vs "ORCI".

Define matrix $$C$$ as the matrix where columns are the Miller indices of the three symmetry axes. Compute the vector:

v = C @ [1, 1, 1]


If the elements of v are coprime, then set system type to "ORCI", otherwise set the system type to "ORCC".

Go to Step VI.

### Step XII (monoclinic)#

Check for the monoclinic system. Monoclinic system has 1 even-order symmetry axis (in relative coordinates with respect to the conventional lattice as defined in ):

$\begin{split}\begin{matrix} 1:& (1, 0, 0) \\ \end{matrix}\end{split}$

with the following angle matrix:

$\begin{split}\begin{matrix} & 1 \\ 1 & 0^{\circ} \end{matrix}\end{split}$

If angles is the same as the monoclinic angle matrix, then define two shortest translation vectors in the plane perpendicular to the twofold rotation axis. Put Miller indices of these two vectors and of twofold axis in a matrix and compute its determinant $$\Delta$$

• If $$\vert\Delta\vert = 1$$, then set system type to "MCL".

• If $$\vert\Delta\vert = 2$$, then set system type to "MCLC".

Go to Step VI.

### Step XIII (trigonal)#

If all previous checks failed set system type to "TRI" and go to Step VI.