Public API

Contents

Index

Public interface

Lattices

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
Base.:*Method
*(R::AbstractMatrix, lattice::Lattice)

Left-multiply a lattice by a matrix and return a Lattice.

If the lattice matrix is $\mathrm{A} = [\mathbf{a}\ \mathbf{b}\ \mathbf{c}]$ (basis vectors as columns), this computes $\mathrm{R}\mathrm{A}$. This corresponds to an active (reverse/alibi) transformation, such as a rigid Cartesian rotation applied to the crystal basis vectors.

Only $3×3$ matrices are supported.

See also "Left and right matrix actions on a lattice".

source
Base.:*Method
*(lattice::Lattice, P::AbstractMatrix)

Right-multiply a lattice by a matrix and return a Lattice.

If the lattice matrix is $\mathrm{A} = [\mathbf{a}\ \mathbf{b}\ \mathbf{c}]$ (basis vectors as columns), this computes $\mathrm{A}\mathrm{P}$. This corresponds to a passive (forward/alias) change of basis.

Only $3×3$ matrices are supported.

See also "Left and right matrix actions on a lattice".

source

Reciprocal lattices

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

Cells

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
CrystallographyCore.atomcountsFunction
atomcounts(cell::Cell)

Return a dictionary mapping each distinct atom value in cell.atoms to the number of occurrences in the cell.

Examples

julia> cell = Cell(rand(3, 3), [rand(3) for _ in 1:4], [:C, :O, :C, :H])

julia> atomcounts(cell)
Dict{Symbol, Int64} with 3 entries:
  :H => 1
  :O => 1
  :C => 2
source

Transformations