HopTB

Exported functions

HopTB.TBModelType

TBModel{T<Number} is a data type representing tight binding models.

Fields

  • norbits::Int64: number of orbits in the model
  • lat::SMatrix{3,3,Float64,9}: primitive lattice vectors stored in columns
  • rlat::SMatrix{3,3,Float64,9}: primitive reciprocal lattice vectors stored in columns
  • hoppings::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 in site_positions.
  • site_norbits::Union{Missing,Vector{Int64}}: number of orbitals for each site.
  • site_positions::Union{Missing,Matrix{Float64}}: position of sites stored in column
  • orbital_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 by orbital_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, and is_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 if nsites, site_norbits and site_positions are valid.
  • is_canonical_ordered can only be valid if orbital_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 and positions 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 with site_positions.
  • number of orbits should be consistent.
source
HopTB.SharedTBModelType

SharedTBModel 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 orbits
  • isorthogonal::Bool: whether orbits of the model are orthonormal
  • lat::SMatrix{3,3,Float64,9}: primitive lattice vectors stored in columns
  • rlat::SMatrix{3,3,Float64,9}: primitive reciprocal lattice vectors stored in columns
  • Rs::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 matrix Rs[:, 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 is Rs[:, iR]. Since Hamiltonian is Hermitian, only first half R vectors in Rs 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 is Rs[:, iR]. Since overlap matrix is Hermitian, only first half R vectors in Rs 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 is Rs[:, iR].
source
HopTB.sethopping!Function
sethopping!(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.

source
sethopping!(tm::TBModel{T}, R::AbstractVector{<:Integer}, n::Int64, m::Int64,
    hopping::Number) where T

Set ⟨0n|H|Rm⟩ to hopping for tm.

source
HopTB.addhopping!Function
addhopping!(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.

source
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.

source
HopTB.setoverlap!Function
setoverlap!(tm::TBModel{T}, R::AbstractVector{<:Integer}, n::Int64, m::Int64,
    overlap::Number) where T

Set ⟨0n|Rm⟩ to overlap for tm.

source
HopTB.setposition!Function
setposition!(
    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).

source
HopTB.getdHFunction
getdH(tm::AbstractTBModel, order::Tuple{Int64,Int64,Int64},
    k::AbstractVector{<:Real})::Matrix{ComplexF64}

Calculate order derivative of Hamiltonian.

source
HopTB.getdSFunction
getdS(tm::AbstractTBModel, order::Tuple{Int64,Int64,Int64},
    k::AbstractVector{<:Real})::Matrix{ComplexF64}

Calculate order derivative of overlap.

source
HopTB.getdAwFunction
getdAw(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)}⟩$.

source
HopTB.getHFunction
getH(tm::AbstractTBModel, k::AbstractVector{<:Real})::Matrix{ComplexF64}

Calculate Hamiltonian at a reduced k point.

source
HopTB.getSFunction
getS(tm::AbstractTBModel, k::AbstractVector{<:Real})::Matrix{ComplexF64}

Calculate overlap matrix at a reduced k point.

source
HopTB.geteigFunction
geteig(tm::AbstractTBModel, k::AbstractVector{<:Real})::HermEig

Calculate eigenvalues and eigenvectors of tm at a reduced k point.

source
HopTB.getAwFunction
getAw(tm::AbstractTBModel, α::Int64, k::AbstractVector{<:Real})::Matrix{ComplexF64}

Calculate $i⟨u_n^{(W)}|∂_{k_α}u_m^{(W)}⟩$.

source
HopTB.getdEsFunction
getdEs(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.

source
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.

source
HopTB.getAFunction
getA(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.

source
HopTB.getdrFunction
function 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$.

source
HopTB.getvelocityFunction
getvelocity(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.

source
HopTB.getspinFunction
getspin(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.

source

Documented functions

HopTB.HermEigType

HermEig wraps eigenvalues and eigenvectors of a Hermitian eigenvalue problem.

Fields

  • values::Vector{Float64}: eigenvalues
  • vectors::Matrix{ComplexF64}: eigenvectors stored in column
source