Lattices
- brille.Lattice(values, spacegroup=None, symmetry=None, basis=None, **kwargs)
Construct a space-spanning lattice in three dimensions
A space-spanning lattice in \(N\) dimensions has \(N\) basis vectors which can be described fully by their \(N\) lengths and the \(\frac{1}{2} N (N-1)\) angles between each set of basis vectors, or \(\frac{1}{2}N(N+1)\) scalars in total. This class stores the basis vectors of the lattice described in an orthonormal space, plus the metric of the space, and the equivalent information for the dual of the lattice.
Examples
>>> from brille import Lattice >>> a, c = 3.95, 12.9 >>> avec, bvec, cvec = [a, 0, 0], [0, a, 0], [0, 0, c] >>> basis = ([[0, 0, 0], [0.5, 0.5, 0.5], [0.25, 0.25, 0.3]], [0, 0, 1])) >>> symmetry = (rotations, translations) >>> lat = Lattice(([a, a, c], [90, 90, 90]), spacegroup='I4/mmm', basis=basis) >>> lat = Lattice(([avec, bvec, cvec],), symmetry=symmetry, basis=basis) >>> lat = Lattice([avec, bvec, cvec], spacegroup='I4/mmm', basis=basis)
Note
The parameters packed into
values
are position-based and should be either(lengths, angles)
or(vectors,)
[which also requires settingrow_vectors=False
if the matrix represents column vectors]. The lengths or vector components are interpreted in angstrom or inverse angstrom for real or reciprocal lattice parameters, respectively, and are assumed to be angstrom if the keywordreal_space
is missing or True.- Parameters:
values ((lengths, angles), vectors) – See the note above and the documenation for
lengths
,angles
, andvectors
below.lengths (list, tuple, numpy.ndarray) – The three basis vector lengths in angstrom for real lattice, or inverse angstrom for reciprocal lattices
angles (list, tuple, numpy.ndarray) – The three angles between the basis vectors in degrees or radians. The angles are interpreted as radians if none are greater than pi and are otherwise assumed to be degrees.
vectors (list[list,…], tuple(tuple,…), numpy.ndarray) – The basis vectors in angstrom for real lattices, or inverse angstrom for reciprocal lattices, expressed in an orthorhombic coordinate system. An optional keyword argument,
row_vectors
, identifies if the provided basis vectors are row vectors [row_vectors=True, default] or column vectors [row_vectors=False
].spacegroup (str, tuple(str, str)) – The International Tables name, Hermann-Mauguin symbol with optional choice, or Hall symbol for the spacegroup of the lattice. The spacegroup may be provided as positional argument(s) or by keyword. If present, the
symmetry
keyword must not be used. Valid syntax for(Hermann-Mauguin, choice)
input depends on the spacegroup but is generally one of:a single letter (‘a’, ‘b’, or ‘c’) with possible prepended ‘-’, denoting unique-axis choice
a single digit (‘1’, ‘2’, or ‘3’), denoting origin choice
a letter and digit, denoting unique-axis and origin choice
a permutation of ‘abc’ with possible ‘-’ before one of the letters, denoting axis permutation
or ‘R’ or ‘H’ for trigonal systems with Rhombohedral or Hexagonal lattice settings, respectively.
Acceptable values are contained in the C++ source code in the seventh column of this table with each line representing one spacegroup with values, in order, defined by the class signature These values come from spglib, which likely obtained them from Seto’s Home Page.
symmetry (brille.Symmetry, tuple(matrices, vectors), str) – The spacegroup symmetry operations as an object, a tuple of the (pseudo)rotation matrices and translation vectors, or a CIF xyz encoded string. The symmetry information must be provided by keyword. If present, the ‘spacegroup’ positional argument(s) or keyword must not be used.
basis (brille.Basis, tuple(positions, types)) – The atom basis information of the lattice, expressed in units of the real space basis vectors. The types must be integer and are used only to identify equivalent atoms – they should probably be contiguous from zero to 1-N where N is the number of unique atoms in the atom basis. If present, either spacegroup or symmetry information must be provided.
kwargs – Keyword arguments are passed to the
brille._brille.Lattice
constructor, see its documentation for details.
- class brille._brille.Bravais(self: brille._brille.Bravais, value: int)
A Bravais letter indicating the centering of a lattice
When the unit cell does not reflect the symmetry of the lattice, it is usual to refer to a ‘conventional’ crystallographic basis, \((\mathbf{a}_s\,\mathbf{b}_s\,\mathbf{c}_s)\), instead of a primitive basis, \((\mathbf{a}_p\,\mathbf{b}_p\,\mathbf{c}_p)\). Such a conventional basis has ‘extra’ lattice points added at the centre of the unit cell, the centre of a face, or the centre of three faces. The ‘extra’ nodes in the conventional basis are displaced from the origin of the unit cell by ‘centring vectors’. As with any space-spanning basis, any whole-number linear combination of the conventional basis vectors is a lattice point but in addition there exist linear combinations \(x\mathbf{a}_s+y\mathbf{b}_s+z\mathbf{c}_s\) with at least two fractional coefficients \((x,y,z)\) that are lattice points as well.
Each conventional basis is ascribed a Bravais letter, which forms part of the Hermann-Mauguin symbol of a space group. A subset of the 10 possible Bravais letters is used herein:
Bravais letter
Centring
Centring vectors
P
primitive
\(\mathbf{0}\)
A
A-face centred
\(\frac{\mathbf{b}_s+\mathbf{c}_s}{2}\)
B
B-face centred
\(\frac{\mathbf{c}_s+\mathbf{a}_s}{2}\)
C
C-face centred
\(\frac{\mathbf{a}_s+\mathbf{b}_s}{2}\)
I
body centred (Innenzentriert)
\(\frac{\mathbf{a}_s+\mathbf{b}_s+\mathbf{c}_s}{2}\)
F
all-face centred
\(\frac{\mathbf{b}_s+\mathbf{c}_s}{2}\), \(\frac{\mathbf{c}_s+\mathbf{a}_s}{2}\), \(\frac{\mathbf{a}_s+\mathbf{b}_s}{2}\)
R
rhombohedrally centred (hexagonal axes)
\(\frac{2\mathbf{a}_s+\mathbf{b}_s+\mathbf{c}_s}{3}\) \(\frac{\mathbf{a}_s+2\mathbf{b}_s+2\mathbf{c}_s}{3}\)
For further details, see the IUCr Online Dictionary of Crystallography.
Members:
invalid
P : primitive
A : A-face centred
B : B-face centred
C : C-face centred
I : body-centred
F : face centred
R : rhombohedrally centred
- class brille._brille.Lattice
A space-spanning lattice in three dimensions
A space-spanning lattice in \(N\) dimensions has \(N\) basis vectors which can be described fully by their \(N\) lengths and the \(\sum_1^{N-1} 1\) angles between each set of basis vectors, or \(\sum_1^N 1 = \frac{1}{2}N(N+1)\) scalars in total. This class stores the basis vectors of the lattice described in an orthonormal space, plus the metric of the space, and the equivalent information for the dual of the lattice.
- Variables:
a,b,c (float) – The basis vector lengths
alpha,beta,gamma (float) – The angles between the basis vectors, internally always in radian
volume (float) – The volume of the lattice unit cell in units of length cubed.
bravais (
Bravais
) – The centring type of the latticespacegroup (
Symmetry
) – The Spacegroup symmetry operations of the latticepointgroup (
PointSymmetry
) – The Pointgroup symmetry operations of the latticebasis (
Basis
) – The positions of all atoms within the lattice unit cell
- get_contravariant_metric_tensor()
Calculate the contravariant metric tensor of the lattice
- Returns:
The inverse of the metric of the lattice
\[g^{ij} = \begin{pmatrix} a^2 & ab\cos\gamma & ac\cos\beta \\ ab\cos\gamma & b^2 & bc\cos\alpha \\ ac\cos\beta & bc\cos\alpha & c^2 \end{pmatrix}^{-1} \]- Return type:
matrix_like
- get_covariant_metric_tensor()
Calculate the covariant metric tensor of the lattice
- Returns:
The metric of the lattice
\[g_{ij} = \begin{pmatrix} a^2 & ab\cos\gamma & ac\cos\beta \\ ab\cos\gamma & b^2 & bc\cos\alpha \\ ac\cos\beta & bc\cos\alpha & c^2 \end{pmatrix} \]- Return type:
matrix_like