Skip to content

Commit 2462bc5

Browse files
committed
Optimize Amn computation by using less G vectors
1 parent 3cb17a5 commit 2462bc5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/external/wannier_shared.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ struct DoubleGaussianWannierProjection <: WannierProjection
4646
end
4747

4848
function get_fourier_projection_coefficients(proj::DoubleGaussianWannierProjection, qs)
49-
get_fourier_projection_coefficients(proj.proj1, qs) .+ (proj.factor2 .* get_fourier_projection_coefficients(proj.proj2, qs))
49+
proj.factor1 .* get_fourier_projection_coefficients(proj.proj1, qs)
50+
.+ proj.factor2 .* get_fourier_projection_coefficients(proj.proj2, qs)
5051
end
5152

5253
function DoubleGaussianWannierProjection(factor1::Number, center1::AbstractVector{Float64}, factor2::Number, center2::AbstractVector{Float64})
@@ -269,10 +270,10 @@ function compute_amn_kpoint(basis::PlaneWaveBasis, ψk, kpt, projections::Abstra
269270
# Compute Ak
270271
for n in 1:n_wannier
271272
proj = projections[n]
272-
# Functions are l^2 normalized in Fourier, in DFTK conventions.
273-
norm_gn_per = norm(get_fourier_projection_coefficients(proj, qs), 2)
273+
gn_per = get_fourier_projection_coefficients(proj, qs[kpt.mapping])
274274
# Fourier coeffs of gn_per for k+G in common with ψk
275-
coeffs_gn_per = get_fourier_projection_coefficients(proj, qs[kpt.mapping]) ./ norm_gn_per
275+
# Functions are l^2 normalized in Fourier, in DFTK conventions.
276+
coeffs_gn_per = gn_per ./ norm(gn_per)
276277
# Compute overlap
277278
for m in 1:n_bands
278279
# TODO Check the ordering of m and n here!

0 commit comments

Comments
 (0)