Skip to content

Lattices

brille.Lattice builds a lattice from lengths and angles or from basis vectors, with its symmetry; see Give a lattice its symmetry.

Lattice

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 setting row_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 keyword real_space is missing or True.

Parameters:

  • values ((lengths, angles) or (vectors,)) –

    The lattice, in one of two forms (see the note above):

    • (lengths, angles): the three basis vector lengths, in angstrom for a real lattice or inverse angstrom for a reciprocal lattice, and the three angles between them, in degrees or radians (radians if none is greater than pi);
    • (vectors,), or the vectors themselves: the basis vectors, in the same units, expressed in an orthonormal coordinate system, as rows unless row_vectors=False.
  • spacegroup ((str, tuple(str, str)), default: None ) –

    The International Tables name, Hermann-Mauguin symbol with optional choice, or Hall symbol for the spacegroup of the lattice, matched ignoring spaces and underscores, so 'P 21/c', 'P21/c' and 'P2_1/c' are the same. 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 <https://github.com/brille/brille/blob/eecb4cb28227665908793abc47e88c69518c09fc/src/spg_database.cpp#L63-L610> with each line representing one spacegroup with values, in order, defined by the class signature <https://github.com/brille/brille/blob/eecb4cb28227665908793abc47e88c69518c09fc/src/spg_database.hpp#L80-L91> These values come from spglib, which likely obtained them from Seto's Home Page <https://web.archive.org/web/20210621195003/http://pmsl.planet.sci.kobe-u.ac.jp/~seto/?page_id=37&lang=en>_.

  • symmetry –

    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 –

    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.

Other Parameters:

  • **kwargs –

    Passed to the brille._brille.Lattice constructor, for example real_space, row_vectors or snap_to_symmetry; see its documentation.

Lattice

Lattice(*args, **kwargs)

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.

Attributes:

  • 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`][brille._brille.Bravais]) –

    The centring type of the lattice

  • spacegroup ([`Symmetry`][brille._brille.Symmetry]) –

    The Spacegroup symmetry operations of the lattice

  • pointgroup ([`PointSymmetry`][brille._brille.PointSymmetry]) –

    The Pointgroup symmetry operations of the lattice

  • basis ([`Basis`][brille._brille.Basis]) –

    The positions of all atoms within the lattice unit cell

Methods:

a property

a

a_star property

a_star

alpha property

alpha

alpha_star property

alpha_star

b property

b

b_star property

b_star

basis property

basis

beta property

beta

beta_star property

beta_star

bravais property

bravais

c property

c

c_star property

c_star

centring_vectors property

centring_vectors

The centring vectors of the cell, in its fractional coordinates: the zero vector, and one more for each extra lattice point in a centred cell (1 for P, 2 for A, B, C and I, 3 for R, 4 for F).

gamma property

gamma

gamma_star property

gamma_star

pointgroup property

pointgroup

primitive_basis property

primitive_basis

The atoms of one primitive cell: the first given atom of each centring orbit of basis, at its given position.

Eigenvectors given to a grid describe these atoms, in this order, or every atom of basis. For a primitive cell this is basis itself; for a centred conventional cell it is a half, a third or a quarter of it (see brille.utils.conventional_to_primitive).

real_vectors property

real_vectors

reciprocal_vectors property

reciprocal_vectors

spacegroup property writable

spacegroup

volume property

volume

volume_star property

volume_star

get_contravariant_metric_tensor staticmethod

get_contravariant_metric_tensor(*args, **kwargs)

Calculate the contravariant metric tensor of the lattice

Returns:

  • matrix_like –

    The inverse of the metric of the lattice

    .. math:: 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}

get_covariant_metric_tensor staticmethod

get_covariant_metric_tensor(*args, **kwargs)

Calculate the covariant metric tensor of the lattice

Returns:

  • matrix_like –

    The metric of the lattice

    .. math:: 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}

metric staticmethod

metric(*args, **kwargs)

str staticmethod

str(*args, **kwargs)

vector staticmethod

vector(*args, **kwargs)

vectors staticmethod

vectors(*args, **kwargs)

Basis

Basis(positions: ndarray[float64])
Basis(positions: ndarray[float64], types: list[int])
Basis(positions: ndarray[float64])

An atom basis in a unit cell

The positions and types of all symmetry-distinct atoms in a lattice define the atom basis. Two equivalent-type atoms may exchange position within the unit cell under application of a symmetry of the spacegroup.

Given only atom positions, assume all are unique types

Attributes:

positions property

positions: ndarray[float64]

size property

size: int

types property

types: list[int]

Bravais

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__.

.. website: http://reference.iucr.org/dictionary/Centred_lattice __ website

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

Attributes:

A class-attribute

A: Bravais

B class-attribute

B: Bravais

C class-attribute

C: Bravais

F class-attribute

F: Bravais

I class-attribute

I: Bravais

P class-attribute

P: Bravais

R class-attribute

R: Bravais

invalid class-attribute

invalid: Bravais

name property

name: str

value property

value: int

PrimitiveTransform

PrimitiveTransform(bravais: Bravais)

The transformation between a conventional cell with this centring and its primitive cell.

Attributes:

P property

P: ndarray[float64]

Pt property

Pt: ndarray[float64]

does_anything property

does_anything: bool

invP property

invP: ndarray[int32]

invPt property

invPt: ndarray[int32]

is_primitive property

is_primitive: bool