Skip to content

Commit

Permalink
Option for low-pass filtering in LDOS
Browse files Browse the repository at this point in the history
  • Loading branch information
mfherbst committed Jan 29, 2022
1 parent fa0d445 commit 4c0bf60
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/scf/chi0models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ For details see Herbst, Levitt 2020 arXiv:2009.01665
"""
@kwdef struct LdosModel <: χ0Model
adjust_temperature = IncreaseMixingTemperature()
characteristic_length = 0 # in Bohr (0 means low-pass filtering is disabled)
# Good values for filtering are between 2 and 0.1 Bohr
end
function (χ0::LdosModel)(basis; eigenvalues, ψ, εF, kwargs...)
n_spin = basis.model.n_spin_components
Expand All @@ -28,6 +30,16 @@ function (χ0::LdosModel)(basis; eigenvalues, ψ, εF, kwargs...)
return nothing
end

if χ0.characteristic_length > 0
length_fourier = 2π / χ0.characteristic_length
G₀ = 2length_fourier / 3
Gslope = length_fourier / 6
f_lowpass(G) = (1 - erf((G - G₀) / Gslope))/ 2

lowpass = [f_lowpass(norm(G)) for G in G_vectors_cart(basis)]
ldos = G_to_r(basis, r_to_G(basis, ldos) .* lowpass)
end

tdos = sum(sum, ldos) * basis.dvol # Integrate LDOS to form total DOS
function apply!(δρ, δV, α=1)
δεF = dot(ldos, δV) .* basis.dvol
Expand Down
4 changes: 2 additions & 2 deletions src/scf/mixing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ end
# I also tried experimenting with some low-pass filtering in the LdosModel, but
# so far without a fully satisfactory result. As of now LdosMixing should be avoided
# with potential mixing.
@warn("LdosMixing / χ0Mixing not yet fine-tuned for potential mixing. " *
"Make sure use use sufficient k-Point sampling. Use at your own risk.", maxlog=1)
@warn("LdosMixing / χ0Mixing not yet fine-tuned for potential mixing. You're on your own. " *
"Make sure to use sufficient k-Point sampling and maybe low-pass filtering.", maxlog=1)

# Solve ε δV = δF with ε = (1 - vc χ₀) and χ₀ given as the sum of the χ0terms
devec(x) = reshape(x, size(δF))
Expand Down

0 comments on commit 4c0bf60

Please # to comment.