Manipulations with cell#
For the full technical reference see wulfric.cell.
On this page we give examples of what can be done with the cell
introduced on the
key concepts page. Cell-related functions are
available under wulfric.cell
submodule. For the examples of this page we assume the
imports and an example cell of the form
>>> import wulfric as wulf
>>> import numpy as np
>>> cell = [
... [3.553350, 0.000000, 0.000000],
... [0.000000, 4.744935, 0.000000],
... [0.000000, 0.000000, 8.760497],
... ]
Cell parameters#
A valid cell can be characterized by the set of six parameters
\(a\) |
Length of the first lattice vector \(\boldsymbol{a}_1\) ( |
\(b\) |
Length of the second lattice vector \(\boldsymbol{a}_2\) ( |
\(c\) |
Length of the third lattice vector \(\boldsymbol{a}_3\) ( |
\(\alpha\) |
Angel between \(\boldsymbol{a}_2\) and \(\boldsymbol{a}_3\) |
\(\beta\) |
Angel between \(\boldsymbol{a}_1\) and \(\boldsymbol{a}_3\) |
\(\gamma\) |
Angel between \(\boldsymbol{a}_1\) and \(\boldsymbol{a}_2\) |
To compute parameters from the cell use
>>> wulf.cell.get_params(cell)
(3.55335, 4.744935, 8.760497, 90.0, 90.0, 90.0)
Note that when cell
converted to params
the information about its spacial
orientation is lost.
To create a cell from parameters use
>>> # we use np.round to account for the finite precision of float point arithmetic
>>> np.round(wulf.cell.from_params(3.55335, 4.744935, 8.760497, 90.0, 90.0, 90.0), 6)
array([[3.55335 , 0. , 0. ],
[0. , 4.744935, 0. ],
[0. , 0. , 8.760497]])
The cell is constructed with the first vector oriented along the \(x\) axis and second
vector in the \(xy\) plain. The cell can only be constructed from the set of parameters
that can form parallelepiped (see geometry.parallelepiped_check()
).
Note wulf.cell.from_params(wulf.cell.get_params(cell))
is not guaranteed to recover
the original cell
, as the information about the orientation of lattice vectors in
Cartesian reference frame is lost after the call of the first function.
Reciprocal lattice#
Any cell
defines a lattice and its reciprocal counterpart. To compute the cell of the
reciprocal lattice use
>>> rcell = wulf.cell.get_reciprocal(cell)
>>> rcell
array([[1.76824273, 0. , 0. ],
[0. , 1.32418786, 0. ],
[0. , 0. , 0.71721791]])
Reciprocal cell is a valid cell as well, therefore, to compute the cell of the real-space lattice just use the same function again:
>>> wulf.cell.get_reciprocal(rcell)
array([[3.55335 , 0. , 0. ],
[0. , 4.744935, 0. ],
[0. , 0. , 8.760497]])
Bravais lattices#
There is a full description of the Bravais lattices with their variations, examples, creation functions, details of standardizations. Please consult it to learn more.
Type of the Bravail lattice might be computed via the LePage algorithm as
>>> lattice_type = wulf.cell.lepage(cell)
>>> lattice_type
'ORC'
Some of the Bravais lattices have variations, to check the variation of the lattice use
>>> # Note there is no variation for the Orthorhombic lattice.
>>> wulf.cell.get_variation(cell)
'ORC'
Some of the characteristics of the Bravais lattice can be accessed from its type:
>>> # Note lattice_type = "ORC"
>>> wulf.cell.get_name(lattice_type)
'Orthorhombic'
>>> wulf.cell.get_pearson_symbol(lattice_type)
'oP'
To construct the cell for the one of the Bravais lattices use dedicated functions:
>>> wulf.cell.CUB(a=1)
array([[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
>>> mcl = wulf.cell.MCL(a=1, b=4, c=5, alpha=70)
>>> mcl
array([[1. , 0. , 0. ],
[0. , 4. , 0. ],
[0. , 1.71010072, 4.6984631 ]])
Required lattice parameters are different for each Bravias lattice type. Wulfric has functions for all 14 Bravais lattice types, see API for details.
Standardization#
An original goal of wulfric was to obtain high symmetry k paths in an automatic fashion for any given cell. We follow the convention of the Setyawan and Curtarolo [1] for the Bravais lattice types and high symmetry k points, where the definition of high symmetry points is given for the standardized primitive cells. In wulfric the standardization is represented by the transformation matrix \(\boldsymbol{S}\). Actual transformation of the cell rarely needed if the matrix \(\boldsymbol{S}\) is known. It allows to compute the high symmetry points for arbitrary cell.
To obtain the transformation matrix \(\boldsymbol{S}\) use
>>> wulf.cell.get_S_matrix(cell)
array([[1., 0., 0.],
[0., 1., 0.],
[0., 0., 1.]])
If you need to compute standardized cell use:
>>> wulf.cell.get_standardized(cell)
array([[3.55335 , 0. , 0. ],
[0. , 4.744935, 0. ],
[0. , 0. , 8.760497]])
For the example cell the matrix is an identity, indicated that it is already the standard one.
Conventional cell#
If the standardized primitive cell is knows, then standardized convectional cell can be computed. The transformation is described by the transformation matrix \(\boldsymbol{C}\). This matrix is specific to the lattice type and does not depend on the specific cell
>>> wulf.cell.get_C_matrix(lattice_type)
array([[1., 0., 0.],
[0., 1., 0.],
[0., 0., 1.]])
To get the conventional cell from the standardized primitive cell use
>>> wulf.cell.get_conventional(cell)
array([[3.55335 , 0. , 0. ],
[0. , 4.744935, 0. ],
[0. , 0. , 8.760497]])
For the Orthorhombic lattice conventional and primitive cells are the same.
Note that wulfric interprets the input cell as a primitive one. It is the responsibility of the user to ensure that it is indeed a primitive cell.
To read more about the conventional cells see Which cell? and Bravais lattices.