HopTB
Exported functions
HopTB.TBModel
— TypeTBModel{T<Number}
is a data type representing tight binding models.
Fields
norbits::Int64
: number of orbits in the modellat::SMatrix{3,3,Float64,9}
: primitive lattice vectors stored in columnsrlat::SMatrix{3,3,Float64,9}
: primitive reciprocal lattice vectors stored in columnshoppings::Dict{SVector{3,Int16},Matrix{T}}
: R -> ⟨0n|H|Rm⟩, where n is the first index and m is the second index.overlaps::Dict{SVector{3,Int16},Matrix{T}}
: R -> ⟨0n|Rm⟩positions::Dict{SVector{3,Int16},SVector{3,Matrix{T}}}
: R -> [⟨0n|rx|Rm⟩, ⟨0n|ry|Rm⟩, ⟨0n|rz|Rm⟩]isorthogonal
: whether the different orbitals of the model is orthogonal to each other.nsites::Union{Missing,Int16}
: It is possible that the orbitals can be grouped into several sites. Every group of orbitals should share the same position within the group, stored insite_positions
.site_norbits::Union{Missing,Vector{Int64}}
: number of orbitals for each site.site_positions::Union{Missing,Matrix{Float64}}
: position of sites stored in columnorbital_types::Union{Missing,Vector{Vector{Int16}}}
: It is possible that the orbitals have definite symmetry representations. Example:orbital_types = [[0], [0, 1]]
denotes that there are two sites, the first of which has 1 s orbital and the second of which has 1 s orbital and 1 p orbital (4 orbitals in total not counting spin). The orbitals of the TBModel should appear in a consistent order denoted byorbital_types
.isspinful::Union{Missing,Bool}
: If a TBModel is spinful, the first half of the orbitals should be spin up and the second half should be spin down. The two halves of the orbitals should be in one-to-one correspondence.is_canonical_ordered::Union{Missing,Bool}
: If the orbital types are know, andis_canonical_ordered
is true, then the orbitals are guaranteed to appear in a canonical order defined by decreasing Lz value. For example, canonical order of p orbitals should -px-ipy, pz, px-ipy. See the wikipedia for other orbitals.
Missing data
Not all fields of TBModels are required to have a valid value. For example, it is possible the site information is missing for some models. Here are some rules:
nsites
,site_norbits
,site_positions
should all either be missing or valid.orbital_types
can only be valid ifnsites
,site_norbits
andsite_positions
are valid.is_canonical_ordered
can only be valid iforbital_types
is valid.
Consistency check
Any functions that directly modifies a TBModel should always maintain the following consistencies (if relevant fields are not missing):
hoppings
,overlaps
andpositions
matrices should always be Hermitian.overlap[[0, 0, 0]]
should always be positive definite.diag(position[[0, 0, 0]][α])/diag(overlap[[0, 0, 0]])
should be consistent withsite_positions
.- number of orbits should be consistent.
HopTB.SharedTBModel
— TypeSharedTBModel
is a data type that encodes all the information of a TBModel
into several SharedArrays.
SharedTBModel
is generally more efficient than TBModel
. A typical workflow is to construct TBModel
and then convert it into a SharedTBModel
for large scale calculations.
Fields
norbits::Int64
: number of orbitsisorthogonal::Bool
: whether orbits of the model are orthonormallat::SMatrix{3,3,Float64,9}
: primitive lattice vectors stored in columnsrlat::SMatrix{3,3,Float64,9}
: primitive reciprocal lattice vectors stored in columnsRs::Matrix{Int16}
: R vectors stored in columns for hopping, overlap and position matrices. The number of R vectors is odd. The first R vector is [0, 0, 0]. For the rest of the matrixRs[:, 2:end]
, the first half and the second half is guaranteed to be in one-to-one correspondence R <-> -R.Rcs::Matrix{Float64}
: R vectors in Cartesian coordinates.H::SharedArray{T,2}
:H = reshape(Hmatrix, (norbits * norbits, :))
.Hmatrix[:, :, iR]
is ⟨0n|H|Rm⟩ where R isRs[:, iR]
. Since Hamiltonian is Hermitian, only first half R vectors inRs
are stored. In addition,Hmatrix[:, :, 1]
is different:Hmatrix[:, :, 1]
is ⟨0n|H|0m⟩/2.S::Union{Nothing,SharedArray{T,3}}
:S = reshape(Smatrix, (norbits * norbits, :))
.Smatrix[:, :, iR]
is ⟨0n|Rm⟩ where R isRs[:, iR]
. Since overlap matrix is Hermitian, only first half R vectors inRs
are stored. In addition,Smatrix[:, :, 1]
is different:Smatrix[:, :, 1]
is ⟨0n|0m⟩/2.r:SVector{3,SharedArray{T,2}}
:S[α] = reshape(Smatrices[α], (norbits * norbits, :))
.Smatrices[α][:, :, iR]
is ⟨0n|rα|Rm⟩ where R isRs[:, iR]
.
HopTB.sethopping!
— Functionsethopping!(ftm::FTBModel, R::AbstractVector{Int64}, n::Int64, m::Int64,
p::Int64, hopping::Number)
Set ⟨⟨0; n e^{-ilΩt}|H(t)|R; m e^{-i(l-p)Ωt}⟩⟩ to hopping
for all l. Alternatively, hopping
is ⟨n|H(p)|m⟩, where H(t) = ∑H(p)e^{-ipΩt}.
The Floquet Hamiltonian HF=H-i∂t, in the basis functions |n⟩e^{-ilΩt}, is (HF){l, l-p}=⟨⟨0; n e^{-ilΩt}|H(t)|R; m e^{-i(l-p)Ωt}⟩⟩-δ{p,0}lΩ. This function automatically handles the above δ function.
sethopping!(tm::TBModel{T}, R::AbstractVector{<:Integer}, n::Int64, m::Int64,
hopping::Number) where T
Set ⟨0n|H|Rm⟩ to hopping
for tm
.
HopTB.addhopping!
— Functionaddhopping!(ftm::FTBModel, R::AbstractVector{Int64}, n::Int64, m::Int64,
p::Int64, hopping::Number)
Add hopping
to ⟨⟨0; n e^{-ilΩt}|H(t)|R; m e^{-i(l-p)Ωt}⟩⟩.
This function does not add the onsite energy due to periodic driving.
addhopping!(tm::TBModel, R::AbstractVector{<:Integer}, hopping::Matrix{<:Number})
Add hopping
to the Hamiltonian of tm
.
hopping
should be a (tm.norbits, tm.norbits)
array containing the matrix ⟨0n|H|Rm⟩ with n and m indices. If R is [0, 0, 0], then hopping
needs to be Hermitian.
HopTB.setoverlap!
— Functionsetoverlap!(tm::TBModel{T}, R::AbstractVector{<:Integer}, n::Int64, m::Int64,
overlap::Number) where T
Set ⟨0n|Rm⟩ to overlap
for tm
.
HopTB.setposition!
— Functionsetposition!(
tm::TBModel,
R::AbstractVector{<:Integer},
n::Int64,
m::Int64,
α::Int64,
pos::Number;
position_tolerance::Real=1.0e-4
)
Set ⟨0n|$r_α$|Rm⟩ to pos
for tm
. Overlap matrices must be set before this method is called if tm
is not orthogonal.
position_tolerance
is used to check wehther the value is compatible with tm.site_positions
(if not missing).
HopTB.getdH
— FunctiongetdH(tm::AbstractTBModel, order::Tuple{Int64,Int64,Int64},
k::AbstractVector{<:Real})::Matrix{ComplexF64}
Calculate order
derivative of Hamiltonian.
HopTB.getdS
— FunctiongetdS(tm::AbstractTBModel, order::Tuple{Int64,Int64,Int64},
k::AbstractVector{<:Real})::Matrix{ComplexF64}
Calculate order
derivative of overlap.
HopTB.getdAw
— FunctiongetdAw(tm::AbstractTBModel, α::Int64, order::Tuple{Int64,Int64,Int64},
k::AbstractVector{<:Real})::Matrix{ComplexF64}
Calculate order
derivative of $i⟨u_n^{(W)}|∂_{k_α}u_m^{(W)}⟩$.
HopTB.getH
— FunctiongetH(tm::AbstractTBModel, k::AbstractVector{<:Real})::Matrix{ComplexF64}
Calculate Hamiltonian at a reduced k
point.
HopTB.getS
— FunctiongetS(tm::AbstractTBModel, k::AbstractVector{<:Real})::Matrix{ComplexF64}
Calculate overlap matrix at a reduced k
point.
HopTB.geteig
— Functiongeteig(tm::AbstractTBModel, k::AbstractVector{<:Real})::HermEig
Calculate eigenvalues and eigenvectors of tm
at a reduced k
point.
HopTB.getAw
— FunctiongetAw(tm::AbstractTBModel, α::Int64, k::AbstractVector{<:Real})::Matrix{ComplexF64}
Calculate $i⟨u_n^{(W)}|∂_{k_α}u_m^{(W)}⟩$.
HopTB.getdEs
— FunctiongetdEs(tm::AbstractTBModel, α::Int64, k::AbstractVector{<:Real})
-->dEs::Vector{Float64}
Calculate dE/dk for tm
at k
in the α
direction.
Calculation method is provided in [Wang et al, 2019]. The relevant equation is Eq. (13). Although in that equation, there is no energy different denominator, it is still implicitly assumed that the band is nondegenerate. Therefore, dEs[n] is only correct if n is nondegenerate or completely degenerate.
This function is memoized, which means the arguments and results of the function should never be modified.
getdEs(
tm::AbstractTBModel,
α::Integer,
β::Integer,
k::AbstractVector{<:Real}
) => dEs::Vector{Float64}
Calculate d^2 E / dkα dkβ for tm
at k
. α
and β
are Cartesian directions.
dEs[n] is only correct if n is nondegenerate or completely degenerate.
This function is memoized, which means the arguments and results of the function should never be modified.
HopTB.getA
— FunctiongetA(tm::AbstractTBModel, α::Int64, k::AbstractVector{<:Real})
-->A::Matrix{ComplexF64}
Calculate Berry connection $i⟨u_n|∂_α|u_m⟩$ for tm
at k
.
Calculation method is provided in [Wang et al, 2019]. The relevant equation is Eq. (14). Since Eq. (14) assumes band m is nondegenerate, A[n, m] is only correct if m is nondegenerate or completely degenerate.
HopTB.getdr
— Functionfunction getdr(tm::AbstractTBModel, α::Int64, β::Int64, k::AbstractVector{<:Real})
-->dr::Matrix{ComplexF64}
Compute $∂_β r_α$ for tm
at k
. r[n, m] = A[n, m] if n != m and r[n, n] = 0.
dr is calculated by directly differentiating Eq. (14) of [Wang et al, 2019]. dr[n, m] is only correct when (i) both band n and band m are nondegenerate or (ii) both band n and band m are completely degenerate but $E_n≠E_m$.
HopTB.getvelocity
— Functiongetvelocity(tm::AbstractTBModel, α::Int64, k::AbstractVector{<:Number})
Calculate velocity matrix in the α direction.
Velocity matrix is calculated by the following expression
\[v_{nm}^α = ∂_α ϵ_n δ_{nm} + i (ϵ_n-ϵ_m) A_{nm}^α.\]
Therefore, the velocity is actually ħ*velocity.
v[n, m] is only correct when band m is nondegenerate or completely degenerate.
HopTB.getspin
— Functiongetspin(tm::AbstractTBModel, α::Int64, k::AbstractVector{<:Real})
Calculate ⟨n|σα|m⟩ at k
point.
If tm
is a TBModel, the function checks whether tm.isspinful
is true.
Documented functions
HopTB.HermEig
— TypeHermEig wraps eigenvalues and eigenvectors of a Hermitian eigenvalue problem.
Fields
values::Vector{Float64}
: eigenvaluesvectors::Matrix{ComplexF64}
: eigenvectors stored in column
HopTB.change_energy_reference
— Functionchange_energy_reference(tm::TBModel, μ::Number)::TBModel
change zero energy reference to μ.