Public API

Contents

Index

Public interface

Lattice and Cell

CrystallographyCore.LatticeType
Lattice(data::AbstractMatrix)

Construct a Lattice from a matrix.

Note

The basis vectors of the matrix are stored as columns.

Examples

julia> Lattice([
           1.2 4.5 7.8
           2.3 5.6 8.9
           3.4 6.7 9.1
       ])
Lattice{Float64}
 1.2  4.5  7.8
 2.3  5.6  8.9
 3.4  6.7  9.1
source
CrystallographyBase.isrighthandedFunction
isrighthanded(lattice::Lattice)

Test whether the basis vectors are defined to be right-handed.

The basis vectors are right-handed if and only if

\[\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) > 0.\]

source
CrystallographyBase.islefthandedFunction
islefthanded(lattice::Lattice)

Test whether the basis vectors are defined to be left-handed.

The basis vectors are left-handed if and only if

\[\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) < 0.\]

source
CrystallographyCore.basisvectorsFunction
basisvectors(lattice::Lattice)

Get the three basis vectors from a lattice.

source
basisvectors(lattice::ReciprocalLattice)

Get the three basis vectors from a reciprocal lattice.

source
CrystallographyBase.latticesystemFunction
latticesystem(bravais::Bravais)

Get the lattice system of a Bravais lattice.

source
latticesystem(lattice::Lattice; angletol=1e-5, lengthtol=1e-5)

Get the lattice system of a Lattice.

source
CrystallographyCore.CellType
Cell(lattice, positions, atoms)

Create a new cell.

Argument lattice is a Lattice type. Fractional atomic positions positions are given by a vector of $N$ vectors with floating point values, where $N$ is the number of atoms. Argument atoms is a list of $N$ values, where the same kind of atoms need to be the same type.

source
CrystallographyBase.superFunction
super(lattice::Lattice, factors::AbstractMatrix{<:Integer})
super(lattice::Lattice, factors::AbstractVector{<:Integer})
super(lattice::Lattice, factor::Integer)

Create a supercell from lattice.

source
super(cell::Cell, factors::AbstractMatrix{<:Integer})
super(cell::Cell, factors::AbstractVector{<:Integer})
super(cell::Cell, factor::Integer)

Create a supercell from cell.

Note

Currently, only integral replications are supported.

source

Reciprocal space

Note that we take $2\pi$ as $1$, not the solid-state physics convention.

CrystallographyCore.ReciprocalLatticeType
ReciprocalLattice(data::AbstractMatrix)

Construct a ReciprocalLattice from a matrix.

Note

The basis vectors of the matrix are stored as columns.

Warning

Avoid using this constructor directly. Use reciprocal instead.

source
CrystallographyBase.MonkhorstPackGridType
MonkhorstPackGrid(mesh, is_shift)

Represent the Monkhorst–Pack grid.

Arguments

  • mesh: A length-three vector specifying the k-point grid ($nk_1 × nk_2 × nk_3$) as in Monkhorst–Pack grids.
  • is_shift: A length-three vector specifying whether the grid is displaced by half a grid step in the corresponding directions.
source

Metric tensor

CrystallographyBase.MetricTensorType
MetricTensor(𝐚::AbstractVector, 𝐛::AbstractVector, 𝐜::AbstractVector)

Generate a MetricTensor from the three basis vectors.

source
MetricTensor(lattice::Lattice)

Generate a MetricTensor from a Lattice.

source
MetricTensor(a, b, c, α, β, γ)

Generate a MetricTensor from the six cell parameters.

source
CrystallographyBase.distanceFunction
distance(𝐚::ReducedCoordinates, 𝐛::ReducedCoordinates, g::MetricTensor)

Get the distance between two atomic coordinates.

source

Transformations

Others

CrystallographyBase.cellvolumeFunction
cellvolume(a, b, c, α, β, γ)

Calculate the cell volume from 6 cell parameters.

source
cellvolume(l::Lattice)
cellvolume(c::Cell)

Calculate the cell volume from a Lattice or a Cell.

source
cellvolume(g::MetricTensor)

Calculate the cell volume from a MetricTensor.

source
CrystallographyBase.crystaldensityFunction
crystaldensity(lattice::Lattice, atoms)
crystaldensity(cell::Cell)

Calculate the density of a crystal structure.

Here, atoms is an iterable of atomic numbers, element names, symbols, or Mendeleev.Elements. You can extend the atomicmass method to work with custom types.

source