Skip to content

Commit

Permalink
Fix bugs of BrillouinZone, ReciprocalZone and ReciprocalPath.
Browse files Browse the repository at this point in the history
  • Loading branch information
waltergu committed Apr 18, 2022
1 parent 4430b62 commit eb4af62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Essentials/Spatials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,7 @@ struct BrillouinZone{K, P<:Momentum, S<:SVector} <: ReciprocalSpace{K, P}
end
end
@inline contentnames(::Type{<:BrillouinZone}) = (:reciprocals, :content)
@inline getcontent(bz::BrillouinZone, ::Val{:content}) = (bz.momenta,)
@inline getcontent(bz::BrillouinZone, ::Val{:content}) = bz.momenta

"""
BrillouinZone(reciprocals::AbstractVector, nk::Int)
Expand Down Expand Up @@ -1673,7 +1673,7 @@ struct ReciprocalZone{K, S<:SVector, V<:Number} <: ReciprocalSpace{K, S}
end
end
@inline contentnames(::Type{<:ReciprocalZone}) = (:content, :volume)
@inline getcontent(rz::ReciprocalZone, ::Val{:content}) = (rz.momenta,)
@inline getcontent(rz::ReciprocalZone, ::Val{:content}) = rz.momenta

"""
ReciprocalZone(momenta::AbstractVector, volume::Number)
Expand Down Expand Up @@ -1736,7 +1736,7 @@ struct ReciprocalPath{K, S<:SVector} <: ReciprocalSpace{K, S}
end
end
@inline contentnames(::Type{<:ReciprocalPath}) = (:content,)
@inline getcontent(rp::ReciprocalPath, ::Val{:content}) = (rp.momenta,)
@inline getcontent(rp::ReciprocalPath, ::Val{:content}) = rp.momenta

"""
ReciprocalPath(momenta::AbstractVector)
Expand Down
6 changes: 3 additions & 3 deletions test/Essentials/Spatials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ end
recipls = reciprocals([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]])
momenta = AbelianNumbers('C', [Momentum₂{9, 10}(j-1, i-1) for (i, j) in Iterators.flatten((Iterators.product(1:10, 1:9),))], collect(0:90), :indptr)
bz = BrillouinZone(recipls, momenta)
@test getcontent(bz, Val(:content)) == (bz.momenta,)
@test getcontent(bz, Val(:content)) == bz.momenta
@test dtype(bz) == dtype(typeof(bz)) == Float
@test bz == BrillouinZone(Momentum₂{9, 10}, recipls)

Expand All @@ -376,7 +376,7 @@ end
@test contentnames(ReciprocalZone) == (:content, :volume)

rz = ReciprocalZone([[1.0]], length=10)
@test getcontent(rz, :content) == (rz.momenta,)
@test getcontent(rz, :content) == rz.momenta
@test rz == ReciprocalZone(rz.momenta, rz.volume)
@test rz == ReciprocalZone([[1.0]], Segment(-1//2, 1//2, 10))
@test rz == ReciprocalZone([[1.0]], (Segment(-1//2, 1//2, 10),))
Expand Down Expand Up @@ -404,7 +404,7 @@ end
s₃ = Segment((0.5, 0.5), (0.0, 0.0), 100)

rp = ReciprocalPath([b₁, b₂], s₁, s₂, s₃)
@test getcontent(rp, :content) == (rp.momenta,)
@test getcontent(rp, :content) == rp.momenta
@test rp == ReciprocalPath(rp.momenta)
@test rp == ReciprocalPath([b₁, b₂], (s₁, s₂, s₃))

Expand Down

0 comments on commit eb4af62

Please sign in to comment.