Skip to content

Commit

Permalink
Add Wannier interpolated bands (#1)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael F. Herbst <[email protected]>
  • Loading branch information
qiaojunfeng and mfherbst authored May 22, 2023
1 parent bec7bf1 commit df25fbd
Show file tree
Hide file tree
Showing 3 changed files with 606 additions and 12 deletions.
45 changes: 43 additions & 2 deletions 3-wannierisation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ begin
using LazyArtifacts
using DFTK
using PlutoUI
using PlutoPlotly
using Plots
using SpecialFunctions
using Unitful
using UnitfulAtomic
using Wannier
import WannierPlots
end

# ╔═╡ b0e511c4-1fbc-42b5-9a25-030a28fe022f
Expand Down Expand Up @@ -118,10 +120,43 @@ wann_model = only(

# ╔═╡ c5b2f3ac-02f8-4363-a925-32c132a1a0e2
md"""
!!! danger "TODO Visualisation"
Currently WannierPlots is still private ...
Now let's use Wannier functions to interpolate band structures, and compare with DFTK bands.
We first construct a `Wannier.InterpModel` specifically for Wannier interpolations. This lets us interpolate band structures using `Wannier.interpolate`, which returns a `Brillouin.KPathInterpolant` storing the kpoint coordinates on a kpath, and a matrix that contains eigenvalues.
"""

# ╔═╡ 29a426dd-34dd-4463-943d-1f01554cdc6e
begin
interp_model = Wannier.InterpModel(wann_model)
kinter, bands_wann = Wannier.interpolate(interp_model)
end

# ╔═╡ aef8f91e-ff76-4420-8103-03b1a59f8403
md"""
The `Brillouin.KPathInterpolant` is also understood by DFTK, which we can leverage to compute the exact DFT band energies.
"""

# ╔═╡ 704fa624-ffd8-431b-a6cb-e2f41fce0e9b
dftk_bands = DFTK.compute_bands(scfres.basis, kinter; scfres.ρ);

# ╔═╡ a5250227-de3a-4f80-b114-45633107dbe5
md"""
Since DFTK uses atomic units, but `Wannier.interpolate` is hard-coded to electron volts, we also convert the DFTK data to `eV` and finally compare the two band structures.
"""

# ╔═╡ e02c8fc7-fb01-460d-a3b8-23c2045f6666
begin
to_eV(x) = ustrip(auconvert(u"eV", x))
bands_dftk = to_eV.(hcat(dftk_bands.λ...))
fermi_energy = to_eV(scfres.εF)
end;

# ╔═╡ d2ba1b6b-e51c-4779-8dae-c6e390f2adfa
# wrap plot function so it works in Pluto notebook
PlutoPlot(
WannierPlots.plot_band_diff(kinter, bands_dftk, bands_wann; fermi_energy).plot
)

# ╔═╡ Cell order:
# ╠═2bc86db6-f71a-11ed-1da5-fde04331397a
# ╠═b0e511c4-1fbc-42b5-9a25-030a28fe022f
Expand All @@ -132,3 +167,9 @@ md"""
# ╠═89498877-ad4c-4d80-9661-54bf2ffafc4c
# ╠═5983120f-9b88-4795-b469-0752c7773efd
# ╟─c5b2f3ac-02f8-4363-a925-32c132a1a0e2
# ╠═29a426dd-34dd-4463-943d-1f01554cdc6e
# ╟─aef8f91e-ff76-4420-8103-03b1a59f8403
# ╠═704fa624-ffd8-431b-a6cb-e2f41fce0e9b
# ╟─a5250227-de3a-4f80-b114-45633107dbe5
# ╠═e02c8fc7-fb01-460d-a3b8-23c2045f6666
# ╠═d2ba1b6b-e51c-4779-8dae-c6e390f2adfa
Loading

0 comments on commit df25fbd

Please sign in to comment.