Public API
Contents
Index
CrystallographyBase.MetricTensor
CrystallographyBase.MonkhorstPackGrid
CrystallographyBase.PrimitiveFromStandardized
CrystallographyBase.StandardizedFromPrimitive
CrystallographyCore.Cell
CrystallographyCore.Lattice
CrystallographyCore.ReciprocalLattice
CrystallographyBase.atomicmass
CrystallographyBase.cellvolume
CrystallographyBase.crystaldensity
CrystallographyBase.distance
CrystallographyBase.islefthanded
CrystallographyBase.isrighthanded
CrystallographyBase.latticeconstants
CrystallographyBase.latticesystem
CrystallographyBase.lengthof
CrystallographyBase.periodicity
CrystallographyBase.super
CrystallographyCore.basisvectors
CrystallographyCore.eachatom
CrystallographyCore.reciprocal
Public interface
Lattice and Cell
CrystallographyCore.Lattice
— TypeLattice(data::AbstractMatrix)
Construct a Lattice
from a matrix.
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
CrystallographyBase.isrighthanded
— Functionisrighthanded(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.\]
CrystallographyBase.islefthanded
— Functionislefthanded(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.\]
CrystallographyCore.basisvectors
— Functionbasisvectors(lattice::Lattice)
Get the three basis vectors from a lattice.
basisvectors(lattice::ReciprocalLattice)
Get the three basis vectors from a reciprocal lattice.
CrystallographyBase.latticesystem
— Functionlatticesystem(bravais::Bravais)
Get the lattice system of a Bravais lattice.
latticesystem(lattice::Lattice; angletol=1e-5, lengthtol=1e-5)
Get the lattice system of a Lattice
.
CrystallographyBase.latticeconstants
— Functionlatticeconstants(lattice::Lattice)
Get the six lattice constants from a lattice
.
latticeconstants(g::MetricTensor)
Get the six lattice constants from a MetricTensor
.
CrystallographyBase.periodicity
— Functionperiodicity(lattice::Lattice)
Get crystal periodicity in $x$, $y$, and $z$ direction from the Lattice
.
CrystallographyCore.Cell
— TypeCell(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.
CrystallographyBase.super
— Functionsuper(lattice::Lattice, factors::AbstractMatrix{<:Integer})
super(lattice::Lattice, factors::AbstractVector{<:Integer})
super(lattice::Lattice, factor::Integer)
Create a supercell from lattice
.
super(cell::Cell, factors::AbstractMatrix{<:Integer})
super(cell::Cell, factors::AbstractVector{<:Integer})
super(cell::Cell, factor::Integer)
Create a supercell from cell
.
Currently, only integral replications are supported.
CrystallographyCore.eachatom
— Functioneachatom(cell::Cell)
Create a generator that iterates over the atoms in a Cell
.
Reciprocal space
Note that we take $2\pi$ as $1$, not the solid-state physics convention.
CrystallographyCore.ReciprocalLattice
— TypeReciprocalLattice(data::AbstractMatrix)
Construct a ReciprocalLattice
from a matrix.
The basis vectors of the matrix are stored as columns.
Avoid using this constructor directly. Use reciprocal
instead.
CrystallographyBase.MonkhorstPackGrid
— TypeMonkhorstPackGrid(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.
CrystallographyCore.reciprocal
— Functionreciprocal(lattice::Lattice)
reciprocal(lattice::ReciprocalLattice)
Get the reciprocal of a Lattice
or a ReciprocalLattice
.
Metric tensor
CrystallographyBase.MetricTensor
— TypeMetricTensor(𝐚::AbstractVector, 𝐛::AbstractVector, 𝐜::AbstractVector)
Generate a MetricTensor
from the three basis vectors.
MetricTensor(lattice::Lattice)
Generate a MetricTensor
from a Lattice
.
MetricTensor(a, b, c, α, β, γ)
Generate a MetricTensor
from the six cell parameters.
CrystallographyBase.lengthof
— Functionlengthof(𝐚::ReducedCoordinates, g::MetricTensor)
Get the length of an atomic coordinates.
CrystallographyBase.distance
— Functiondistance(𝐚::ReducedCoordinates, 𝐛::ReducedCoordinates, g::MetricTensor)
Get the distance between two atomic coordinates.
Transformations
CrystallographyBase.PrimitiveFromStandardized
— TypePrimitiveFromStandardized(tf::AbstractMatrix)
Construct the transformation from a standardized cell to a primitive cell.
CrystallographyBase.StandardizedFromPrimitive
— TypeStandardizedFromPrimitive(tf::AbstractMatrix)
Construct the transformation from a primitive cell to a standardized cell.
Others
CrystallographyBase.cellvolume
— Functioncellvolume(a, b, c, α, β, γ)
Calculate the cell volume from 6 cell parameters.
cellvolume(l::Lattice)
cellvolume(c::Cell)
Calculate the cell volume from a Lattice
or a Cell
.
cellvolume(g::MetricTensor)
Calculate the cell volume from a MetricTensor
.
CrystallographyBase.crystaldensity
— Functioncrystaldensity(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.Element
s. You can extend the atomicmass
method to work with custom types.
CrystallographyBase.atomicmass
— Functionatomicmass(element::Element)
atomicmass(i::Union{AbstractString,Integer,Symbol})
Return the atomic mass of an element.
This function is by default not implemented. You need to load either package Mendeleev.jl
or PeriodicTable.jl
to use it.