From 387362ae5d5c2f24be36cf83e5897ad2ff1cb56c Mon Sep 17 00:00:00 2001 From: Thomas Christensen Date: Fri, 11 Mar 2022 12:18:48 -0500 Subject: [PATCH] fix `normscale!` for `Gs :: Nothing` and normalize rescaling for `Gs :: ReciprocalLattice` --- Project.toml | 2 +- src/lattices.jl | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index ce98ff45..db65fa7d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Crystalline" uuid = "ae5e2be0-a263-11e9-351e-f94dad1eb351" authors = ["Thomas Christensen "] -version = "0.4.14" +version = "0.4.15" [deps] Bravais = "ada6cbde-b013-4edf-aa94-f6abe8bd6e6b" diff --git a/src/lattices.jl b/src/lattices.jl index 07ad98b5..e9ed2b86 100644 --- a/src/lattices.jl +++ b/src/lattices.jl @@ -387,13 +387,14 @@ In-place equivalent of [`normscale`](@ref): mutates `flat`. """ function normscale!(flat::ModulatedFourierLattice{D}, expon::Real, Gs::Union{ReciprocalBasis{D}, Nothing} = nothing) where D + n₀ = isnothing(Gs) ? 1.0 : sum(norm, Gs)./D if !iszero(expon) orbits = getorbits(flat) @inbounds for i in eachindex(orbits) n = if isnothing(Gs) - norm(first(orbits[i]))^expon + norm(first(orbits[i])) else - norm(dot(Gs, first(orbits[i]))) + norm(dot(Gs, first(orbits[i]))) / n₀ end rescale_factor = n^expon rescale_factor == zero(rescale_factor) && continue # for G = [0,0,0] case