Basics

Coordinate Types

LatticeTools.FractCoordType
FractCoord

Fractional coordinates.

Fields

  • whole::Vector{Int}: Integer part of fractional coordinates
  • fraction::Vector{Float64}: [0,1) part of fractional coordinates
source

Functions

LatticeTools.FractCoordMethod
FractCoord(w, f)

Arguments

  • w::AbstractVector{<:Integer}: whole part of the coordinate
  • f::AbstractVector{<:Real}: fractional part. In [0, 1).
source
LatticeTools.FractCoordMethod
FractCoord(coord)

Create a FractCoord from coord, where whole is determined by fld(x, 1) and fraction by mod(x, 1).

Arguments

  • coord::AbstractVector{<:Real}
source
LatticeTools.FractCoordMethod
FractCoord(ndim)

Construct a zero FractCoord of ndim dimensions.

Arguments

  • ndim::Integer: spatial dimensions
source
LatticeTools.fract2carteMethod
fract2carte(latticevectors, fc)

Arguments

  • latticevectors::AbstractArray{<:Real, 2}: square matrix whose columns are lattice vectors.
  • fc::FractCoord: fractional coordinates
source
LatticeTools.carte2fractMethod
carte2fract(latticevectors, cc; tol=√ϵ)

Arguments

  • latticevectors::AbstractArray{<:Real, 2}: square matrix whose columns are lattice vectors.
  • cc::CarteCoord: cartesian coordinates
  • tol::Real=Base.rtoldefault(Float64): tolerance
source

UnitCell

LatticeTools.UnitCellType
UnitCell{O}

Represent a unitcell of a lattice, which contains sites at fixed locations (does not yet implement multiple orbitals per site). It is recommended to use makeunitcell rather than the constructor to make a UnitCell object.

Parameters

  • O: type of "site". Any type can be used, but we recommend using String or tuple of String and Int for compatibility with JSON.

Fields

  • latticevectors::Array{Float64, 2}: Lattice vectors
  • reducedreciprocallatticevectors::Array{Float64, 2}: Reduced reciprocal lattice vectors (transpose of inverse of latticevectors)
  • reciprocallatticevectors ::Array{Float64, 2}: Reciprocal lattice vectors. 2π * reducedreciprocallatticevectors
  • sites::Vector{Tuple{T, FractCoord}}: List of sites within unit cell
  • siteindices::Dict{T, Int}: Indices of sites
source
LatticeTools.makeunitcellFunction
makeunitcell(latticevectors; SiteType=Any, tol=√ϵ)

Construct an n-dimensional lattice.

Arguments

  • latticevectors: Lattice vectors. Can be a nested array of lattice vectors, or a two-dimensional array whose columns are lattice vectors, or a real number.

Optional Arguments

  • SiteType::DataType
  • tol=√ϵ: Epsilon
source

Functions

LatticeTools.dimensionFunction
dimension(fc::FractCoord)

Dimension of the fractional coordinates

Arguments

  • fc::FractCoord: Fractional coordinates.
source
dimension(cube::Hypercube)

Return the spatial dimension of the hypercube.

source
dimension(uc)

Spatial dimension of the unit cell.

source
dimension(lattice)

Spatial dimension of the lattice.

Arguments

  • lattice::Lattice
source
dimension(arg::IdentityOperation)

Return the spatial dimension of the identity operation.

source
dimension(arg::TranslationOperation)

Spatial dimension of the translation operation

source
dimension(arg::PointOperation)

Return spatial dimension of arg.

source
dimension(arg::SpaceOperation)

Return the spatial dimension of arg.

source
dimension(sym::TranslationSymmetry)

Spatial dimension of the translation symmetry

source
dimension(sym::PointSymmetry)

Spatial dimension of the point symmetry

source
LatticeTools.addsite!Function
addsite!(unitcell, sitename, sitecoord)

Add an site to the unit cell.

Arguments

  • uc ::UnitCell{T}
  • sitename ::{T}
  • sitecoord ::FractCoord
source
LatticeTools.hassiteFunction
hassite(unitcell, name)

Test whether the unit cell contains the site of given name.

Arguments

  • unitcell::UnitCell{O}
  • name::O
source
LatticeTools.getsiteFunction
getsite(unitcell, name)

Get the site (its site name and its fractional coordinates) with the given name.

Arguments

  • unitcell::UnitCell{O}
  • name::O

Return

  • (sitename, fractcoord)
source
getsite(unitcell, index)

Arguments

  • unitcell::UnitCell
  • index::Integer

Return

  • (sitename, fractcoord)
source
LatticeTools.getsitecoordFunction
getsitecoord(unitcell, name)

Get the fractional coordinates of the site with the given name.

Arguments

  • uc ::UnitCell{O}
  • name ::O

Return

  • fractcoord
source
getsitecoord(unitcell, index)

Arguments

  • unitcell::UnitCell
  • index::Integer

Return

  • FractCoord
source
LatticeTools.carte2fractMethod
carte2fract(unitcell, cartecoord; tol=√ϵ)

Arguments

  • unitcell::UnitCell
  • cc::CarteCoord
  • tol::Real=Base.rtoldefault(Float64)
source
LatticeTools.whichunitcellFunction

whichunitcell(unitcell, name, cartecoord; tol=√ϵ)

Return

  • Vector{Int}: the integer coordinate of the unitcell that the specified site/cartesian coordinate belongs to.
source
whichunitcell(unitcell, name, fractcoord; tol=√ϵ)

Return

  • Vector{Int}: the integer coordinate of the unitcell that the specified site/fractional coordinate belongs to.
source
LatticeTools.momentumgridMethod
momentumgrid(unitcell, shape)

Generate an n-dimensional grid of momenta of given shape.

Returns an n-dimensional array of the following form: math k[i_1, i_2, \ldots ] = G \cdot ( \frac{i_1}{n_1}, \frac{i_2}{n_2}, \ldots )` where G is the reciprocal lattice vector

source
LatticeTools.findsiteindexFunction
findsiteindex(unitcell::UnitCell, fc::FractCoord; tol=√ϵ)

Find the index of the site, and the unitcell coordinate at the specified fractional coordinate.

Arguments

  • unitcell::UnitCell
  • fc::FractCoord

Returns

  • (site_index, unitcell_vector), or (-1, []) if not found.
source

Hypercube

LatticeTools.HypercubeType
Hypercube(shape)

Represent a hypercubic (Bravais) lattice.

Fields

  • shape_matrix: a matrix whose columns are the lattice vectors of the
  • inverse_shape_matrix: (shape_matrix)
  • wrap: periodic wrapping function which takes an integer array, and maps it onto a site in the Bravais lattice. Analogous to fldmod.
source
LatticeTools.volumeMethod
volume(cube::Hypercube)

Return the signed volume of the hypercube, defined by the determinant of the shape.

source
LatticeTools.find_generatorsMethod
find_generators(cube::Hypercube)

Find generators of an Hypercube. For one-dimensional lattice, which is isomorphic to Zₙ, the generator is +1. For two-dimensional lattices, this function invokes find_generators_2d. Higher dimensions are currently not supported.

source
LatticeTools.generate_coordinatesMethod
generate_coordinates(cube, generators)

Generate a list of coordinates of the hypercube

Arguments

  • cube::Hypercube
  • generator_translations::AbstractMatrix{<:Integer}
source

Lattice

LatticeTools.LatticeType
Lattice{O}

Represent a lattice.

Arguments

  • unitcell::UnitCell{O}
  • hypercube::Hypercube
  • bravais_coordinates::Vector{Vector{Int}}
  • supercell::UnitCell{Tuple{O, Vector{Int}}}
source
LatticeTools.makelatticeFunction
makelattice(unitcell, shape)

Create a Lattice from unitcell and shape. Generating translations are fouond using find_generators.

Arguments

  • unitcell
  • shape: shape of the cluster
source
makelattice(unitcell, shape, [generators])

Create a lattice with periodic boundary condition, using the unitcell, shape, and translation generators.

Arguments

  • unitcell::UnitCell{O}
  • shape_matrix::AbstractMatrix{<:Integer}: shape of the Bravais lattice. This can also be

a single integer, which is equivalent to a identity matrix times the number.

Optional Arguments

  • generator_translations::AbstractMatrix{<:Integer}
source
makelattice(unitcell, scale)

Construct a Lattice with unitcell having shape scale. Works for one-dimensional lattice.

source