Cell#

For the full technical reference see Cell.

The Cell combines a set of functions that are used for manipulations with unit cells.

It could have been a class with a number of @classmethods, but we decided to write it as a separate module. It is deliberately not included in the Lattice-Crystall hierarchy, because it unites the methods that use only concepts of lattice vector (i.e. reciprocal() and params()) as well as the ones that use the concept of lattice and atoms (i.e. primitive()).

Import#

A number of import scenarios is possible:

  • Import of the needed functions:

>>> # Explicit import
>>> from wulfric.cell import params, reciprocal
  • Import of the interface in the class-style syntax

>>> # Recommended import
>>> from wulfric import Cell
>>> # it is equivalent to
>>> from wulfric import cell as Cell

Cell parameters#

Two functions that convert the cell parameters to the matrix of lattice vectors and vice versa.

>>> from wulfric import Cell
>>> Cell.params([[ 1.,  0.,  0.],
...              [ 0.,  1.,  0.],
...              [ 0.,  0.,  1.]])
(1.0, 1.0, 1.0, 90.0, 90.0, 90.0)
>>> from wulfric import Cell
>>> # Rounding is used because of the floating point errors
>>> import numpy as np
>>> np.around(Cell.from_params(1, 1, 1, 90, 90, 90), 2)
array([[1., 0., 0.],
       [0., 1., 0.],
       [0., 0., 1.]])

Reciprocal lattice#

\[\begin{split}\begin{matrix} \boldsymbol{b}_1 = \dfrac{2\pi}{V}\boldsymbol{a}_2\times\boldsymbol{a}_3 \\ \boldsymbol{b}_2 = \dfrac{2\pi}{V}\boldsymbol{a}_3\times\boldsymbol{a}_1 \\ \boldsymbol{b}_3 = \dfrac{2\pi}{V}\boldsymbol{a}_1\times\boldsymbol{a}_2 \\ \end{matrix}\end{split}\]

where \(V\) is the volume of the unit cell.

>>> from wulfric import Cell
>>> # Rounding is used because of the floating point errors
>>> import numpy as np
>>> np.around(Cell.reciprocal([[ 1.,  0.,  0.],
...                            [ 0.,  1.,  0.],
...                            [ 0.,  0.,  1.]]), 2)
array([[6.28, 0.  , 0.  ],
       [0.  , 6.28, 0.  ],
       [0.  , 0.  , 6.28]])

Primitive cell#

Sometimes we are given some supercell and we want to find the primitive cell. The primitive cell is the smallest cell that can reproduce the crystalline structure (Lattice and set of Atoms).

Warning

The function that computes the primitive cell is not implemented yet.