Spatials

QuantumLattices.QuantumNumbers.Momentum₁Method
Momentum₁{N}(momentum::AbstractVector, reciprocals::AbstractVector{<:AbstractVector}) where N
Momentum₂{N₁, N₂}(momentum::AbstractVector, reciprocals::AbstractVector{<:AbstractVector}) where {N₁, N₂}
Momentum₃{N₁, N₂, N₃}(momentum::AbstractVector, reciprocals::AbstractVector{<:AbstractVector}) where {N₁, N₂, N₃}

Construct a quantum momentum by the coordinates.

source
QuantumLattices.Spatials.AbstractLatticeType
AbstractLattice{N, D<:Number, M}

Abstract type of a unitcell-described lattice.

It should have the following contents:

  • name::Symbol: the name of the lattice
  • coordinates::Matrix{D}: the coordinates of the lattice
  • vectors::SVector{M, SVector{N, D}}: the translation vectors of the lattice
source
QuantumLattices.Spatials.BrillouinZoneMethod
BrillouinZone(reciprocals::AbstractVector{<:AbstractVector}, nk)
BrillouinZone{K}(reciprocals::AbstractVector{<:AbstractVector}, nk) where K
BrillouinZone(::Type{P}, reciprocals::AbstractVector{<:AbstractVector}) where {P<:Momentum}
BrillouinZone{K}(::Type{P}, reciprocals::AbstractVector{<:AbstractVector}) where {K, P<:Momentum}

Construct a Brillouin zone.

source
QuantumLattices.Spatials.LatticeType
Lattice{N, D<:Number, M} <: AbstractLattice{N, D, M}

Simplest lattice.

A simplest lattice can be constructed from its coordinates and translation vectors.

source
QuantumLattices.Spatials.LatticeMethod
Lattice(lattice::AbstractLattice, ranges::NTuple{N, Int}, boundaries::NTuple{N, Char}=ntuple(i->'O', Val(N)); mode::Symbol=:nonnegative) where N
Lattice(lattice::AbstractLattice, ranges::NTuple{N, UnitRange{Int}}, boundaries::NTuple{N, Char}=ntuple(i->'O', Val(N))) where N

Construct a lattice from the translations of another.

source
QuantumLattices.Spatials.LatticeMethod
Lattice(coordinates::NTuple{N, Number}...; name::Symbol=:lattice, vectors::Union{AbstractVector{<:AbstractVector{<:Number}}, Nothing}=nothing) where N
Lattice(coordinates::AbstractVector{<:Number}...; name::Symbol=:lattice, vectors::Union{AbstractVector{<:AbstractVector{<:Number}}, Nothing}=nothing)

Construct a lattice.

source
QuantumLattices.Spatials.NeighborsMethod
Neighbors(lattice::AbstractLattice, nneighbor::Integer; coordination::Int=12)

Get the neighbor vs. bond length map of a lattice up to the nneighborth order.

source
QuantumLattices.Spatials.PointMethod
Point(site::Integer, rcoordinate::SVector{N, D}, icoordinate::SVector{N, D}) where {N, D<:Number}
Point(site::Integer, rcoordinate::NTuple{N, <:Number}, icoordinate::NTuple{N, <:Number}=ntuple(i->0, N)) where N
Point(site::Integer, rcoordinate::AbstractVector{<:Number}, icoordinate::AbstractVector{<:Number}=zero(SVector{length(rcoordinate), Int}))

Construct a labeled point.

source
QuantumLattices.Spatials.ReciprocalPathMethod
ReciprocalPath(reciprocals::AbstractVector{<:AbstractVector}, contents::NamedTuple{(:points, :labels), <:Tuple{<:Tuple, <:Tuple}}; length=100, ends=nothing)
ReciprocalPath(reciprocals::AbstractVector{<:AbstractVector}, points::NTuple{N, Number}...; labels=points, length=100, ends=nothing) where N
ReciprocalPath(reciprocals::AbstractVector{<:AbstractVector}, points::Tuple{Vararg{NTuple{N, Number}}}; labels=points, length=100, ends=nothing) where N
ReciprocalPath(reciprocals::AbstractVector{<:AbstractVector}, segments::Pair{<:NTuple{N, Number}, <:NTuple{N, Number}}...; labels=segments, length=100, ends=nothing) where N
ReciprocalPath(reciprocals::AbstractVector{<:AbstractVector}, segments::Tuple{Vararg{Pair{<:NTuple{N, Number}, <:NTuple{N, Number}}}}; labels=segments, length=100, ends=nothing) where N

ReciprocalPath{K}(reciprocals::AbstractVector{<:AbstractVector}, contents::NamedTuple{(:points, :labels), <:Tuple{<:Tuple, <:Tuple}}; length=100, ends=nothing) where K
ReciprocalPath{K}(reciprocals::AbstractVector{<:AbstractVector}, points::NTuple{N, Number}...; labels=points, length=100, ends=nothing) where {K, N}
ReciprocalPath{K}(reciprocals::AbstractVector{<:AbstractVector}, points::Tuple{Vararg{NTuple{N, Number}}}; labels=points, length=100, ends=nothing) where {K, N}
ReciprocalPath{K}(reciprocals::AbstractVector{<:AbstractVector}, segments::Pair{<:NTuple{N, Number}, <:NTuple{N, Number}}...; labels=segments, length=100, ends=nothing) where {K, N}
ReciprocalPath{K}(reciprocals::AbstractVector{<:AbstractVector}, segments::Tuple{Vararg{Pair{<:NTuple{N, Number}, <:NTuple{N, Number}}}}; labels=segments, length=100, ends=nothing) where {K, N}

Construct a path in the reciprocal space.

When length is an integer, it specifies the length of each segment except for the last whose length will be length+1. When ends is nothing, the start point will be included while the end point will be not for each segment except for the last whose both points will be included.

source
QuantumLattices.Spatials.ReciprocalZoneMethod
ReciprocalZone(reciprocals::AbstractVector{<:AbstractVector}; length=100, ends=(true, false))
ReciprocalZone(reciprocals::AbstractVector{<:AbstractVector}, bounds::Pair{<:Number, <:Number}...; length=100, ends=(true, false))
ReciprocalZone(reciprocals::AbstractVector{<:AbstractVector}, bounds::Union{Tuple{Vararg{Pair{<:Number, <:Number}}}, Vector{<:Pair{<:Number, <:Number}}}; length=100, ends=(true, false))

ReciprocalZone{K}(reciprocals::AbstractVector{<:AbstractVector}; length=100, ends=(true, false)) where K
ReciprocalZone{K}(reciprocals::AbstractVector{<:AbstractVector}, bounds::Pair{<:Number, <:Number}...; length=100, ends=(true, false)) where K
ReciprocalZone{K}(reciprocals::AbstractVector{<:AbstractVector}, bounds::Union{Tuple{Vararg{Pair{<:Number, <:Number}}}, Vector{<:Pair{<:Number, <:Number}}}; length=100, ends=(true, false)) where K

Construct a rectangular zone in the reciprocal space.

source
QuantumLattices.Spatials.@hexagon_strMacro
hexagon"P₁-P₂-P₃-..."
hexagon"P₁-P₂-P₃-..., 120°"
hexagon"P₁-P₂-P₃-..., 60°"

Construct a tuple of start-stop point pairs for the hexagonal reciprocal space.

source
Base.eltypeMethod
eltype(bond::Bond)
eltype(::Type{<:Bond{K, P} where K}) where {P<:Point}

Get the point type contained in a generic bond.

source
Base.getindexMethod
getindex(lattice::AbstractLattice, i::Integer) -> SVector

Get the ith coordinate.

source
Base.getindexMethod
getindex(bond::Bond, i::Integer) -> Point

Get the ith point contained in a generic bond.

source
Base.iterateFunction
iterate(bond::Bond, state=1)

Iterate over the points contained in a generic bond.

source
Base.lengthMethod
length(lattice::AbstractLattice) -> Int

Get the number of points contained in a lattice.

source
Base.lengthMethod
length(bond::Bond) -> Int

Get the number of points contained in a generic bond.

source
Base.stepMethod
step(path::ReciprocalPath, i::Int) -> dtype(path)

Get the step between the ith and the (i+1)th points in the path.

source
QuantumLattices.Spatials.bonds!Method
bonds!(bonds::Vector, lattice::AbstractLattice, nneighbor::Int; coordination::Int=12)
bonds!(bonds::Vector, lattice::AbstractLattice, neighbors::Neighbors) -> typeof(bonds)

Get the required bonds of a lattice and append them to the input bonds.

source
QuantumLattices.Spatials.bondsMethod
bonds(lattice::AbstractLattice, nneighbor::Int; coordination::Int=12) -> Vector{Bond{Int, Point{dimension(lattice), dtype(lattice)}}}
bonds(lattice::AbstractLattice, neighbors::Neighbors) -> Vector{Bond{keytype(neighbors), Point{dimension(lattice), dtype(lattice)}}}

Get the required bonds of a lattice.

source
QuantumLattices.Spatials.directionMethod
direction(v::Char, args...) -> SVector{3}
direction(v::Number, unit::Symbol) -> SVector{2}
direction(v::Tuple{Number, Number}, unit::Symbol) -> SVector{3}
direction(v::AbstractVector{<:Number}, args...) -> AbstractVector

Get the unit vector that specifies the direction of a vector.

source
QuantumLattices.Spatials.distanceMethod
distance(p₁::AbstractVector{<:Number}, p₂::AbstractVector{<:Number}) -> Number

Get the distance between two points.

Note

Compared to norm(p₁-p₂), this function avoids the memory allocation for p₁-p₂, thus is more efficient.

source
QuantumLattices.Spatials.distanceMethod
distance(path::ReciprocalPath) -> dtype(path)
distance(path::ReciprocalPath, i::Int) -> dtype(path)
distance(path::ReciprocalPath, i::Int, j::Int) -> dtype(path)

Get the distance

  1. of the total path,
  2. from the start point to the ith point in the path,
  3. from the ith point to the jth point in the path (when i is greater than j, the value is negative).
source
QuantumLattices.Spatials.interlinksMethod
interlinks(cluster₁::AbstractMatrix{<:Number}, cluster₂::AbstractMatrix{<:Number}, neighbors::Neighbors) -> Vector{Tuple{Int, Int, Int}}

Use kdtree to get the intercluster nearest neighbors.

source
QuantumLattices.Spatials.isintratriangleMethod
isintratriangle(
    p::AbstractVector{<:Number}, p₁::AbstractVector{<:Number}, p₂::AbstractVector{<:Number}, p₃::AbstractVector{<:Number};
    vertexes::NTuple{3, Bool}=(true, true, true), edges::NTuple{3, Bool}=(true, true, true), atol::Real=atol, rtol::Real=rtol
) -> Bool

Judge whether a point belongs to the interior of a triangle whose vertexes are p₁, 'p₂' and p₃ with the give tolerance. vertexes and edges define whether the interior should contain the vertexes or edges, respectively.

Note
  1. The vertexes are in the order (p₁, p₂, p₃) and the edges are in the order (p1p2, p2p3, p3p1).
  2. The edges do not contain the vertexes.
source
QuantumLattices.Spatials.isonlineMethod
isonline(
    p::AbstractVector{<:Number}, p₁::AbstractVector{<:Number}, p₂::AbstractVector{<:Number};
    ends::Tuple{Bool, Bool}=(true, true), atol::Real=atol, rtol::Real=rtol
) -> Bool

Judge whether a point is on a line segment whose end points are p₁ and p₂ with the given tolerance. ends defines whether the line segment should contain its ends.

source
QuantumLattices.Spatials.isparallelMethod
isparallel(v₁::AbstractVector{<:Number}, v₂::AbstractVector{<:Number}; atol::Real=atol, rtol::Real=rtol) -> Int

Judge whether two vectors are parallel to each other with the given tolerance, 0 for not parallel, 1 for parallel and -1 for antiparallel.

source
QuantumLattices.Spatials.issubordinateMethod
issubordinate(coordinate::AbstractVector{<:Number}, vectors::AbstractVector{<:AbstractVector{<:Number}}; atol::Real=atol, rtol::Real=rtol) -> Bool

Judge whether a coordinate belongs to a lattice defined by vectors with the given tolerance.

source
QuantumLattices.Spatials.minimumlengthsFunction
minimumlengths(cluster::AbstractMatrix{<:Number}, vectors::AbstractVector{<:AbstractVector{<:Number}}, nneighbor::Int=1; coordination::Int=12) -> Vector{Float}

Use kdtree to search the lowest several minimum bond lengths within a lattice translated by a cluster.

When the translation vectors are not empty, the lattice will be considered periodic in the corresponding directions. Otherwise the lattice will be open in all directions. To search for the bonds across the periodic boundaries, the cluster will be pre-translated to become a supercluster, which has open boundaries but is large enough to contain all the nearest neighbors within the required order. The coordination parameter sets the average number of each order of nearest neighbors. If it is to small, larger bond lengths may not be searched, and the result will contain Inf. This is a sign that you may need a larger coordination. Another situation that Inf appears in the result occurs when the minimum lengths are searched in open lattices. Indeed, the cluster may be too small so that the required order just goes beyond it. In this case the warning message can be safely ignored.

source
QuantumLattices.Spatials.rotateMethod
rotate(vector::AbstractVector{<:Number}, angle::Number; axis::Tuple{Union{AbstractVector{<:Number}, Nothing}, Tuple{<:Number, <:Number}}=(nothing, (0, 0))) -> Vector{<:Number}
rotate(cluster::AbstractMatrix{<:Number}, angle::Number; axis::Tuple{Union{AbstractVector{<:Number}, Nothing}, Tuple{<:Number, <:Number}}=(nothing, (0, 0))) -> Matrix{<:Number}

Get a rotated vector/cluster of the original one by a certain angle around an axis.

The axis is determined by a point it gets through (nothing can be used to denote the origin), and its polar as well as azimuth angles in radians. The default axis is the z axis.

Note
  1. The result is given by the Rodrigues' rotation formula.
  2. Only 2 and 3 dimensional vectors can be rotated.
  3. When the input vectors are 2 dimensional, both the polar and azimuth of the axis must be 0.
source
QuantumLattices.Spatials.selectpathMethod
selectpath(brillouinzone::BrillouinZone, contents::NamedTuple{(:points, :labels), <:Tuple{<:Tuple, <:Tuple}}; ends=nothing, atol::Real=atol, rtol::Real=rtol)
selectpath(brillouinzone::BrillouinZone, points::NTuple{N, Number}...; labels=points, ends=nothing, atol::Real=atol, rtol::Real=rtol) where N -> Tuple(ReciprocalPath, Vector{Int})
selectpath(brillouinzone::BrillouinZone, points::Tuple{Vararg{NTuple{N, Number}}}; labels=points, ends=nothing, atol::Real=atol, rtol::Real=rtol) where N -> Tuple(ReciprocalPath, Vector{Int})
selectpath(brillouinzone::BrillouinZone, segments::Pair{<:NTuple{N, Number}, <:NTuple{N, Number}}...; labels=segments, ends=nothing, atol::Real=atol, rtol::Real=rtol) where N -> Tuple(ReciprocalPath, Vector{Int})
selectpath(brillouinzone::BrillouinZone, segments::Tuple{Vararg{Pair{<:NTuple{N, Number}, <:NTuple{N, Number}}}}; labels=segments, ends=nothing, atol::Real=atol, rtol::Real=rtol) where N -> Tuple(ReciprocalPath, Vector{Int})

Select a path from a BrillouinZone. Return a ReciprocalPath and the positions of the equivalent points in the BrillouinZone.

When ends is nothing, the start point will be included while the end point will be not for each segment except for the last whose both points will be included.

source
QuantumLattices.Spatials.shrinkMethod
shrink(reciprocalzone::ReciprocalZone{K}, ranges::Vararg{OrdinalRange{<:Integer}, N}) where {K, N} -> ReciprocalZone

Shrink a reciprocal zone.

source
QuantumLattices.Spatials.tileMethod
tile(cluster::AbstractMatrix{<:Number}, vectors::AbstractVector{<:AbstractVector{<:Number}}, translations) -> Matrix{<:Number}

Tile a supercluster by translations of the input cluster.

Basically, the final supercluster is composed of several parts, each of which is a translation of the original cluster, with the translation vectors specified by vectors and each set of the translation indices contained in translations. When translation vectors are empty, a copy of the original cluster will be returned.

source
QuantumLattices.Spatials.translateMethod
translate(cluster::AbstractMatrix{<:Number}, vector::AbstractVector{<:Number}) -> Matrix{vector|>eltype}

Get the translated cluster of the original one by a vector.

source
QuantumLattices.Spatials.volumeMethod
volume(vectors::AbstractVector{<:SVector}) -> Number
volume(v::AbstractVector{<:Number}) -> Number
volume(v₁::AbstractVector{<:Number}, v₂::AbstractVector{<:Number}) -> Number
volume(v₁::AbstractVector{<:Number}, v₂::AbstractVector{<:Number}, v₃::AbstractVector{<:Number}) -> Number

Get the volume spanned by the input vectors.

source
QuantumLattices.decomposeMethod
decompose(v₀::AbstractVector{<:Number}, v₁::AbstractVector{<:Number}) -> Tuple{Number}
decompose(v₀::AbstractVector{<:Number}, v₁::AbstractVector{<:Number}, v₂::AbstractVector{<:Number}) -> Tuple{Number, Number}
decompose(v₀::AbstractVector{<:Number}, v₁::AbstractVector{<:Number}, v₂::AbstractVector{<:Number}, v₃::AbstractVector{<:Number}) -> Tuple{Number, Number, Number}
decompose(v₀::AbstractVector{<:Number}, vs::AbstractVector{<:AbstractVector{<:Number}}) -> Vector{<:Number}

Decompose a vector with respect to input basis vectors.

source
QuantumLattices.dimensionMethod
dimension(lattice::AbstractLattice) -> Int
dimension(::Type{<:AbstractLattice{N}}) where N -> Int

Get the space dimension of the lattice.

source
QuantumLattices.dimensionMethod
dimension(bond::Bond) -> Int
dimension(::Type{<:Bond{K, P} where K}) where {P<:Point} -> Int

Get the space dimension of a concrete bond.

source
QuantumLattices.dtypeMethod
dtype(lattice::AbstractLattice)
dtype(::Type{<:AbstractLattice{N, D} where N}) where {D<:Number}

Get the data type of the coordinates of a lattice.

source
QuantumLattices.dtypeMethod
dtype(bond::Bond)
dtype(::Type{<:Bond{K, P} where K}) where {P<:Point}

Get the data type of the coordinates of the points contained in a generic bond.

source
QuantumLattices.dtypeMethod
dtype(point::Point)
dtype(::Type{<:Point{N, D} where N}) where {D<:Number}

Get the data type of the coordinates of a point.

source
QuantumLattices.expandMethod
expand(momentum::Momentum, reciprocals::AbstractVector{<:AbstractVector}) -> eltype(reciprocals)

Expand the momentum from integral values to real values with the given reciprocals.

source
RecipesBase.apply_recipeFunction
@recipe plot(lattice::AbstractLattice, neighbors::Union{Int, Neighbors}, filter::Function=bond->true; siteon=false)

Define the recipe for the visualization of a lattice.

source