Skip to content

Commit

Permalink
Fix shift
Browse files Browse the repository at this point in the history
  • Loading branch information
singularitti committed Oct 8, 2023
1 parent 4ac6d5e commit fca1706
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/shifted.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ end

# basisvectors(lattice::ShiftedLattice) = basisvectors(lattice.original) .+ Ref(lattice.by)

shift(lattice::Lattice, 𝐱::AbstractVector) = Lattice(lattice .+ 𝐱)
function shift(lattice::Lattice, 𝐱::AbstractVector)
T = Base.promote_eltype(lattice, 𝐱)
return ShiftedLattice(convert(Lattice{T}, lattice), SVector{3,T}(𝐱))
end
function shift(lattice::Lattice, x::Integer, y::Integer, z::Integer)
𝐚, 𝐛, 𝐜 = basisvectors(lattice)
return shift(lattice, x * 𝐚 + y * 𝐛 + z * 𝐜)
Expand Down

0 comments on commit fca1706

Please sign in to comment.