Skip to content

Commit

Permalink
fix normscale! for Gs :: Nothing and normalize rescaling for `Gs …
Browse files Browse the repository at this point in the history
…:: ReciprocalLattice`
  • Loading branch information
thchr committed Mar 11, 2022
1 parent 166e995 commit 387362a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Crystalline"
uuid = "ae5e2be0-a263-11e9-351e-f94dad1eb351"
authors = ["Thomas Christensen <[email protected]>"]
version = "0.4.14"
version = "0.4.15"

[deps]
Bravais = "ada6cbde-b013-4edf-aa94-f6abe8bd6e6b"
Expand Down
5 changes: 3 additions & 2 deletions src/lattices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

2 comments on commit 387362a

@thchr
Copy link
Owner Author

@thchr thchr commented on 387362a Mar 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/56437

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.15 -m "<description of version>" 387362ae5d5c2f24be36cf83e5897ad2ff1cb56c
git push origin v0.4.15

Please sign in to comment.