From fca1706823706758938ac98685f5ad61f9fa2806 Mon Sep 17 00:00:00 2001 From: singularitti Date: Sun, 8 Oct 2023 03:18:39 -0400 Subject: [PATCH] Fix `shift` after https://github.com/MineralsCloud/CrystallographyCore.jl/pull/23 --- src/shifted.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shifted.jl b/src/shifted.jl index 417d74c..79cf009 100644 --- a/src/shifted.jl +++ b/src/shifted.jl @@ -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 * 𝐜)