Skip to content

Commit

Permalink
Created independent documentation for RealBasis, ReciprocalBasis,…
Browse files Browse the repository at this point in the history
… `AbstractBasis`, and `KPoint`
  • Loading branch information
brainandforce committed Nov 30, 2023
1 parent 7f6a540 commit 598dbb5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
26 changes: 23 additions & 3 deletions src/lattices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,32 @@ LatticeBasis{S,D}(::StaticArray) where {S,D} = _nonsquare_matrix_error()

Base.show(io::IO, b::LatticeBasis) = print(io, typeof(b), '(', b.matrix, ')')

"""
RealBasis{D,T} (alias for Electrum.LatticeBasis{ByRealSpace,D,T})
Represents a the basis vectors of a lattice in real space, with lengths given in units of bohr.
For more information about this type, see [`Electrum.LatticeBasis`](@ref).
"""
const RealBasis = LatticeBasis{ByRealSpace}
@doc (@doc LatticeBasis) RealBasis

"""
ReciprocalBasis{D,T} (alias for Electrum.LatticeBasis{ByRealSpace,D,T})
Represents a the basis vectors of a lattice in reciprocal space, with lengths given in units of
radians per bohr.
For more information about this type, see [`Electrum.LatticeBasis`](@ref).
"""
const ReciprocalBasis = LatticeBasis{ByReciprocalSpace}
@doc (@doc LatticeBasis) ReciprocalBasis

"""
AbstractBasis{D,T} (alias for Electrum.LatticeBasis{BySpace,D,T})
Supertype that contains `RealBasis{D,T}` and `ReciprocalBasis{D,T}`. Code that can dispatch on
either `RealBasis` or `ReciprocalBasis` can refer to this type.
"""
const AbstractBasis = LatticeBasis{<:BySpace}
@doc (@doc LatticeBasis) AbstractBasis

LatticeBasis{S,D,T}(t::Tuple) where {S,D,T} = LatticeBasis{S,D,T}(SMatrix{D,D}(t))
LatticeBasis{S,D,T}(M::AbstractMatrix) where {S,D,T} = LatticeBasis{S,D,T}(SMatrix{D,D}(M))
Expand Down
9 changes: 8 additions & 1 deletion src/vectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ struct ShiftVector{S<:BySpace,D,T<:Real} <: StaticVector{D,T}
end
end

"""
KPoint{D,T} (alias for ShiftVector{ByReciprocalSpace,D,T})
Represents a k-point, or an offset from the Γ point (origin) of reciprocal space, often used in band
structures, wavefunctions, or other electronic data.
For more information about this type, see [`ShiftVector`](@ref).
"""
const KPoint = ShiftVector{ByReciprocalSpace}
@doc (@doc ShiftVector) KPoint

# Needed to resolve method ambiguities
ShiftVector{S,D,T}(::StaticArray, ::Real = 1) where {S,D,T} = error("Argument must be a vector.")
Expand Down

0 comments on commit 598dbb5

Please sign in to comment.