# Crystals

## Constructors and types

`Electrum.AbstractCrystal`

— Type`AbstractCrystal{D}`

A crystal structure in `D`

dimensions, containing information about the lattice, space group, and atoms contained within the crystal.

`Electrum.Crystal`

— Type`Crystal{D} <: AbstractCrystal{D}`

A crystal structure in `D`

dimensions. Contains information about the lattice, space group, and atoms. This is a mutable data structure.

At minimum, a list of atomic positions (as an `AtomList`

) is needed to generate a `Crystal`

. Optionally, space group number and the origin of the space group may be provided.

A transform may also be specified that converts the basis vectors of the `AtomList`

to a favored representation, most often the conventional lattice. If it is not specified, it is filled with an identity matrix by default. The matrix is right-multiplied with the basis vectors to produce the favored representation. Because the rows of the transformation naturally correspond to the operations performed on each constituent basis vector, it may be easier to enter the transform as a transpose (or equivalently, an adjoint) when entered manually.

`Electrum.CrystalWithDatasets`

— Type`CrystalWithDatasets{D,K,V} <: AbstractCrystal{D}`

A pairing of a `Crystal{D}`

and a `Dict{K,V}`

which allows for access to associated datasets.

## Methods

`Electrum.generators`

— Function`generators(xtal::AbstractCrystal{D}) -> PeriodicAtomList{D}`

Returns the list of generating atomic positions associated with a `Crystal`

or `CrystalWithDatasets`

.

Note that this does not convert the input to a `PeriodicAtomList`

with all atomic positions; only the minimal set that's needed to generate the atoms given the space group symmetry. To enumerate all of the atoms, use `convert(PeriodicAtomList, xtal)`

or `PeriodicAtomList(xtal)`

.

`Electrum.get_transform`

— Function`get_transform(xtal::AbstractCrystal{D}) -> SMatrix{D,D,Int}`

Returns the transformation matrix associated with an `AbstractCrystal`

.

`Electrum.set_transform!`

— Function`set_transform!(xtal::AbstractCrystal, M) -> AbstractCrystal`

Sets the transform supplied with an `AbstractCrystal`

. The transform can be an integer matrix, vector, scalar, or `UniformScaling`

, which is converted to an `SMatrix{D,D,Int}`

when stored.

The function returns the modified input for convenience.