Internals

Internals

Lattice

CarteCoord

Cartesian coordinates. Vector{Float64}.

source
FractCoord

Fractional coordinates.

Members

  • whole ::Vector{Int}: Integer part of fractional coordinates
  • fraction ::Vector{Float64}: [0,1) part of fractional coordinates
source
UnitCell{O}

Parameters

  • O: type of "orbital". Any type can be used, but we recommend using String or tuple of String and Int for compatibility with JSON.

Members

  • latticevectors ::Array{Float64, 2}: Lattice vectors
  • reducedreciprocallatticevectors ::Array{Float64, 2}: Reduced reciprocal lattice vectors (transpose of inverse of latticevectors)
  • reciprocallatticevectors ::Array{Float64, 2}: Reciprocal lattice vectors. 2π * reducedreciprocallatticevectors
  • orbitals ::Vector{Tuple{T, FractCoord}}: List of orbitals within unit cell
  • orbitalindices ::Dict{T, Int}: Indices of orbitals
source
addorbital!

Add an orbital to the unit cell.

Arguments

  • uc ::UnitCell{T}
  • orbitalname ::{T}
  • orbitalcoord ::FractCoord
source
carte2fract

Arguments

  • latticevectors ::AbstractArray{<:AbstractFloat, 2}: square matrix whose columns are lattice vectors.
  • cc ::CarteCoord: cartesian coordinates
  • tol ::Real=sqrt(eps(Float64)): tolerance
source
carte2fract

Arguments

  • latticevectors ::Array{Float64, 2}
  • cc ::CarteCoord
source
dimension

Dimension of the fractional coordinates

Arguments

  • fc ::FractCoord: Fractional coordinates.
source
dimension

Spatial dimension of the unit cell.

source
fract2carte

Arguments

  • latticevectors ::AbstractArray{<:AbstractFloat, 2}: square matrix whose columns are lattice vectors.
  • fc ::FractCoord: fractional coordinates
source
fract2carte

Arguments

  • latticevectors ::Array{Float64, 2}
  • fc ::FractCoord
source
getorbital

Arguments

  • uc ::UnitCell{T}
  • index ::Integer

Return

  • (orbitalname, fractcoord)
source
getorbital

Get the orbital (its orbital name and its fractional coordinates) with the given name.

Arguments

  • uc ::UnitCell{O}
  • name ::O

Return

  • (orbitalname, fractcoord)
source
getorbitalcoord

Arguments

  • uc ::UnitCell
  • idx ::Integer

Return

  • fractcoord
source
getorbitalcoord

Get the fractional coordinates of the orbital with the given name.

Arguments

  • uc ::UnitCell{O}
  • name ::O

Return

  • fractcoord
source
getorbitalindex

Get index of the given orbital.

Arguments

  • uc ::UnitCell{O}
  • name ::O
source
getorbitalindexcoord

Arguments

  • uc ::UnitCell{T}
  • name ::T

Return

  • (index, fractcoord)
source
getorbitalname

Arguments

  • uc ::UnitCell
  • index ::Integer

Return

  • orbitalname
source
hasorbital{T}

Test whether the unit cell contains the orbital of given name.

Arguments

  • uc ::UnitCell{O}
  • name ::O
source
momentumpath

Generate a list of momenta

Arguments

  • anchorpoints
  • (Optional) nseg - number of points in each segment
source
UnitCell

Construct an n-dimensional lattice.

Arguments

  • latticevectors ::AbstractArray{<:AbstractFloat, 2}: Lattice vectors
  • OrbitalType::DataType

Optional Arguments

  • tol=sqrt(eps(Float64)): Epsilon
source
UnitCell

Construct a one-dimensional lattice.

Arguments

  • latticeconstant ::Float64: Lattice constant
  • OrbitalType: List of orbitals

Optional Arguments

  • tol=sqrt(eps(Float64)): Tolerance
source
momentumgrid

Generate an n-dimensional grid of momenta of given shape

source
momentumpath

The anchorpoints are given in units of the reciprocal lattice vectors.

source
numorbital

Number of orbitals of the unit cell.

Arguments

  • uc ::UnitCell
source
whichunitcell

Return

  • R ::Vector{Int}: which unit cell the specificied orbital/cartesian coordinates belongs to.
source
whichunitcell

Return

  • R ::Vector{Int}: which unit cell the specificied orbital/cartesian coordinates belongs to.
source
Base.isapproxMethod.
isapprox(x, y; rtol::Real=atol>0 ? 0 : √eps, atol::Real=0, nans::Bool=false, norm::Function)
source

Spec

Submodule `Spec`
source
Hopping
source
Interaction
source
FullHamiltonian

Members

  • unitcell ::UnitCell
  • hoppings ::Vector{Hopping}
  • interactions ::Vector{Interaction}
source
Hamiltonian

Create an empty Hamiltonian

Arguments

  • unitcell ::UnitCell
source
HoppingDiagonal{R<:Real}

Represents

\[ t c_{i}^{*} c_{i}\]

Members

  • amplitude ::R
  • i ::Int: index of orbital
  • Ri ::Vector{Int}: which unit cell? (indexed by a1, and a2)
source
source
HoppingOffdiagonal{C<:Number}

Represents

\[ t c_{i}^{*} c_{j} + t^* c_{j}^{*} c_{i}\]

t, i, j and the unitcell-coordinates Ri and Rj are stored. Require that (i, Ri) <= (j, Rj)

Members

  • amplitude ::C
  • i, j ::T
  • Ri, Rj ::Vector{Int}
source
InteractionDiagonal{R<:Real}

Represents

\[ U c_{i}^{*} c_{j}^{*} c_{j} c_{i}\]

Members

  • amplitude ::R
  • i, j ::Int
  • Ri, Rj ::Vector{Int}
source
InteractionOffdiagonal{C<:Number}

i < j, k < l, i < k or (i == k and j < l)

Represents

\[ U c_{i}^{*} c_{j}^{*} c_{l} c_{k} + U^{*} c_{k}^{*} c_{l}^{*} c_{j} c_{i}\]

Only keep the first term (and require i < j, k < l, i <= k)

Ordering of orbitals by (i, Ri)

Members

  • amplitude ::C
  • i, j, k, l ::Int
  • Ri, Rj, Rk, Rl ::Vector{Int}
source
addhopping!

Arguments

  • hamiltonian ::Hamiltonian
  • hopping ::HoppingOffdiagonal
source
addhopping!

Arguments

  • hamiltonian ::Hamiltonian
  • hopping ::HoppingDiagonal
source
addinteraction!

Arguments

  • hamiltonian ::Hamiltonian
  • interaction ::InteractionOffdiagonal
source
addinteraction!

Arguments

  • hamiltonian ::Hamiltonian
  • interaction ::InteractionDiagonal
source
hoppingbycarte{T}

Make a hopping element with cartesian coordinates.

Arguments

  • uc ::UnitCell{T}
  • amplitude ::Number
  • i ::T
  • j ::T
  • ri ::CarteCoord
  • rj ::CarteCoord
  • tol ::Real : Optional. Defaults to sqrt(eps(Float64))
source
hoppingbycarte{T}

Make a hopping element with cartesian coordinates.

Arguments

  • uc ::UnitCell{T}
  • amplitude ::Real
  • i ::T
  • ri ::CarteCoord
  • tol ::Real : Optional. Defaults to sqrt(eps(Float64))
source
interactionbycarte{T}

Make an interaction element with cartesian coordinates.

Arguments

* `uc ::UnitCell{T}`
* `amplitude ::Number`
* `i ::T`
* `j ::T`
* `k ::T`
* `l ::T`
* `ri ::CarteCoord`
* `rj ::CarteCoord`
* `rk ::CarteCoord`
* `rl ::CarteCoord`
* `tol ::Real` : Optional. Defaults to `sqrt(eps(Float64))`
source
interactionbycarte{T}

Make an interaction element with cartesian coordinates.

Arguments

* `uc ::UnitCell{T}`
* `amplitude ::Number`
* `i ::T`
* `j ::T`
* `ri ::CarteCoord`
* `rj ::CarteCoord`
* `tol ::Real` : Optional. Defaults to `sqrt(eps(Float64))`
source
islocal

Check if the hopping element is local (i.e. Ri is zero)

source
localized

Return a hopping element that is local (i.e. Ri is zero)

source

Generator

Generator submodule

source
hopping_inplace
source
hopping_inplace
source
hopping_inplace
source
hopping_inplace
source
hopping_inplace
source
hopping_inplace
source
hopping_inplace
source

Topology

squarify

Arguments

  • uc::Spec.FullHamiltonian{O}
source
squarify

Arguments

  • uc::HFB.HFBHamiltonian{O}
source
squarify

In order to make the Hamiltoinian a periodic function of momentum, bring all the sites to the origin. In addition, make the unitcell into a square.

Arguments

  • uc::Lattice.UnitCell{O}
source
chernnumber

Compute chern number of the band structure defined by the hoppings and the selected bands.

source

z2index

Compute Z₂ index of time-reversal-invariant Hamiltonian.

Arguments

  • uc::UnitCell{O}
  • hops::AbstractVector{Hopping}
  • timereversal::AbstractMatrix
  • n1 ::Integer
  • n2 ::Integer
  • selectpairs::AbstractVector{<:Integer}

Optional Arguments

  • tol ::Real = sqrt(eps(Float64))

Returns

(The Z2 index, max| Hₖ - T⁻¹HₖT | for k in TRIMs)

source

HFB

HFBConmputer is a type holding the ρ, t and Γ, Δ of a Hartree-Fock-Bogoliubov Hamiltonian.

source
source
source
source
source
source
source

Add offdiagonal interaction

source
addinteraction!

Add diagonal interaction

source

Compute Γ and Δ from ρ and t.

source
source
source
loop

Perform selfconsistency loop a number of times with the given precondition and given update functions.

Arguments

  • solver ::HFBSolver{T}
  • sol::HFBAmplitude
  • run::Integer

Optional Arguments

  • update::Function=simpleupdate
  • precondition::Function=identity: on target field
  • callback::Function=_noop: Function called after every update as

callback(i, run)

source
loop

Perform selfconsistency loop a number of times with the given precondition and given update functions.

Arguments

  • solver ::HFBSolver{T}
  • sf::HFBAmplitude
  • run::Integer

Optional Arguments

  • update::Function=simpleupdate
  • precondition::Function=identity
  • callback::Function=_noop: Function called after every update as

callback(i, run)

source

Return a generator of Δ matrix (which is a function of momentum)

source

Return a generator of Γ matrix (which is a function of momentum)

source
make_greencollector

Returns a function which has the following signature

collector(k, eigenvalues, eigenvectors, ρout, tout)
source
source

func : (idx, i, j, r) -> val

source

func : (idx, i, j, r) -> 0

source
Check if hint contains ρ
source

Compute Γ and Δ from ρ and t.

source

Compute Γ and Δ from ρ and t.

source
source

Return a generator of hopping matrix (which is a function of momentum)

source
source
source
source
source
source

Randomize a hfbamplitude

source

CollectRow is holds info on how to compute ρ or t. Its elements are:

  1. Is diagonal? (only for rho)
  2. row orbital
  3. col orbital
  4. displacement r(col) - r(row)
source

DeployRow is holds info on how to compute Γ or Δ. Its elements are:

  1. Is diagonal
  2. row orbital
  3. col orbital
  4. displacement r(col) - r(row)
  5. list of sources, each of which is a tuple of
  6. index of ρ or t from which to compute this Γ or Δ.
  7. amplitude (coefficient to multiply to ρ or t)
  8. boolean indicating whether (1) conjugation is needed (for ρ/Γ) or (2) minus sign is needed (for t/Δ).
source
source
source
source
source
source

LinearizedGap

linearizedpairingkernel

Compute the kernel Γ of the linearized gap equation in the pairing channel which is written as Δ = Γ⋅Δ

source