Interface With Wannier90
The module TightBindingApproximation.Wannier90
offers utilities to parse data from Wannier90 input and output files to ensure the compatibility with both the QuantumLattices and TightBindingApproximation frameworks.
Silicon as a concrete example
Before using the code examples, you need to prepare a set of Wannier90 input and output files. For convenience, we provide a pre-generated dataset as a Julia artifact. To use it, include an Artifacts.toml
file in your working directory with the following content:
[WannierDataSets]
git-tree-sha1 = "d69063bceff09edd6f55fcc9f5989c406d37d1b9"
[[WannierDataSets.download]]
sha256 = "2205f49c1374b1c834b5f8dd4d3b9c2f97a5f96eb0a4b338bc7da29642787e69"
url = "https://gist.github.com/waltergu/1821d4285e35de366dbabb5513c23f6f/raw/d69063bceff09edd6f55fcc9f5989c406d37d1b9.tar.gz"
Then this artifact can be used by the following codes as if it were a folder:
using Artifacts
using Pkg
toml = Artifacts.find_artifacts_toml(@__DIR__)
# Directory to contain Wannier90 output files
dir = Pkg.Artifacts.ensure_artifact_installed("WannierDataSets", toml)
Then a Wannier90 tight-binding system can be constructed by reading the data from Wannier90 input and output files:
using Plots
using QuantumLattices
using TightBindingApproximation
using TightBindingApproximation.Wannier90
# seedname of Wannier90 output file
seedname = "silicon"
# Read data from seedname.win, seedname_centres.xyz and seedname_hr.dat,
# and construct the Wannier90 tight-binding system
wan = Algorithm(:silicon, W90(dir, seedname))
Now we plot the energy bands interpolated by Wannier90 versus those computed directly from wan
for comparison:
# Read the reciprocal path from seedname.win
path = readpath(dir, seedname)
# Read the energy bands computed by Wannier90 from seedname_band.dat
bands = readbands(dir, seedname)
# Plot the energy bands computed by Wannier90 versus those by `wan` for comparison
plt = plot()
plot!(plt, bands...; xlim=(0.0, distance(path)), label=false, color=:green, alpha=0.6, lw=2.5)
plot!(plt, wan(:EB, EnergyBands(path)), color=:black)
The constructed wan
can be converted to a normal tight-binding system
# Define the hilbert space. Note that `hilbert.nspin` is 1
# This is because in silicon, the spin-orbital coupling is omitted
# Therefore, seedname_hr.dat in fact describes a spinless system
hilbert = Hilbert(Fock{:f}(4, 1), length(wan.frontend.lattice))
# Convert `wan` to a normal tight-binding system
# Note when `complement_spin=false`, the converted system is also spinless
tba = Algorithm(wan, hilbert; complement_spin=false)
plt = plot()
plot!(plt, bands...; xlim=(0.0, distance(path)), label=false, color=:green, alpha=0.6, lw=2.5)
plot!(plt, tba(:EB, EnergyBands(path)), color=:black)
# When `complement_spin=true`, the converted system is spinful
tba = Algorithm(wan, hilbert; complement_spin=true)
plt = plot()
plot!(plt, bands...; xlim=(0.0, distance(path)), label=false, color=:green, alpha=0.6, lw=2.5)
plot!(plt, tba(:EB, EnergyBands(path)), color=:black)
Manual
New types to implement the underlying mechanism of QuantumLattices and TightBindingApproximation specified for Wannier90 data:
TightBindingApproximation.Wannier90.W90Hoppings
— TypeW90Hoppings <: OperatorPack{Matrix{Float64}, NTuple{3, Int}}
Hopping amplitudes among the Wannier orbitals in two unitcells with a fixed relative displacement.
Here,
- the
:value
attribute represents the hopping amplitude matrix of Wannier orbitals, - the
:id
attribute represents the relative displacement of the two unitcells in basis of the lattice translation vectors.
TightBindingApproximation.Wannier90.W90Matrixization
— TypeW90Matrixization{V<:AbstractVector{<:Real}} <: Matrixization
Matrixization of the Hamiltonian obtained from Wannier90.
TightBindingApproximation.Wannier90.W90
— TypeW90 <: TBA{Fermionic{:TBA}, OperatorSum{W90Hoppings, NTuple{3, Int}}, Nothing}
A quantum lattice system based on the information obtained from Wannier90.
Read data from Wannier90 input and output files to construct the Wannier90 tight-binding system:
TightBindingApproximation.Wannier90.readlattice
— Functionreadlattice(path::AbstractString, seedname::AbstractString; name::Symbol=Symbol(seedname), projection::Bool=true) -> Lattice{3, Float64, 3}
Read the lattice from the Wannier90 ".win" input file with a given name
.
Besides, projection
specifies whether only the sites with initial projections in the Wannier90 ".win" input file are included in the constructed lattice.
readlattice(path::AbstractString; name::Symbol=:lattice) -> Lattice{3, Float64, 3}
Read the lattice from the "POSCAR" file with a given name
.
TightBindingApproximation.Wannier90.readcenters
— Functionreadcenters(path::AbstractString, seedname::AbstractString) -> Matrix{Float64}
Read the centers of Wannier functions from the Wannier90 "_centres.xyz" output data file.
TightBindingApproximation.Wannier90.readhamiltonian
— Functionreadhamiltonian(path::AbstractString, seedname::AbstractString) -> OperatorSum{W90Hoppings, NTuple{3, Int}}
Read the hamiltonian from the Wannier90 "_hr.dat" output data file.
Read data from Wannier90 input files for more information:
TightBindingApproximation.Wannier90.readpath
— Functionreadpath(path::AbstractString, seedname::AbstractString; length=nothing) -> ReciprocalPath
Read the reciprocal path along which to plot the energy bands from the Wannier90 ".win" input file.
Read results from Wannier90 output files:
TightBindingApproximation.Wannier90.readbands
— Functionreadbands(path::AbstractString, seedname::AbstractString) -> Tuple{Vector{Float64}, Matrix{Float64}}
Read the energy bands from the Wannier90 "band.dat" output data file when the "bandsplot" parameter in the Wannier90 ".win" input file is set to be true.
New types and functions to help implement the conversion to a normal tight-binding system:
TightBindingApproximation.Wannier90.Operatorization
— TypeOperatorization <: LinearTransformation
Operatorize the hopping amplitudes among Wannier orbitals.
QuantumLattices.Frameworks.Algorithm
— TypeAlgorithm(wan::Algorithm{W90}, hilbert::Hilbert; complement_spin::Bool=false, tol::Real=1e-6)
Convert a Wannier90 tight-binding system to the operator formed one.
Other utilities:
TightBindingApproximation.Wannier90.findblock
— Functionfindblock(name::String, content::String) -> Union{Nothing, Vector{SubString{String}}}
Find a named block in the content of the Wannier90 ".win" input file.