From 77687de46b610065ee6da7363e2286038d5126b9 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Mon, 23 Oct 2023 10:05:39 +0000 Subject: [PATCH] build based on 9f18830 --- dev/.documenter-siteinfo.json | 2 +- dev/api/index.html | 64 +++++++++++++------------- dev/examples/index.html | 2 +- dev/index.html | 2 +- dev/tutorial/bandstructures/index.html | 2 +- dev/tutorial/glossary/index.html | 2 +- dev/tutorial/greenfunctions/index.html | 2 +- dev/tutorial/hamiltonians/index.html | 2 +- dev/tutorial/lattices/index.html | 2 +- dev/tutorial/models/index.html | 2 +- dev/tutorial/observables/index.html | 2 +- dev/tutorial/tutorial/index.html | 2 +- 12 files changed, 43 insertions(+), 43 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 5cc8e4b5..7fe05bfe 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.3","generation_timestamp":"2023-10-22T20:24:17","documenter_version":"1.1.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.3","generation_timestamp":"2023-10-23T10:05:31","documenter_version":"1.1.2"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index 05d550bb..d4914a5b 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -9,7 +9,7 @@ -0.3819660112501042 + 2.407681231060336e-16im -0.6180339887498942 - 2.7336317916863215e-16im 0.6180339887498937 - 1.7243387890744497e-16im - 0.3819660112501042 - 1.083582785131051e-16im

See also

`spectrum`, `bands`
source
Quantica.GreenSolversModule

GreenSolvers is a Quantica submodule containing several pre-defined Green function solvers. The alias GS can be used in place of GS. Currently supported solvers and their possible keyword arguments are

  • GS.SparseLU() : Direct inversion solver for 0D Hamiltonians using a SparseArrays.lu(hmat) factorization
  • GS.Schur(; boundary = Inf) : Solver for 1D Hamiltonians based on a deflated, generalized Schur factorization
    • boundary : 1D cell index of a boundary cell, or Inf for no boundaries. Equivalent to removing that specific cell from the lattice when computing the Green function.
  • GS.KPM(; order = 100, bandrange = missing, kernel = I) : Kernel polynomial method solver for 0D Hamiltonians
    • order : order of the expansion in Chebyshev polynomials Tₙ(h) of the Hamiltonian h (lowest possible order is n = 0).
    • bandrange : a (min_energy, max_energy)::Tuple interval that encompasses the full band of the Hamiltonian. If missing, it is computed automatically.
    • kernel : generalization that computes momenta as μₙ = Tr[Tₙ(h)*kernel], so that the local density of states (see ldos) becomes the density of the kernel operator.
    • This solver does not allow arbitrary indexing of the resulting g::GreenFunction, only on contacts g[contact_ind::Integer]. If the system has none, we can add a dummy contact using attach(h, nothing; sites...), see attach.
  • GS.Bands(bands_arguments; boundary = missing, bands_kw...): solver based on the integration of bandstructure simplices
    • bands_arguments: positional arguments passed on to bands
    • bands_kw: keyword arguments passed on to bands
    • boundary: either missing (no boundary), or dir => cell_pos, where dir::Integer is the Bravais vector normal to the boundary, and cell_pos::Integer the value of cell indices cells[dir] that define the boundary (i.e. cells[dir] <= cell_pos are vaccum)
    • This solver only allows zero or one boundary. WARNING: if a boundary is used, the algorithm may become unstable for very fine band meshes.
source
Quantica.HamiltonianPresetsModule

HamiltonianPresets is a Quantica submodule containing several pre-defined Hamiltonians. The alias HP can be used in place of LatticePresets. Currently supported hamiltonians are

HP.graphene(; kw...)
+  0.3819660112501042 - 1.083582785131051e-16im

See also

`spectrum`, `bands`
source
Quantica.GreenSolversModule

GreenSolvers is a Quantica submodule containing several pre-defined Green function solvers. The alias GS can be used in place of GS. Currently supported solvers and their possible keyword arguments are

  • GS.SparseLU() : Direct inversion solver for 0D Hamiltonians using a SparseArrays.lu(hmat) factorization
  • GS.Schur(; boundary = Inf) : Solver for 1D Hamiltonians based on a deflated, generalized Schur factorization
    • boundary : 1D cell index of a boundary cell, or Inf for no boundaries. Equivalent to removing that specific cell from the lattice when computing the Green function.
  • GS.KPM(; order = 100, bandrange = missing, kernel = I) : Kernel polynomial method solver for 0D Hamiltonians
    • order : order of the expansion in Chebyshev polynomials Tₙ(h) of the Hamiltonian h (lowest possible order is n = 0).
    • bandrange : a (min_energy, max_energy)::Tuple interval that encompasses the full band of the Hamiltonian. If missing, it is computed automatically.
    • kernel : generalization that computes momenta as μₙ = Tr[Tₙ(h)*kernel], so that the local density of states (see ldos) becomes the density of the kernel operator.
    • This solver does not allow arbitrary indexing of the resulting g::GreenFunction, only on contacts g[contact_ind::Integer]. If the system has none, we can add a dummy contact using attach(h, nothing; sites...), see attach.
  • GS.Bands(bands_arguments; boundary = missing, bands_kw...): solver based on the integration of bandstructure simplices
    • bands_arguments: positional arguments passed on to bands
    • bands_kw: keyword arguments passed on to bands
    • boundary: either missing (no boundary), or dir => cell_pos, where dir::Integer is the Bravais vector normal to the boundary, and cell_pos::Integer the value of cell indices cells[dir] that define the boundary (i.e. cells[dir] <= cell_pos are vaccum)
    • This solver only allows zero or one boundary. WARNING: if a boundary is used, the algorithm may become unstable for very fine band meshes.
source
Quantica.HamiltonianPresetsModule

HamiltonianPresets is a Quantica submodule containing several pre-defined Hamiltonians. The alias HP can be used in place of LatticePresets. Currently supported hamiltonians are

HP.graphene(; kw...)
 HP.twisted_bilayer_graphene(; kw...)

For details on the keyword arguments kw see the corresponding docstring

julia> HamiltonianPresets.twisted_bilayer_graphene(twistindices = (30, 1))
 Hamiltonian{Float64,3,2}: Hamiltonian on a 2D Lattice in 3D space
   Bloch harmonics  : 7
@@ -18,7 +18,7 @@
   Element type     : scalar (ComplexF64)
   Onsites          : 0
   Hoppings         : 315684
-  Coordination     : 28.27696

See also

`LatticePresets`, `RegionPresets`
source
Quantica.LatticePresetsModule

LatticePresets is a Quantica submodule containing several pre-defined lattices. The alias LP can be used in place of LatticePresets. Currently supported lattices are

LP.linear(; a0 = 1, kw...)      # linear lattice in 1D
+  Coordination     : 28.27696

See also

`LatticePresets`, `RegionPresets`
source
Quantica.LatticePresetsModule

LatticePresets is a Quantica submodule containing several pre-defined lattices. The alias LP can be used in place of LatticePresets. Currently supported lattices are

LP.linear(; a0 = 1, kw...)      # linear lattice in 1D
 LP.square(; a0 = 1, kw...)      # square lattice in 2D
 LP.triangular(; a0 = 1, kw...)  # triangular lattice in 2D
 LP.honeycomb(; a0 = 1, kw...)   # honeycomb lattice in 2D
@@ -37,7 +37,7 @@
   Bravais vectors : [[1.0, 0.0, 0.0], [0.0, 2.0, 0.0]]
   Sublattices     : 1
     Names         : (:A,)
-    Sites         : (1,) --> 1 total per unit cell

See also

`RegionPresets`, `HamiltonianPresets`
source
Quantica.RegionPresetsModule

RegionPresets is a Quantica submodule containing several pre-defined regions of type Region{E}, where E is the space dimension. The alias RP can be used in place of RegionPresets. Supported regions are

RP.circle(radius = 10, center = (0, 0))                         # 2D
+    Sites         : (1,) --> 1 total per unit cell

See also

`RegionPresets`, `HamiltonianPresets`
source
Quantica.RegionPresetsModule

RegionPresets is a Quantica submodule containing several pre-defined regions of type Region{E}, where E is the space dimension. The alias RP can be used in place of RegionPresets. Supported regions are

RP.circle(radius = 10, center = (0, 0))                         # 2D
 RP.ellipse((rx, ry) = (10, 15), center = (0, 0))                # 2D
 RP.square(side = 10, center = (0, 0))                           # 2D
 RP.rectangle((sx, sy) = (10, 15), center = (0, 0))              # 2D
@@ -48,14 +48,14 @@
 false
 
 julia> RegionPresets.circle(10)(0, 0, 20)
-true

See also

`LatticePresets`, `HamiltonianPresets`
source
Quantica.BoxIteratorType
BoxIterator(seed::SVector{N,Int}; maxiterations = TOOMANYITERS)

Cartesian iterator iter over SVector{N,Int}s (cells) that starts at seed and grows outwards in the form of a box of increasing sides (not necesarily equal) until it encompasses a certain N-dimensional region. To signal that a cell is in the desired region the user calls acceptcell!(iter, cell).

source
Base.reverseFunction
reverse(lat_or_h::Union{Lattice,AbstractHamiltonian})

Build a new lattice or hamiltonian with the orientation of all Bravais vectors reversed.

See also

`reverse!`, `transform`
source
Base.reverse!Function
reverse!(lat_or_h::Union{Lattice,AbstractHamiltonian})

In-place version of reverse, inverts all Bravais vectors of lat_or_h.

See also

`reverse`, `transform`
source
LinearAlgebra.ishermitianFunction
ishermitian(h::Hamiltonian)

Check whether h is Hermitian. This is not supported for h::ParametricHamiltonian, as the result can depend of the specific values of its parameters.

source
Quantica.attachFunction
attach(h::AbstractHamiltonian, args..; sites...)
+true

See also

`LatticePresets`, `HamiltonianPresets`
source
Quantica.BoxIteratorType
BoxIterator(seed::SVector{N,Int}; maxiterations = TOOMANYITERS)

Cartesian iterator iter over SVector{N,Int}s (cells) that starts at seed and grows outwards in the form of a box of increasing sides (not necesarily equal) until it encompasses a certain N-dimensional region. To signal that a cell is in the desired region the user calls acceptcell!(iter, cell).

source
Base.reverseFunction
reverse(lat_or_h::Union{Lattice,AbstractHamiltonian})

Build a new lattice or hamiltonian with the orientation of all Bravais vectors reversed.

See also

`reverse!`, `transform`
source
Base.reverse!Function
reverse!(lat_or_h::Union{Lattice,AbstractHamiltonian})

In-place version of reverse, inverts all Bravais vectors of lat_or_h.

See also

`reverse`, `transform`
source
LinearAlgebra.ishermitianFunction
ishermitian(h::Hamiltonian)

Check whether h is Hermitian. This is not supported for h::ParametricHamiltonian, as the result can depend of the specific values of its parameters.

source
Quantica.attachFunction
attach(h::AbstractHamiltonian, args..; sites...)
 attach(h::OpenHamiltonian, args...; sites...)

Build an h´::OpenHamiltonian by attaching (adding) a Σ::SelfEnergy to a finite number of sites in h specified by siteselector(; sites...). This also defines a "contact" on said sites that can be referred to (with index i::Integer for the i-th attached contact) when slicing Green functions later. Self-energies are taken into account when building the Green function g(ω) = (ω - h´ - Σ(ω))⁻¹ of the resulting , see greenfunction.

Self-energy forms

The different forms of args yield different types of self-energies Σ. Currently supported forms are:

attach(h, gs::GreenSlice, coupling::AbstractModel; sites...)

Adds a generic self-energy Σ(ω) = V´⋅gs(ω)⋅V on h's sites, where V and are couplings, given by coupling, between said sites and the LatticeSlice in gs. Allowed forms of gs include both g[bath_sites...] and g[contactind::Integer] where g is any GreenFunction.

attach(h, model::ParametricModel; sites...)

Add self-energy Σᵢⱼ(ω) defined by a model composed of parametric terms (@onsite and @hopping) with ω as first argument, as in e.g. @onsite((ω, r) -> Σᵢᵢ(ω, r)) and @hopping((ω, r, dr) -> Σᵢⱼ(ω, r, dr))

attach(h, nothing; sites...)

Add null self-energy Σᵢⱼ(ω) = 0 on selected sites, which in effect simply amounts to defining a contact on said sites, but does not lead to any dressing the Green function. This is useful for some GreenFunction solvers such as GS.KPM (see greenfunction), which need to know the sites of interest beforehand (the contact sites in this case).

attach(h, g1D::GreenFunction; reverse = false, transform = identity, sites...)

Add a self-energy Σ(ω) = h₋₁⋅g1D(ω)[surface]⋅h₁ corresponding to a semi-infinite 1D lead (i.e. with a finite boundary, see greenfunction), where h₁ and h₋₁ are intercell couplings, and g1D is the lead GreenFunction. The g1D(ω) is taken at the suface unitcell, either adjacent to the boundary on its positive side (if reverse = false) or on its negative side (if reverse = true). The positions of the selected sites in h must match, modulo an arbitrary displacement, those of the lead unit cell, after applying transform to the latter. If they don't, use the attach syntax below.

Advanced: If the g1D does not have any self-energies, the produced self-energy is in fact an ExtendedSelfEnergy, which is numerically more stable than a naive implementation of RegularSelfEnergy's, since g1D(ω)[surface] is never actually computed. Conversely, if g1D has self-energies attached, a RegularSelfEnergy is produced.

attach(h, g1D::GreenFunction, coupling::AbstractModel; reverse = false, transform = identity,  sites...)

Add a self-energy Σ(ω) = V´⋅g1D(ω)[surface]⋅V corresponding to a 1D lead (semi-infinite or infinite), but with couplings V and , defined by coupling, between sites and the surface lead unitcell (or the one with index zero if there is no boundary) . See also Advanced note above.

Currying

h |> attach(args...; sites...)

Curried form equivalent to attach(h, args...; sites...).

Examples

julia> # A graphene flake with two out-of-plane cubic-lattice leads
 
 julia> g1D = LP.cubic(names = :C) |> hamiltonian(hopping(1)) |> supercell((0,0,1), region = RP.square(4)) |> greenfunction(GS.Schur(boundary = 0));
 
 julia> coupling = hopping(1, range = 2);
 
-julia> gdisk = HP.graphene(a0 = 1, dim = 3) |> supercell(region = RP.circle(10)) |> attach(g1D, coupling; region = RP.square(4)) |> attach(g1D, coupling; region = RP.square(4), reverse = true) |> greenfunction;

See also

`greenfunction`, `GreenSolvers`
source
Quantica.bandsFunction
bands(h::AbstractHamiltonian, xcolᵢ...; kw...)

Construct a Bandstructure object, which contains in particular a collection of continuously connected Subbands of h, obtained by diagonalizing the matrix h(ϕs; params...) on an M-dimensional mesh of points (x₁, x₂, ..., xₘ), where each xᵢ takes values in the collection xcolᵢ. The mapping between points in the mesh points and values of (ϕs; params...) is defined by keyword mapping (identity by default, see Keywords). Diagonalization is multithreaded and will use all available Julia threads (start session with julia -t N to have N threads).

bands(f::Function, xcolᵢ...; kw...)

Like the above using f(ϕs)::AbstractMatrix in place of h(ϕs; params...), and returning a Vector{<:Subband} instead of a Bandstructure object. This is provided as a lower level driver without the added slicing functionality of a full Bandstructure object, see below.

bands(h::AbstractHamiltonian; kw...)

Equivalent to bands(h::AbstractHamiltonian, xcolᵢ...; kw...) with a default xcolᵢ = subdiv(-π, π, 49).

Keywords

  • solver: eigensolver to use for each diagonalization (see Eigensolvers). Default: ES.LinearAlgebra()
  • mapping: a function of the form (x, y, ...) -> ϕs or (x, y, ...) -> ftuple(ϕs...; params...) that translates points (x, y, ...) in the mesh to Bloch phases ϕs or phase+parameter FrankenTuples ftuple(ϕs...; params...). See also linecuts below. Default: identity
  • transform: function to apply to each eigenvalue after diagonalization. Default: identity
  • degtol::Real: maximum distance between to nearby eigenvalue so that they are classified as degenerate. Default: sqrt(eps)
  • split::Bool: whether to split bands into disconnected subbands. Default: true
  • projectors::Bool: whether to compute interpolating subspaces in each simplex (for use as GreenSolver). Default: true
  • warn::Bool: whether to emit warning when band dislocations are encountered. Default: true
  • showprogress::Bool: whether to show or not a progress bar. Default: true
  • defects: (experimental) a collection of extra points to add to the mesh, typically the location of topological band defects such as Dirac points, so that interpolation avoids creating dislocation defects in the bands. You need to also increase patches to repair the subband dislocations using the added defect vertices. Default: ()
  • patches::Integer: (experimental) if a dislocation is encountered, attempt to patch it by searching for the defect recursively to a given order, or using the provided defects (preferred). Default: 0

Currying

h |> bands(xcolᵢ...; kw...)

Curried form of bands equivalent to bands(h, xcolᵢ...; kw...)

Band linecuts

To do a linecut of a bandstructure along a polygonal path in the L-dimensional Brillouin zone, mapping a set of 1D points xs to a set of nodes, with pts interpolation points in each segment, one can use the following convenient syntax

bands(h, subdiv(xs, pts); mapping = (xs => nodes))

Here nodes can be a collection of SVector{L} or of named Brillouin zone points from the list (,:K, :K´, :M, :X, :Y, :Z). If mapping = nodes, then xs defaults to 0:length(nodes)-1. See also subdiv for its alternative methods.

Indexing and slicing

b[i]

Extract i-th subband from b::Bandstructure. i can also be a Vector, an AbstractRange or any other argument accepted by getindex(subbands::Vector, i)

b[slice::Tuple]

Compute a section of b::Bandstructure with a "plane" defined by slice = (ϕ₁, ϕ₂,..., ϕₗ[, ϵ]), where each ϕᵢ or ϵ can be a real number (representing a fixed momentum or energy) or a : (unconstrained along that dimension). For bands of an L-dimensional lattice, slice will be padded to an L+1-long tuple with : if necessary. The result is a collection of of sliced Subbands.

Examples

julia> phis = range(0, 2pi, length = 50); h = LP.honeycomb() |> hamiltonian(@hopping((; t = 1) -> t));
+julia> gdisk = HP.graphene(a0 = 1, dim = 3) |> supercell(region = RP.circle(10)) |> attach(g1D, coupling; region = RP.square(4)) |> attach(g1D, coupling; region = RP.square(4), reverse = true) |> greenfunction;

See also

`greenfunction`, `GreenSolvers`
source
Quantica.bandsFunction
bands(h::AbstractHamiltonian, xcolᵢ...; kw...)

Construct a Bandstructure object, which contains in particular a collection of continuously connected Subbands of h, obtained by diagonalizing the matrix h(ϕs; params...) on an M-dimensional mesh of points (x₁, x₂, ..., xₘ), where each xᵢ takes values in the collection xcolᵢ. The mapping between points in the mesh points and values of (ϕs; params...) is defined by keyword mapping (identity by default, see Keywords). Diagonalization is multithreaded and will use all available Julia threads (start session with julia -t N to have N threads).

bands(f::Function, xcolᵢ...; kw...)

Like the above using f(ϕs)::AbstractMatrix in place of h(ϕs; params...), and returning a Vector{<:Subband} instead of a Bandstructure object. This is provided as a lower level driver without the added slicing functionality of a full Bandstructure object, see below.

bands(h::AbstractHamiltonian; kw...)

Equivalent to bands(h::AbstractHamiltonian, xcolᵢ...; kw...) with a default xcolᵢ = subdiv(-π, π, 49).

Keywords

  • solver: eigensolver to use for each diagonalization (see Eigensolvers). Default: ES.LinearAlgebra()
  • mapping: a function of the form (x, y, ...) -> ϕs or (x, y, ...) -> ftuple(ϕs...; params...) that translates points (x, y, ...) in the mesh to Bloch phases ϕs or phase+parameter FrankenTuples ftuple(ϕs...; params...). See also linecuts below. Default: identity
  • transform: function to apply to each eigenvalue after diagonalization. Default: identity
  • degtol::Real: maximum distance between to nearby eigenvalue so that they are classified as degenerate. Default: sqrt(eps)
  • split::Bool: whether to split bands into disconnected subbands. Default: true
  • projectors::Bool: whether to compute interpolating subspaces in each simplex (for use as GreenSolver). Default: true
  • warn::Bool: whether to emit warning when band dislocations are encountered. Default: true
  • showprogress::Bool: whether to show or not a progress bar. Default: true
  • defects: (experimental) a collection of extra points to add to the mesh, typically the location of topological band defects such as Dirac points, so that interpolation avoids creating dislocation defects in the bands. You need to also increase patches to repair the subband dislocations using the added defect vertices. Default: ()
  • patches::Integer: (experimental) if a dislocation is encountered, attempt to patch it by searching for the defect recursively to a given order, or using the provided defects (preferred). Default: 0

Currying

h |> bands(xcolᵢ...; kw...)

Curried form of bands equivalent to bands(h, xcolᵢ...; kw...)

Band linecuts

To do a linecut of a bandstructure along a polygonal path in the L-dimensional Brillouin zone, mapping a set of 1D points xs to a set of nodes, with pts interpolation points in each segment, one can use the following convenient syntax

bands(h, subdiv(xs, pts); mapping = (xs => nodes))

Here nodes can be a collection of SVector{L} or of named Brillouin zone points from the list (,:K, :K´, :M, :X, :Y, :Z). If mapping = nodes, then xs defaults to 0:length(nodes)-1. See also subdiv for its alternative methods.

Indexing and slicing

b[i]

Extract i-th subband from b::Bandstructure. i can also be a Vector, an AbstractRange or any other argument accepted by getindex(subbands::Vector, i)

b[slice::Tuple]

Compute a section of b::Bandstructure with a "plane" defined by slice = (ϕ₁, ϕ₂,..., ϕₗ[, ϵ]), where each ϕᵢ or ϵ can be a real number (representing a fixed momentum or energy) or a : (unconstrained along that dimension). For bands of an L-dimensional lattice, slice will be padded to an L+1-long tuple with : if necessary. The result is a collection of of sliced Subbands.

Examples

julia> phis = range(0, 2pi, length = 50); h = LP.honeycomb() |> hamiltonian(@hopping((; t = 1) -> t));
 
 julia> bands(h(t = 1), phis, phis)
 Bandstructure{Float64,3,2}: 3D Bandstructure over a 2-dimensional parameter space of type Float64
@@ -76,14 +76,14 @@
   Subbands  : 1
   Vertices  : 97
   Edges     : 96
-  Simplices : 96

See also

`spectrum`, `subdiv`
source
Quantica.bravais_matrixFunction
bravais_matrix(lat::Lattice)
+  Simplices : 96

See also

`spectrum`, `subdiv`
source
Quantica.bravais_matrixFunction
bravais_matrix(lat::Lattice)
 bravais_matrix(h::AbstractHamiltonian)

Return the Bravais matrix of lattice lat or AbstractHamiltonian h, with Bravais vectors as its columns.

Examples

julia> lat = lattice(sublat((0,0)), bravais = ((1.0, 2), (3, 4)));
 
 julia> bravais_matrix(lat)
 2×2 SMatrix{2, 2, Float64, 4} with indices SOneTo(2)×SOneTo(2):
  1.0  3.0
  2.0  4.0
-

See also

`lattice`
source
Quantica.cellsitesFunction
cellsites(cell_indices, site_indices)

Simple selector of sites with given site_indices in a given cell at cell_indices. Here, site_indices can be an index, a collection of integers or : (for all sites), and cell_indices should be a collection of L integers, where L is the lattice dimension.

See also

`siteselector`
source
Quantica.combineFunction
combine(lats::Lattice...)

If all lats have compatible Bravais vectors, combine them into a single lattice. If necessary, sublattice names are renamed to remain unique.

combine(hams::AbstractHamiltonians...; coupling = TighbindingModel())

Combine a collection hams of hamiltonians into one by combining their corresponding lattices, and optionally by adding a coupling between them, given by the hopping terms in coupling.

Note that the coupling model will be applied to the combined lattice (which may have renamed sublattices to avoid name collissions). However, only hopping terms between different hams blocks will be applied.

Examples

julia> # Building Bernal-stacked bilayer graphene
+

See also

`lattice`
source
Quantica.cellsitesFunction
cellsites(cell_indices, site_indices)

Simple selector of sites with given site_indices in a given cell at cell_indices. Here, site_indices can be an index, a collection of integers or : (for all sites), and cell_indices should be a collection of L integers, where L is the lattice dimension.

See also

`siteselector`
source
Quantica.combineFunction
combine(lats::Lattice...)

If all lats have compatible Bravais vectors, combine them into a single lattice. If necessary, sublattice names are renamed to remain unique.

combine(hams::AbstractHamiltonians...; coupling = TighbindingModel())

Combine a collection hams of hamiltonians into one by combining their corresponding lattices, and optionally by adding a coupling between them, given by the hopping terms in coupling.

Note that the coupling model will be applied to the combined lattice (which may have renamed sublattices to avoid name collissions). However, only hopping terms between different hams blocks will be applied.

Examples

julia> # Building Bernal-stacked bilayer graphene
 
 julia> hbot = HP.graphene(a0 = 1, dim = 3, names = (:A,:B));
 
@@ -97,7 +97,7 @@
   Element type     : scalar (ComplexF64)
   Onsites          : 0
   Hoppings         : 14
-  Coordination     : 3.5

See also

`hopping`
source
Quantica.conductanceFunction
conductance(gs::GreenSlice; nambu = false)

Given a slice gs = g[i::Integer, j::Integer] of a g::GreenFunction, build a partially evaluated object G::Conductance representing the zero-temperature, linear, differential conductance Gᵢⱼ = dIᵢ/dVⱼ between contacts i and j at arbitrary bias ω = eV in units of e^2/h. Gᵢⱼ is given by

  Gᵢⱼ =  e^2/h × Tr{[im*δᵢⱼ(gʳ-gᵃ)Γⁱ-gʳΓⁱgᵃΓʲ]}         (nambu = false)
+  Coordination     : 3.5

See also

`hopping`
source
Quantica.conductanceFunction
conductance(gs::GreenSlice; nambu = false)

Given a slice gs = g[i::Integer, j::Integer] of a g::GreenFunction, build a partially evaluated object G::Conductance representing the zero-temperature, linear, differential conductance Gᵢⱼ = dIᵢ/dVⱼ between contacts i and j at arbitrary bias ω = eV in units of e^2/h. Gᵢⱼ is given by

  Gᵢⱼ =  e^2/h × Tr{[im*δᵢⱼ(gʳ-gᵃ)Γⁱ-gʳΓⁱgᵃΓʲ]}         (nambu = false)
   Gᵢⱼ =  e^2/h × Tr{[im*δᵢⱼ(gʳ-gᵃ)Γⁱτₑ-gʳΓⁱτ₃gᵃΓʲτₑ]}   (nambu = true)

Here gʳ = g(ω) and gᵃ = (gʳ)' = g(ω') are the retarded and advanced Green function of the system, and Γⁱ = im * (Σⁱ - Σⁱ') is the decay rate at contact i. For Nambu systems (nambu = true), the matrices τₑ=[I 0; 0 0] and τ₃ = [I 0; 0 -I] ensure that charge reversal in Andreev reflections is properly taken into account. For normal systems (nambu = false), the total current at finite bias and temperatures is given by $Iᵢ = e/h × ∫ dω ∑ⱼ [fᵢ(ω) - fⱼ(ω)] Gᵢⱼ(ω)$, where $fᵢ(ω)$ is the Fermi distribution in lead i.

Keywords

  • nambu : whether to consider the Hamiltonian of the system is written in a Nambu basis, each site containing N electron orbitals followed by N hole orbitals.

Full evaluation

G(ω; params...)

Compute the conductance at the specified contacts.

Examples

julia> # A central system g0 with two 1D leads and transparent contacts
 
 julia> glead = LP.square() |> hamiltonian(hopping(1)) |> supercell((1,0), region = r->-2<r[2]<2) |> greenfunction(GS.Schur(boundary = 0));
@@ -110,7 +110,7 @@
   Bias contact     : 1
 
 julia> G(0.2) ≈ 3
-true

See also

`greenfunction`, `ldos`, `current`, `josephson`, `transmission`
source
Quantica.currentFunction
current(gs::GreenSlice; charge = -I, direction = missing)

Build Js::CurrentDensitySlice, a partially evaluated object representing the equilibrium local current density Jᵢⱼ(ω) at arbitrary energy ω from site j to site i, both taken from a specific lattice slice. The current is computed along a given direction (see Keywords).

current(gω::GreenSolution; charge = -I, direction = missing)

Build Jω::CurrentDensitySolution, as above, but for Jᵢⱼ(ω) at a fixed ω and arbitrary sites i, j. See also greenfunction for details on building a GreenSlice and GreenSolution.

The local current density is defined here as $Jᵢⱼ(ω) = (2/h) rᵢⱼ Re Tr[(Hᵢⱼgⱼᵢ(ω) - gᵢⱼ(ω)Hⱼᵢ) * charge]$, with the integrated local current given by $Jᵢⱼ = ∫ f(ω) Jᵢⱼ(ω) dω$. Here Hᵢⱼ is the hopping from site j at rⱼ to i at rᵢ, rᵢⱼ = rᵢ - rⱼ, charge is the charge of carriers in orbital space (see Keywords), and gᵢⱼ(ω) is the retarded Green function between said sites.

Keywords

  • charge : for multiorbital sites, charge can be a general matrix, which allows to compute arbitrary currents, such as spin currents.
  • direction: as defined above, Jᵢⱼ(ω) is a vector. If direction is missing the norm |Jᵢⱼ(ω)| is returned. If it is an u::Union{SVector,Tuple}, u⋅Jᵢⱼ(ω) is returned. If an n::Integer, Jᵢⱼ(ω)[n] is returned.

Full evaluation

Jω[sites...]
+true

See also

`greenfunction`, `ldos`, `current`, `josephson`, `transmission`
source
Quantica.currentFunction
current(gs::GreenSlice; charge = -I, direction = missing)

Build Js::CurrentDensitySlice, a partially evaluated object representing the equilibrium local current density Jᵢⱼ(ω) at arbitrary energy ω from site j to site i, both taken from a specific lattice slice. The current is computed along a given direction (see Keywords).

current(gω::GreenSolution; charge = -I, direction = missing)

Build Jω::CurrentDensitySolution, as above, but for Jᵢⱼ(ω) at a fixed ω and arbitrary sites i, j. See also greenfunction for details on building a GreenSlice and GreenSolution.

The local current density is defined here as $Jᵢⱼ(ω) = (2/h) rᵢⱼ Re Tr[(Hᵢⱼgⱼᵢ(ω) - gᵢⱼ(ω)Hⱼᵢ) * charge]$, with the integrated local current given by $Jᵢⱼ = ∫ f(ω) Jᵢⱼ(ω) dω$. Here Hᵢⱼ is the hopping from site j at rⱼ to i at rᵢ, rᵢⱼ = rᵢ - rⱼ, charge is the charge of carriers in orbital space (see Keywords), and gᵢⱼ(ω) is the retarded Green function between said sites.

Keywords

  • charge : for multiorbital sites, charge can be a general matrix, which allows to compute arbitrary currents, such as spin currents.
  • direction: as defined above, Jᵢⱼ(ω) is a vector. If direction is missing the norm |Jᵢⱼ(ω)| is returned. If it is an u::Union{SVector,Tuple}, u⋅Jᵢⱼ(ω) is returned. If an n::Integer, Jᵢⱼ(ω)[n] is returned.

Full evaluation

Jω[sites...]
 Js(ω; params...)

Given a partially evaluated Jω::CurrentDensitySolution or ρs::CurrentDensitySlice, build a sparse matrix Jᵢⱼ(ω) along the specified direction of fully evaluated local current densities.

Example

julia> # A semi-infinite 1D lead with a magnetic field `B`
 
 julia> g = LP.square() |> supercell((1,0), region = r->-2<r[2]<2) |> hamiltonian(@hopping((r, dr; B = 0.1) -> cis(B * dr' * SA[r[2],-r[1]]))) |> greenfunction(GS.Schur(boundary = 0));
@@ -130,7 +130,7 @@
 3×3 SparseArrays.SparseMatrixCSC{Float64, Int64} with 4 stored entries:
   ⋅           7.77156e-16   ⋅
  7.77156e-16   ⋅           5.55112e-16
-  ⋅           5.55112e-16   ⋅

See also

`greenfunction`, `ldos`, `conductance`, `josephson`, `transmission`
source
Quantica.energiesFunction
energies(sp::Spectrum)

Returns the energies in sp as a vector of Numbers (not necessarily real). Equivalent to first(sp).

See also

`spectrum`, `bands`
source
Quantica.greenfunctionFunction
greenfunction(h::Union{AbstractHamiltonian,OpenHamiltonian}, solver::GreenSolver)

Build a g::GreenFunction of Hamiltonian h using solver. See GreenSolvers for available solvers. If solver is not provided, a default solver is chosen automatically based on the type of h.

Currying

h |> greenfunction(solver)

Curried form equivalent to greenfunction(h, solver).

Partial evaluation

GreenFunctions allow independent, partial evaluation of their positions (producing a GreenSlice) and energy/parameters (producing a GreenSolution). Depending on the solver, this may avoid repeating calculations unnecesarily when sweeping over either of these with the other fixed.

g[ss]
+  ⋅           5.55112e-16   ⋅

See also

`greenfunction`, `ldos`, `conductance`, `josephson`, `transmission`
source
Quantica.energiesFunction
energies(sp::Spectrum)

Returns the energies in sp as a vector of Numbers (not necessarily real). Equivalent to first(sp).

See also

`spectrum`, `bands`
source
Quantica.greenfunctionFunction
greenfunction(h::Union{AbstractHamiltonian,OpenHamiltonian}, solver::GreenSolver)

Build a g::GreenFunction of Hamiltonian h using solver. See GreenSolvers for available solvers. If solver is not provided, a default solver is chosen automatically based on the type of h.

Currying

h |> greenfunction(solver)

Curried form equivalent to greenfunction(h, solver).

Partial evaluation

GreenFunctions allow independent, partial evaluation of their positions (producing a GreenSlice) and energy/parameters (producing a GreenSolution). Depending on the solver, this may avoid repeating calculations unnecesarily when sweeping over either of these with the other fixed.

g[ss]
 g[siteselector(; ss...)]

Build a gs::GreenSlice that represents a Green function at arbitrary energy and parameter values, but at specific sites on the lattice defined by siteselector(; ss...), with ss::NamedTuple (see siteselector).

g[contact_index::Integer]

Build a GreenSlice equivalent to g[contact_sites...], where contact_sites... correspond to sites in contact number contact_index (must have 1<= contact_index <= number_of_contacts). See attach for details on attaching contacts to a Hamiltonian.

g[:]

Build a GreenSlice over all contacts.

g[dst, src]

Build a gs::GreenSlice between sites specified by src and dst, which can take any of the forms above. Therefore, all the previous single-index slice forms correspond to a diagonal block g[i, i].

g[diagonal(i, kernel = missing)]

If kernel = missing, efficiently construct diag(g[i, i]). If kernel is a matrix, return tr(g[site, site] * kernel) over each site encoded in i. Note that if there are several orbitals per site, these will have different length (i.e. number of orbitals vs number of sites). See also diagonal.

g(ω; params...)

Build a gω::GreenSolution that represents a retarded Green function at arbitrary points on the lattice, but at fixed energy ω and system parameter values param. If ω is complex, the retarded or advanced Green function is returned, depending on sign(imag(ω)). If ω is Real, a small, positive imaginary part is automatically added internally to produce the retarded g.

gω[i]
 gω[i, j]
 gs(ω; params...)

For any gω::GreenSolution or gs::GreenSlice, build the Green function matrix fully evaluated at fixed energy, parameters and positions. The matrix is dense and has scalar elements, so that any orbital structure on each site is flattened.

Example

julia> g = LP.honeycomb() |> hamiltonian(@hopping((; t = 1) -> t)) |> supercell(region = RP.circle(10)) |> greenfunction(GS.SparseLU())
@@ -158,7 +158,7 @@
 GreenSlice{Float64,2,0}: Green function at arbitrary energy, but at a fixed lattice positions
 
 julia> gω[ss] == gs(0.1; t = 2)
-true

See also

`GreenSolvers`, `diagonal`, `ldos`, `conductance`, `current`, `josephson`
source
Quantica.hamiltonianFunction
hamiltonian(lat::Lattice, model; orbitals = 1)

Create a Hamiltonian or ParametricHamiltonian by applying model to the lattice lat (see onsite, @onsite, hopping and @hopping for details on building tight-binding models).

hamiltonian(lat::Lattice, model, modifiers...; orbitals = 1)
+true

See also

`GreenSolvers`, `diagonal`, `ldos`, `conductance`, `current`, `josephson`
source
Quantica.hamiltonianFunction
hamiltonian(lat::Lattice, model; orbitals = 1)

Create a Hamiltonian or ParametricHamiltonian by applying model to the lattice lat (see onsite, @onsite, hopping and @hopping for details on building tight-binding models).

hamiltonian(lat::Lattice, model, modifiers...; orbitals = 1)
 hamiltonian(h::AbstractHamiltonian, modifiers...; orbitals = 1)

Create a ParametricHamiltonian where all onsite and hopping terms in model can be parametrically modified through the provided modifiers (see @onsite! and @hopping! for details on defining modifiers).

Keywords

  • orbitals: number of orbitals per sublattice. If an Integer (or a Val{<:Integer} for type-stability), all sublattices will have the same number of orbitals. A collection of values indicates the orbitals on each sublattice.

Currying

lat |> hamiltonian(model[, modifiers...]; kw...)

Curried form of hamiltonian equivalent to hamiltonian(lat, model, modifiers...; kw...).

lat |> model

Alternative and less general curried form equivalent to hamiltonian(lat, model).

h |> modifier

Alternative and less general curried form equivalent to hamiltonian(h, modifier).

Indexing

h[dn::SVector{L,Int}]
 h[dn::NTuple{L,Int}]

Return the Bloch harmonic of an h::AbstractHamiltonian in the form of a SparseMatrixCSC with complex scalar eltype. This matrix is "flat", in the sense that it contains matrix elements between indivisual orbitals, not sites. This distinction is only relevant for multiorbital Hamiltonians. To access the non-flattened matrix use h[unflat(dn)] (see also unflat).

h[()]

Special syntax equivalent to h[(0...)], which access the fundamental Bloch harmonic.

Call syntax

ph(; params...)

Return a h::Hamiltonian from a ph::ParametricHamiltonian by applying specific values to its parameters params. If ph is a non-parametric Hamiltonian instead, this is a no-op.

h(φs; params...)

Return the flat, sparse Bloch matrix of h::AbstractHamiltonian at Bloch phases φs, with applied parameters params if h is a ParametricHamiltonian. The Bloch matrix is defined as

    H = ∑_dn exp(-im φs⋅dn) H_dn

where H_dn = h[dn] is the dn flat Bloch harmonic of h, and φs[i] = k⋅aᵢ in terms of the wavevector k and the Bravais vectors aᵢ.

Examples

julia> h = hamiltonian(LP.honeycomb(), hopping(SA[0 1; 1 0], range = 1/√3), orbitals = 2)
 Hamiltonian{Float64,2,2}: Hamiltonian on a 2D Lattice in 2D space
@@ -175,7 +175,7 @@
      ⋅          ⋅      0.0+0.0im  3.0+0.0im
      ⋅          ⋅      3.0+0.0im  0.0+0.0im
  0.0+0.0im  3.0+0.0im      ⋅          ⋅
- 3.0+0.0im  0.0+0.0im      ⋅          ⋅

See also

`lattice`, `onsite`, `hopping`, `@onsite`, `@hopping`, `@onsite!`, `@hopping!`, `ishermitian`
source
Quantica.hoppingFunction
hopping(t; hops...)
+ 3.0+0.0im  0.0+0.0im      ⋅          ⋅

See also

`lattice`, `onsite`, `hopping`, `@onsite`, `@hopping`, `@onsite!`, `@hopping!`, `ishermitian`
source
Quantica.hoppingFunction
hopping(t; hops...)
 hopping((r, dr) -> t(r, dr); hops...)

Build a TighbindingModel representing a uniform or a position-dependent hopping amplitude, respectively, on hops selected by hopselector(; hops...) (see hopselector for details).

Hops from a site at position r₁ to another at r₂ are described using the hop center r = (r₁ + r₂)/2 and the hop vector dr = r₂ - r₁. Hopping amplitudes t can be a Number (for hops between single-orbital sites), a UniformScaling (e.g. 2I) or an AbstractMatrix (use SMatrix for performance) of dimensions matching the number of orbitals in the selected sites. Models may be applied to a lattice lat to produce an Hamiltonian with hamiltonian(lat, model; ...), see hamiltonian. Position dependent models are forced to preserve the periodicity of the lattice.

hopping(m::Union{TighbindingModel,ParametricModel}; hops...)

Convert m into a new model with just hopping terms acting on hops.

Model algebra

Models can be combined using +, - and *, or conjugated with ', e.g. onsite(1) - 2 * hopping(1)'.

Examples

julia> model = hopping((r, dr) -> cis(dot(SA[r[2], -r[1]], dr)); dcells = (0,0)) + onsite(r -> rand())
 TightbindingModel: model with 2 terms
   HoppingTerm{Function}:
@@ -199,7 +199,7 @@
   Element type     : scalar (ComplexF64)
   Onsites          : 8
   Hoppings         : 16
-  Coordination     : 2.0

See also

`onsite`, `@onsite`, `@hopping`, `@onsite!`, `@hopping!`, `hamiltonian`, `plusadjoint`
source
Quantica.hopselectorFunction
hopselector(; range = neighbors(1), dcells = missing, sublats = missing, region = missing)

Return a HopSelector object that can be used to select a finite set of hops between sites in a lattice. Hops between two sites at positions r₁ = r - dr/2 and r₂ = r + dr, belonging to unit cells with a cell distance dn::SVector{L,Int} and to a sublattices with names s₁::Symbol and s₂::Symbol will be selected only if

`region(r, dr) && (s₁ => s₂ in sublats) && (dcell in dcells) && (norm(dr) <= range)`

If any of these is missing it will not be used to constraint the selection.

Generalization

While range is usually a Real, and sublats and dcells are usually collections of Pair{Symbol}s and SVectors, respectively, they also admit other possibilities:

sublats = :A                       # Hops from :A to :A
+  Coordination     : 2.0

See also

`onsite`, `@onsite`, `@hopping`, `@onsite!`, `@hopping!`, `hamiltonian`, `plusadjoint`
source
Quantica.hopselectorFunction
hopselector(; range = neighbors(1), dcells = missing, sublats = missing, region = missing)

Return a HopSelector object that can be used to select a finite set of hops between sites in a lattice. Hops between two sites at positions r₁ = r - dr/2 and r₂ = r + dr, belonging to unit cells with a cell distance dn::SVector{L,Int} and to a sublattices with names s₁::Symbol and s₂::Symbol will be selected only if

`region(r, dr) && (s₁ => s₂ in sublats) && (dcell in dcells) && (norm(dr) <= range)`

If any of these is missing it will not be used to constraint the selection.

Generalization

While range is usually a Real, and sublats and dcells are usually collections of Pair{Symbol}s and SVectors, respectively, they also admit other possibilities:

sublats = :A                       # Hops from :A to :A
 sublats = :A => :B                 # Hops from :A to :B sublattices, but not from :B to :A
 sublats = (:A => :B,)              # Same as above
 sublats = (:A => :B, :C => :D)     # Hopping from :A to :B or :C to :D
@@ -233,7 +233,7 @@
   Element type     : scalar (ComplexF64)
   Onsites          : 0
   Hoppings         : 18
-  Coordination     : 9.0

See also

`siteselector`, `lattice`, `hopping`, `@hopping`, `@hopping!`
source
Quantica.josephsonFunction
josephson(gs::GreenSlice, ωmax; kBT = 0.0, phases = missing, imshift = missing, slope = 1, post = real, atol = 1e-7, quadgk_opts...)

For a gs = g[i::Integer] slice of the g::GreenFunction of a hybrid junction, build a partially evaluated object J::Integrator representing the equilibrium (static) Josephson current I_J flowing into g through contact i, integrated from -ωmax to ωmax (or from -ωmax to 0 at zero temperature kBT = 0). The result of I_J is given in units of qe/h (q is the dimensionless carrier charge). I_J can be written as $I_J = Re ∫ dω f(ω) j(ω)$, where $j(ω) = (qe/h) × 2Tr[(ΣʳᵢGʳ - GʳΣʳᵢ)τz]$.

Full evaluation

J(; params...)

Evaluate the Josephson current I_J for the given g parameters params, if any.

Keywords

  • kBT : temperature in same energy units as the Hamiltonian
  • phases : collection of superconducting phase biases to apply to the contact, so as to efficiently compute the full current-phase relation [I_J(ϕ) for ϕ in phases]. Note that each phase bias ϕ is applied by a [cis(-ϕ/2) 0; 0 cis(ϕ/2)] rotation to the self energy, which is almost free. If missing, a single I_J is returned.
  • imshift: if missing the initial and final integration points ± ωmax are shifted by im * sqrt(eps(ωmax)), to avoid the real axis. Otherwise a shift im*imshift is applied (may be zero if ωmax is greater than the bandwidth).
  • slope: if non-zero, the integration will be performed along a piecewise-linear path in the complex plane (-ωmax, -ωmax/2 * (1+slope*im), 0, ωmax/2 * (1+slope*im), ωmax), taking advantage of the holomorphic integrand f(ω) j(ω) and the Cauchy Integral Theorem for faster convergence.
  • post: function to apply to the result of ∫ dω f(ω) j(ω) to obtain the result, post = real by default.
  • atol: absolute integration tolerance. The default 1e-7 is chosen to avoid excessive integration times when the current is actually zero.
  • quadgk_opts : extra keyword arguments (other than atol) to pass on to the function QuadGK.quadgk that is used for the integration.

Examples

julia> glead = LP.square() |> hamiltonian(onsite(0.0005 * SA[0 1; 1 0]) + hopping(SA[1 0; 0 -1]), orbitals = 2) |> supercell((1,0), region = r->-2<r[2]<2) |> greenfunction(GS.Schur(boundary = 0));
+  Coordination     : 9.0

See also

`siteselector`, `lattice`, `hopping`, `@hopping`, `@hopping!`
source
Quantica.josephsonFunction
josephson(gs::GreenSlice, ωmax; kBT = 0.0, phases = missing, imshift = missing, slope = 1, post = real, atol = 1e-7, quadgk_opts...)

For a gs = g[i::Integer] slice of the g::GreenFunction of a hybrid junction, build a partially evaluated object J::Integrator representing the equilibrium (static) Josephson current I_J flowing into g through contact i, integrated from -ωmax to ωmax (or from -ωmax to 0 at zero temperature kBT = 0). The result of I_J is given in units of qe/h (q is the dimensionless carrier charge). I_J can be written as $I_J = Re ∫ dω f(ω) j(ω)$, where $j(ω) = (qe/h) × 2Tr[(ΣʳᵢGʳ - GʳΣʳᵢ)τz]$.

Full evaluation

J(; params...)

Evaluate the Josephson current I_J for the given g parameters params, if any.

Keywords

  • kBT : temperature in same energy units as the Hamiltonian
  • phases : collection of superconducting phase biases to apply to the contact, so as to efficiently compute the full current-phase relation [I_J(ϕ) for ϕ in phases]. Note that each phase bias ϕ is applied by a [cis(-ϕ/2) 0; 0 cis(ϕ/2)] rotation to the self energy, which is almost free. If missing, a single I_J is returned.
  • imshift: if missing the initial and final integration points ± ωmax are shifted by im * sqrt(eps(ωmax)), to avoid the real axis. Otherwise a shift im*imshift is applied (may be zero if ωmax is greater than the bandwidth).
  • slope: if non-zero, the integration will be performed along a piecewise-linear path in the complex plane (-ωmax, -ωmax/2 * (1+slope*im), 0, ωmax/2 * (1+slope*im), ωmax), taking advantage of the holomorphic integrand f(ω) j(ω) and the Cauchy Integral Theorem for faster convergence.
  • post: function to apply to the result of ∫ dω f(ω) j(ω) to obtain the result, post = real by default.
  • atol: absolute integration tolerance. The default 1e-7 is chosen to avoid excessive integration times when the current is actually zero.
  • quadgk_opts : extra keyword arguments (other than atol) to pass on to the function QuadGK.quadgk that is used for the integration.

Examples

julia> glead = LP.square() |> hamiltonian(onsite(0.0005 * SA[0 1; 1 0]) + hopping(SA[1 0; 0 -1]), orbitals = 2) |> supercell((1,0), region = r->-2<r[2]<2) |> greenfunction(GS.Schur(boundary = 0));
 
 julia> g0 = LP.square() |> hamiltonian(hopping(SA[1 0; 0 -1]), orbitals = 2) |> supercell(region = r->-2<r[2]<2 && r[1]≈0) |> attach(glead, reverse = true) |> attach(glead) |> greenfunction;
 
@@ -258,7 +258,7 @@
   0.008147188939637184
   0.008844017741697798
   0.009272686486294741
-  9.310666393245707e-13

See also

`greenfunction`,`ldos`, `current`, `conductance`, `transmission`
source
Quantica.latticeFunction
lattice(sublats::Sublat...; bravais = (), dim, type, names)
+  9.310666393245707e-13

See also

`greenfunction`,`ldos`, `current`, `conductance`, `transmission`
source
Quantica.latticeFunction
lattice(sublats::Sublat...; bravais = (), dim, type, names)
 lattice(sublats::AbstractVector{<:Sublat}; bravais = (), dim, type, names)

Create a Lattice{T,E,L} from sublattices sublats, where L is the number of Bravais vectors given by bravais, T = type is the AbstractFloat type of spatial site coordinates, and dim = E is the spatial embedding dimension.

lattice(lat::Lattice; bravais = missing, dim = missing, type = missing, names = missing)

Create a new lattice by applying any non-missing keywords to lat.

lattice(x)

Return the parent lattice of object x, of type e.g. LatticeSlice, Hamiltonian, etc.

Keywords

  • bravais: a collection of one or more Bravais vectors of type NTuple{E} or SVector{E}. It can also be an AbstractMatrix of dimension E×L. The default bravais = () corresponds to a bounded lattice with no Bravais vectors.
  • names: a collection of Symbols. Can be used to rename sublats. Any repeated names will be replaced if necessary by :A, :B etc. to ensure that all sublattice names are unique.

Indexing

lat[kw...]

Indexing into a lattice lat with keywords returns LatticeSlice representing a finite collection of sites selected by siteselector(; kw...). See siteselector for details on possible kw, and sites to obtain site positions.

lat[]

Special case equivalent to lat[cells = (0,...)] that returns a LatticeSlice of the zero-th unitcell.

Examples

julia> lat = lattice(sublat((0, 0)), sublat((0, 1)); bravais = (1, 0), type = Float32, dim = 3, names = (:up, :down))
 Lattice{Float32,3,1} : 1D lattice in 3D space
   Bravais vectors : Vector{Float32}[[1.0, 0.0, 0.0]]
@@ -271,7 +271,7 @@
   Bravais vectors : [[1.0, 0.0]]
   Sublattices     : 2
     Names         : (:A, :B)
-    Sites         : (1, 1) --> 2 total per unit cell

See also

`LatticePresets`, `sublat`, `sites`, `supercell`
source
Quantica.ldosFunction
ldos(gs::GreenSlice; kernel = I)

Build ρs::LocalSpectralDensitySlice, a partially evaluated object representing the local density of states ρᵢ(ω) at specific sites i but at arbitrary energy ω.

ldos(gω::GreenSolution; kernel = I)

Build ρω::LocalSpectralDensitySolution, as above, but for ρᵢ(ω) at a fixed ω and arbitrary sites i. See also greenfunction for details on building a GreenSlice and GreenSolution.

The local density of states is defined here as $ρᵢ(ω) = -Tr(gᵢᵢ(ω))/π$, where gᵢᵢ(ω) is the retarded Green function at a given site i.

Keywords

  • kernel : for multiorbital sites, kernel allows to compute a generalized ldos ρᵢ(ω) = -Tr(gᵢᵢ(ω) * kernel)/π, where gᵢᵢ(ω) is the retarded Green function at site i and energy ω. If kernel = missing, the complete, orbital-resolved ldos is returned.

Full evaluation

ρω[sites...]
+    Sites         : (1, 1) --> 2 total per unit cell

See also

`LatticePresets`, `sublat`, `sites`, `supercell`
source
Quantica.ldosFunction
ldos(gs::GreenSlice; kernel = I)

Build ρs::LocalSpectralDensitySlice, a partially evaluated object representing the local density of states ρᵢ(ω) at specific sites i but at arbitrary energy ω.

ldos(gω::GreenSolution; kernel = I)

Build ρω::LocalSpectralDensitySolution, as above, but for ρᵢ(ω) at a fixed ω and arbitrary sites i. See also greenfunction for details on building a GreenSlice and GreenSolution.

The local density of states is defined here as $ρᵢ(ω) = -Tr(gᵢᵢ(ω))/π$, where gᵢᵢ(ω) is the retarded Green function at a given site i.

Keywords

  • kernel : for multiorbital sites, kernel allows to compute a generalized ldos ρᵢ(ω) = -Tr(gᵢᵢ(ω) * kernel)/π, where gᵢᵢ(ω) is the retarded Green function at site i and energy ω. If kernel = missing, the complete, orbital-resolved ldos is returned.

Full evaluation

ρω[sites...]
 ρs(ω; params...)

Given a partially evaluated ρω::LocalSpectralDensitySolution or ρs::LocalSpectralDensitySlice, build a vector [ρ₁(ω), ρ₂(ω)...] of fully evaluated local densities of states.

Example

julia> g = HP.graphene(a0 = 1, t0 = 1) |> supercell(region = RP.circle(20)) |> attach(nothing, region = RP.circle(1)) |> greenfunction(GS.KPM(order = 300, bandrange = (-3.1, 3.1)))
 GreenFunction{Float64,2,0}: Green function of a Hamiltonian{Float64,2,0}
   Solver          : AppliedKPMGreenSolver
@@ -297,7 +297,7 @@
  0.036802204179317045
 
 julia> ldos(g(0.2))[1] == -imag.(g[diagonal(1; kernel = I)](0.2)) ./ π
-true

See also

`greenfunction`, `diagonal`, `current`, `conductance`, `josephson`, `transmission`
source
Quantica.neighborsFunction
neighbors(n::Int)

Create a Neighbors(n) object that represents a hopping range to distances corresponding to the n-th nearest neighbors in a given lattice, irrespective of their sublattice. Neighbors at equal distance do not count towards n.

neighbors(n::Int, lat::Lattice)

Obtain the actual nth-nearest-neighbot distance between sites in lattice lat.

See also

`hopping`
source
Quantica.onsiteFunction
onsite(o; sites...)
+true

See also

`greenfunction`, `diagonal`, `current`, `conductance`, `josephson`, `transmission`
source
Quantica.neighborsFunction
neighbors(n::Int)

Create a Neighbors(n) object that represents a hopping range to distances corresponding to the n-th nearest neighbors in a given lattice, irrespective of their sublattice. Neighbors at equal distance do not count towards n.

neighbors(n::Int, lat::Lattice)

Obtain the actual nth-nearest-neighbot distance between sites in lattice lat.

See also

`hopping`
source
Quantica.onsiteFunction
onsite(o; sites...)
 onsite(r -> o(r); sites...)

Build a TighbindingModel representing a uniform or a position-dependent onsite potential, respectively, on sites selected by siteselector(; sites...) (see siteselector for details).

Site positions are r::SVector{E}, where E is the embedding dimension of the lattice. The onsite potential o can be a Number (for single-orbital sites), a UniformScaling (e.g. 2I) or an AbstractMatrix (use SMatrix for performance) of dimensions matching the number of orbitals in the selected sites. Models may be applied to a lattice lat to produce a Hamiltonian with hamiltonian(lat, model; ...), see hamiltonian. Position dependent models are forced to preserve the periodicity of the lattice.

onsite(m::{TighbindingModel,ParametricModel}; sites...)

Convert m into a new model with just onsite terms acting on sites.

Model algebra

Models can be combined using +, - and *, or conjugated with ', e.g. onsite(1) - 2 * hopping(1)'.

Examples

julia> model = onsite(r -> norm(r) * SA[0 1; 1 0]; sublats = :A) - hopping(I; range = 2)
 TightbindingModel: model with 2 terms
   OnsiteTerm{Function}:
@@ -321,7 +321,7 @@
   Element type     : 2 × 2 blocks (ComplexF64)
   Onsites          : 64
   Hoppings         : 2048
-  Coordination     : 32.0

See also

`hopping`, `@onsite`, `@hopping`, `@onsite!`, `@hopping!`, `hamiltonian`
source
Quantica.plusadjointFunction
plusadjoint(t::Model)

Returns a model t + t'. This is a convenience function analogous to the + h.c. notation.

Example

julia> model = hopping(im, sublats = :A => :B) |> plusadjoint
+  Coordination     : 32.0

See also

`hopping`, `@onsite`, `@hopping`, `@onsite!`, `@hopping!`, `hamiltonian`
source
Quantica.plusadjointFunction
plusadjoint(t::Model)

Returns a model t + t'. This is a convenience function analogous to the + h.c. notation.

Example

julia> model = hopping(im, sublats = :A => :B) |> plusadjoint
 TightbindingModel: model with 2 terms
   HoppingTerm{Complex{Bool}}:
     Region            : any
@@ -351,9 +351,9 @@
 julia> h((0,0))
 2×2 SparseArrays.SparseMatrixCSC{ComplexF64, Int64} with 2 stored entries:
      ⋅      0.0-3.0im
- 0.0+3.0im      ⋅
source
Quantica.sitesFunction
sites(lat::Lattice[, sublat])

Return a collection of site positions in the unit cell of lattice lat. If a sublat::Symbol or sublat::Int is specified, only sites for the specified sublattice are returned.

sites(ls::LatticeSlice)

Return a collection of positions of a LatticeSlice, generally obtained by indexing a lattice lat[sel...] with some siteselector keywords sel. See also lattice.

Note: the returned collections can be of different types (vectors, generators, views...)

Examples

julia> sites(LatticePresets.honeycomb(), :A)
+ 0.0+3.0im      ⋅
source
Quantica.sitesFunction
sites(lat::Lattice[, sublat])

Return a collection of site positions in the unit cell of lattice lat. If a sublat::Symbol or sublat::Int is specified, only sites for the specified sublattice are returned.

sites(ls::LatticeSlice)

Return a collection of positions of a LatticeSlice, generally obtained by indexing a lattice lat[sel...] with some siteselector keywords sel. See also lattice.

Note: the returned collections can be of different types (vectors, generators, views...)

Examples

julia> sites(LatticePresets.honeycomb(), :A)
 1-element view(::Vector{SVector{2, Float64}}, 1:1) with eltype SVector{2, Float64}:
- [0.0, -0.2886751345948129]

See also

`lattice`, `siteselector`
source
Quantica.siteselectorFunction
siteselector(; region = missing, sublats = missing, cells = missing)

Return a SiteSelector object that can be used to select a finite set of sites in a lattice. Sites at position r::SVector{E}, belonging to a cell of index n::SVector{L,Int} and to a sublattice with name s::Symbol will be selected only if

`region(r) && s in sublats && n in cells`

Any missing region, sublat or cells will not be used to constraint the selection.

Generalization

While sublats and cells are usually collections of Symbols and SVectors, respectively, they also admit other possibilities:

  • If either cells or sublats are a single cell or sublattice, they will be treated as single-element collections
  • If sublat is a collection of Integers, it will refer to sublattice numbers.
  • If cells is an i::Integer, it will be converted to an SVector{1}
  • If cells is a collection, each element will be converted to an SVector.
  • If cells is a boolean function, n in cells will be the result of cells(n)

Usage

Although the constructor siteselector(; kw...) is exported, the end user does not usually need to call it directly. Instead, the keywords kw are input into different functions that allow filtering sites, which themselves call siteselector internally as needed. Some of these functions are

  • getindex(lat::Lattice; kw...) : return a LatticeSlice with sites specified by kw (also lat[kw...])
  • supercell(lat::Lattice; kw...) : returns a bounded lattice with the sites specified by kw
  • onsite(...; kw...) : onsite model term to be applied to sites specified by kw
  • @onsite!(...; kw...) : onsite modifier to be applied to sites specified by kw

See also

`hopselector`, `lattice`, `supercell`, `onsite`, `@onsite`, `@onsite!`
source
Quantica.spectrumFunction
spectrum(h::AbstractHamiltonian, ϕs; solver = EigenSolvers.LinearAlgebra(), transform = missing, params...)

Compute the Spectrum of the Bloch matrix h(ϕs; params...) using the specified eigensolver, with transform applied to the resulting eigenenergies, if not missing. Eigenpairs are sorted by the real part of their energy. See EigenSolvers for available solvers and their options.

spectrum(h::AbstractHamiltonian; kw...)

For a 0D h, equivalent to spectrum(h, (); kw...)

spectrum(m::AbstractMatrix; solver = EigenSolvers.LinearAlgebra()], transform = missing)

Compute the Spectrum of matrix m using solver and transform.

spectrum(b::Bandstructure, ϕs)

Compute the Spectrum corresponding to slicing the bandstructure b at point ϕs of its base mesh (see bands for details).

Indexing and destructuring

Eigenenergies ϵs::Tuple and eigenstates ψs::Matrix can be extracted from a spectrum sp using any of the following

ϵs, ψs = sp
+ [0.0, -0.2886751345948129]

See also

`lattice`, `siteselector`
source
Quantica.siteselectorFunction
siteselector(; region = missing, sublats = missing, cells = missing)

Return a SiteSelector object that can be used to select a finite set of sites in a lattice. Sites at position r::SVector{E}, belonging to a cell of index n::SVector{L,Int} and to a sublattice with name s::Symbol will be selected only if

`region(r) && s in sublats && n in cells`

Any missing region, sublat or cells will not be used to constraint the selection.

Generalization

While sublats and cells are usually collections of Symbols and SVectors, respectively, they also admit other possibilities:

  • If either cells or sublats are a single cell or sublattice, they will be treated as single-element collections
  • If sublat is a collection of Integers, it will refer to sublattice numbers.
  • If cells is an i::Integer, it will be converted to an SVector{1}
  • If cells is a collection, each element will be converted to an SVector.
  • If cells is a boolean function, n in cells will be the result of cells(n)

Usage

Although the constructor siteselector(; kw...) is exported, the end user does not usually need to call it directly. Instead, the keywords kw are input into different functions that allow filtering sites, which themselves call siteselector internally as needed. Some of these functions are

  • getindex(lat::Lattice; kw...) : return a LatticeSlice with sites specified by kw (also lat[kw...])
  • supercell(lat::Lattice; kw...) : returns a bounded lattice with the sites specified by kw
  • onsite(...; kw...) : onsite model term to be applied to sites specified by kw
  • @onsite!(...; kw...) : onsite modifier to be applied to sites specified by kw

See also

`hopselector`, `lattice`, `supercell`, `onsite`, `@onsite`, `@onsite!`
source
Quantica.spectrumFunction
spectrum(h::AbstractHamiltonian, ϕs; solver = EigenSolvers.LinearAlgebra(), transform = missing, params...)

Compute the Spectrum of the Bloch matrix h(ϕs; params...) using the specified eigensolver, with transform applied to the resulting eigenenergies, if not missing. Eigenpairs are sorted by the real part of their energy. See EigenSolvers for available solvers and their options.

spectrum(h::AbstractHamiltonian; kw...)

For a 0D h, equivalent to spectrum(h, (); kw...)

spectrum(m::AbstractMatrix; solver = EigenSolvers.LinearAlgebra()], transform = missing)

Compute the Spectrum of matrix m using solver and transform.

spectrum(b::Bandstructure, ϕs)

Compute the Spectrum corresponding to slicing the bandstructure b at point ϕs of its base mesh (see bands for details).

Indexing and destructuring

Eigenenergies ϵs::Tuple and eigenstates ψs::Matrix can be extracted from a spectrum sp using any of the following

ϵs, ψs = sp
 ϵs = first(sp)
 ϵs = energies(sp)
 ψs = last(sp)
@@ -366,11 +366,11 @@
 States:
 2×2 Matrix{ComplexF64}:
  -0.707107+0.0im  0.707107+0.0im
-  0.707107+0.0im  0.707107+0.0im

See also

`EigenSolvers`, `bands`
source
Quantica.statesFunction
states(sp::Spectrum)

Returns the eigenstates in sp as columns of a matrix. Equivalent to last(sp).

See also

`spectrum`, `bands`
source
Quantica.subdivFunction
subdiv((x₁, x₂, ..., xₙ), (p₁, p₂, ..., pₙ₋₁))

Build a vector of values between x₁ and xₙ containing all xᵢ such that in each interval [xᵢ, xᵢ₊₁] there are pᵢ equally space values.

subdiv((x₁, x₂, ..., xₙ), p)

Same as above with all pᵢ = p

subdiv(x₁, x₂, p)

Equivalent to subdiv((x₁, x₂), p) == collect(range(x₁, x₂, length = p))

source
Quantica.sublatFunction
sublat(sites...; name::Symbol = :A)
+  0.707107+0.0im  0.707107+0.0im

See also

`EigenSolvers`, `bands`
source
Quantica.statesFunction
states(sp::Spectrum)

Returns the eigenstates in sp as columns of a matrix. Equivalent to last(sp).

See also

`spectrum`, `bands`
source
Quantica.subdivFunction
subdiv((x₁, x₂, ..., xₙ), (p₁, p₂, ..., pₙ₋₁))

Build a vector of values between x₁ and xₙ containing all xᵢ such that in each interval [xᵢ, xᵢ₊₁] there are pᵢ equally space values.

subdiv((x₁, x₂, ..., xₙ), p)

Same as above with all pᵢ = p

subdiv(x₁, x₂, p)

Equivalent to subdiv((x₁, x₂), p) == collect(range(x₁, x₂, length = p))

source
Quantica.sublatFunction
sublat(sites...; name::Symbol = :A)
 sublat(sites::AbstractVector; name::Symbol = :A)

Create a Sublat{E,T} that adds a sublattice, of name name, with sites at positions sites in E dimensional space. Sites positions can be entered as Tuples or SVectors.

Examples

julia> sublat((0.0, 0), (1, 1), (1, -1), name = :A)
 Sublat{2,Float64} : sublattice of Float64-typed sites in 2D space
   Sites    : 3
-  Name     : :A
source
Quantica.supercellFunction
supercell(lat::Lattice{E,L}, v::NTuple{L,Integer}...; seed = missing, kw...)
+  Name     : :A
source
Quantica.supercellFunction
supercell(lat::Lattice{E,L}, v::NTuple{L,Integer}...; seed = missing, kw...)
 supercell(lat::Lattice{E,L}, uc::SMatrix{L,L´,Int}; seed = missing, kw...)

Generate a new Lattice from an L-dimensional lattice lat with a larger unit cell, such that its Bravais vectors are br´= br * uc. Here uc::SMatrix{L,L´,Int} is the integer supercell matrix, with the vectors vs as its columns. If no v are given, the new lattice will have no Bravais vectors (i.e. it will be bounded, with its shape determined by keywords kw...). Likewise, if L´ < L, the resulting lattice will be bounded along L´ - L directions, as dictated by kw....

Only sites selected by siteselector(; kw...) will be included in the supercell (see siteselector for details on the available keywords kw). If no keyword region is given in kw, a single Bravais unit cell perpendicular to the v axes will be selected along the L-L´ bounded directions.

supercell(lattice::Lattice{E,L}, factors::Integer...; seed = missing, kw...)

Call supercell with different scaling along each Bravais vector, so that supercell matrix uc is Diagonal(factors). If a single factor is given, uc = SMatrix{L,L}(factor * I)

supercell(h::Hamiltonian, v...; mincoordination = 0, seed = missing, kw...)

Transform the Lattice of h to have a larger unit cell, while expanding the Hamiltonian accordingly.

Keywords

  • seed::NTuple{L,Integer}: starting cell index to perform search of included sites. By default seed = missing, which makes search start from the zero-th cell.
  • mincoordination::Integer: minimum number of nonzero hopping neighbors required for sites to be included in the supercell. Sites with less coordination will be removed recursively, until all remaining sites satisfy mincoordination.

Currying

lat_or_h |> supercell(v...; kw...)

Curried syntax, equivalent to supercell(lat_or_h, v...; kw...)

Examples

julia> LatticePresets.square() |> supercell((1, 1), region = r -> 0 < r[1] < 5)
 Lattice{Float64,2,1} : 1D lattice in 2D space
   Bravais vectors : [[1.0, 1.0]]
@@ -383,15 +383,15 @@
   Bravais vectors : [[1.5, 2.598076], [-1.5, 2.598076]]
   Sublattices     : 2
     Names         : (:A, :B)
-    Sites         : (9, 9) --> 18 total per unit cell

See also

`supercell`, `siteselector`
source
Quantica.transformFunction
transform(lat_or_h::Union{Lattice,AbstractHamiltonian}, f::Function)

Build a new lattice or hamiltonian transforming each site positions r into f(r).

Currying

x |> transform(f::Function)

Curried version of transform, equivalent to transform(f, x)

Note: Unexported Quantica.transform! is also available for in-place transforms. Use with care, as aliasing (i.e. several objects sharing the modified one) can produce unexpected results.

Examples

julia> LatticePresets.square() |> transform(r -> 3r)
+    Sites         : (9, 9) --> 18 total per unit cell

See also

`supercell`, `siteselector`
source
Quantica.transformFunction
transform(lat_or_h::Union{Lattice,AbstractHamiltonian}, f::Function)

Build a new lattice or hamiltonian transforming each site positions r into f(r).

Currying

x |> transform(f::Function)

Curried version of transform, equivalent to transform(f, x)

Note: Unexported Quantica.transform! is also available for in-place transforms. Use with care, as aliasing (i.e. several objects sharing the modified one) can produce unexpected results.

Examples

julia> LatticePresets.square() |> transform(r -> 3r)
 Lattice{Float64,2,2} : 2D lattice in 2D space
   Bravais vectors : [[3.0, 0.0], [0.0, 3.0]]
   Sublattices     : 1
     Names         : (:A,)
-    Sites         : (1,) --> 1 total per unit cell

See also

`translate`, `reverse`, `reverse!`
source
Quantica.translateFunction
translate(lat::Lattice, δr)

Build a new lattice translating each site positions from r to r + δr, where δr can be a NTuple or an SVector in embedding space.

Currying

x |> translate(δr)

Curried version of translate, equivalent to translate(x, δr)

Note: Unexported Quantica.translate! is also available for in-place translations. Use with care, as aliasing (i.e. several objects sharing the modified one) can produce unexpected results.

Examples

julia> LatticePresets.square() |> translate((3,3)) |> sites
+    Sites         : (1,) --> 1 total per unit cell

See also

`translate`, `reverse`, `reverse!`
source
Quantica.translateFunction
translate(lat::Lattice, δr)

Build a new lattice translating each site positions from r to r + δr, where δr can be a NTuple or an SVector in embedding space.

Currying

x |> translate(δr)

Curried version of translate, equivalent to translate(x, δr)

Note: Unexported Quantica.translate! is also available for in-place translations. Use with care, as aliasing (i.e. several objects sharing the modified one) can produce unexpected results.

Examples

julia> LatticePresets.square() |> translate((3,3)) |> sites
 1-element Vector{SVector{2, Float64}}:
  [3.0, 3.0]
-

See also

`transform`, `reverse`, `reverse!`
source
Quantica.transmissionFunction
transmission(gs::GreenSlice)

Given a slice gs = g[i::Integer, j::Integer] of a g::GreenFunction, build a partially evaluated object T::Transmission representing the normal transmission probability Tᵢⱼ(ω) from contact j to i at energy ω. It can be written as $Tᵢⱼ = Tr{gʳΓⁱgᵃΓʲ}$. Here gʳ = g(ω) and gᵃ = (gʳ)' = g(ω') are the retarded and advanced Green function of the system, and Γⁱ = im * (Σⁱ - Σⁱ') is the decay rate at contact i

Full evaluation

T(ω; params...)

Compute the transmission Tᵢⱼ(ω) at a given ω and for the specified params of g.

Examples

julia> # A central system g0 with two 1D leads and transparent contacts
+

See also

`transform`, `reverse`, `reverse!`
source
Quantica.transmissionFunction
transmission(gs::GreenSlice)

Given a slice gs = g[i::Integer, j::Integer] of a g::GreenFunction, build a partially evaluated object T::Transmission representing the normal transmission probability Tᵢⱼ(ω) from contact j to i at energy ω. It can be written as $Tᵢⱼ = Tr{gʳΓⁱgᵃΓʲ}$. Here gʳ = g(ω) and gᵃ = (gʳ)' = g(ω') are the retarded and advanced Green function of the system, and Γⁱ = im * (Σⁱ - Σⁱ') is the decay rate at contact i

Full evaluation

T(ω; params...)

Compute the transmission Tᵢⱼ(ω) at a given ω and for the specified params of g.

Examples

julia> # A central system g0 with two 1D leads and transparent contacts
 
 julia> glead = LP.square() |> hamiltonian(hopping(1)) |> supercell((1,0), region = r->-2<r[2]<2) |> greenfunction(GS.Schur(boundary = 0));
 
@@ -406,10 +406,10 @@
 false
 
 julia> T(0.2 + 1e-10im) ≈ 3
-true

See also

`greenfunction`, `conductance`, `ldos`, `current`, `josephson`
source
Quantica.unflatFunction
unflat(dn)

Construct an u::Unflat object wrapping some indices dn. This object is meant to be used to index into a h::AbstractHamiltonian as h[u], which returns an non-flattened version of the Bloch harmonic h[dn]. Each element in the matrix h[u] is an SMatrix block representing onsite or hoppings between whole sites, in contrast to h[dn] where they are scalars representing single orbitals. This is only relevant for multi-orbital Hamiltonians h.

unflat()

Equivalent to unflat(())

Examples

julia> h = HP.graphene(orbitals = 2); h[unflat(0,0)]
+true

See also

`greenfunction`, `conductance`, `ldos`, `current`, `josephson`
source
Quantica.unflatFunction
unflat(dn)

Construct an u::Unflat object wrapping some indices dn. This object is meant to be used to index into a h::AbstractHamiltonian as h[u], which returns an non-flattened version of the Bloch harmonic h[dn]. Each element in the matrix h[u] is an SMatrix block representing onsite or hoppings between whole sites, in contrast to h[dn] where they are scalars representing single orbitals. This is only relevant for multi-orbital Hamiltonians h.

unflat()

Equivalent to unflat(())

Examples

julia> h = HP.graphene(orbitals = 2); h[unflat(0,0)]
 2×2 SparseArrays.SparseMatrixCSC{SMatrix{2, 2, ComplexF64, 4}, Int64} with 2 stored entries:
                      ⋅                       [2.7+0.0im 0.0+0.0im; 0.0+0.0im 2.7+0.0im]
- [2.7+0.0im 0.0+0.0im; 0.0+0.0im 2.7+0.0im]                      ⋅
source
Quantica.wrapFunction
wrap(h::AbstractHamiltonian, (ϕ₁, ϕ₂,...))

For an h of lattice dimension L and a set of L Bloch phases ϕ = (ϕ₁, ϕ₂,...), contruct a new zero-dimensional h´::AbstractHamiltonian for all Bravais vectors have been eliminated by wrapping the lattice onto itself along the corresponding Bravais vector. Intercell hoppings along wrapped directions will pick up a Bloch phase exp(-iϕ⋅dn).

If a number of phases ϕᵢ are : instead of numbers, the corresponding Bravais vectors will not be wrapped, and the resulting will have a finite lattice dimension .

Currying

h |> wrap((ϕ₁, ϕ₂,...))

Currying syntax equivalent to wrap(h, (ϕ₁, ϕ₂,...)).

Examples

julia> h2D = HP.graphene(); h1D = wrap(h2D, (:, 0.2))
+ [2.7+0.0im 0.0+0.0im; 0.0+0.0im 2.7+0.0im]                      ⋅
source
Quantica.wrapFunction
wrap(h::AbstractHamiltonian, (ϕ₁, ϕ₂,...))

For an h of lattice dimension L and a set of L Bloch phases ϕ = (ϕ₁, ϕ₂,...), contruct a new zero-dimensional h´::AbstractHamiltonian for all Bravais vectors have been eliminated by wrapping the lattice onto itself along the corresponding Bravais vector. Intercell hoppings along wrapped directions will pick up a Bloch phase exp(-iϕ⋅dn).

If a number of phases ϕᵢ are : instead of numbers, the corresponding Bravais vectors will not be wrapped, and the resulting will have a finite lattice dimension .

Currying

h |> wrap((ϕ₁, ϕ₂,...))

Currying syntax equivalent to wrap(h, (ϕ₁, ϕ₂,...)).

Examples

julia> h2D = HP.graphene(); h1D = wrap(h2D, (:, 0.2))
 Hamiltonian{Float64,2,1}: Hamiltonian on a 1D Lattice in 2D space
   Bloch harmonics  : 3
   Harmonic size    : 2 × 2
@@ -420,7 +420,7 @@
   Coordination     : 2.0
 
 julia> h2D((0.3, 0.2)) ≈ h1D(0.3)
-true

See also

`hamiltonian`, `supercell`
source
Quantica.@hoppingMacro
@hopping((; params...) -> t(; params...); hops...)
+true

See also

`hamiltonian`, `supercell`
source
Quantica.@hoppingMacro
@hopping((; params...) -> t(; params...); hops...)
 @hopping((r, dr; params...) -> t(r; params...); hops...)

Build a ParametricModel representing a uniform or a position-dependent hopping amplitude, respectively, on hops selected by hopselector(; hops...) (see hopselector for details).

Hops from a site at position r₁ to another at r₂ are described using the hop center r = (r₁ + r₂)/2 and the hop vector dr = r₂ - r₁. Hopping amplitudes t can be a Number (for hops between single-orbital sites), a UniformScaling (e.g. 2I) or an AbstractMatrix (use SMatrix for performance) of dimensions matching the number of site orbitals in the selected sites. Parametric models may be applied to a lattice lat to produce a ParametricHamiltonian with hamiltonian(lat, model; ...), see hamiltonian. Position dependent models are forced to preserve the periodicity of the lattice.

The difference between regular and parametric tight-binding models (see onsite and hopping) is that parametric models may depend on arbitrary parameters, specified by the params keyword arguments. These are inherited by h::ParametricHamiltonian, which can then be evaluated very efficiently for different parameter values by callling h(; params...), to obtain a regular Hamiltonian without reconstructing it from scratch.

@hopping((ω; params...) -> Σᵢⱼ(ω; params...); hops...)
 @hopping((ω, r, dr; params...) -> Σᵢⱼ(ω, r, dr; params...); hops...)

Special form of a parametric hopping amplitude meant to model a self-energy (see attach).

Model algebra

Parametric models can be combined using +, - and *, or conjugated with ', e.g. @onsite((; o=1) -> o) - 2 * hopping(1)'. The combined parametric models can share parameters.

Examples

julia> model = @hopping((r, dr; t = 1, A = Returns(SA[0,0])) -> t * cis(-dr' * A(r)))
 ParametricModel: model with 1 term
@@ -442,7 +442,7 @@
   Onsites          : 0
   Hoppings         : 24
   Coordination     : 3.0
-  Parameters       : [:A, :t]

See also

`onsite`, `hopping`, `@onsite`, `@onsite!`, `@hopping!`, `attach`, `hamiltonian`
source
Quantica.@hopping!Macro
@hopping!((t; params...) -> t´(t; params...); hops...)
+  Parameters       : [:A, :t]

See also

`onsite`, `hopping`, `@onsite`, `@onsite!`, `@hopping!`, `attach`, `hamiltonian`
source
Quantica.@hopping!Macro
@hopping!((t; params...) -> t´(t; params...); hops...)
 @hopping!((t, r, dr; params...) -> t´(t, r, dr; params...); hops...)

Build a uniform or position-dependent hopping term modifier, respectively, acting on hops selected by hopselector(; hops...) (see hopselector for details).

Hops from a site at position r₁ to another at r₂ are described using the hop center r = (r₁ + r₂)/2 and the hop vector dr = r₂ - r₁. The original hopping amplitude is t, and the modified hopping is , which is a function of t and possibly r, dr. It may optionally also depend on parameters, enconded in params.

Modifiers are meant to be applied to an h:AbstractHamiltonian to obtain a ParametricHamiltonian (with hamiltonian(h, modifiers...) or hamiltonian(lat, model, modifiers...), see hamiltonian). Modifiers will affect only pre-existing model terms. In particular, if no onsite model has been applied to a specific site, its onsite potential will be zero, and will not be modified by any @onsite! modifier. Conversely, if an onsite model has been applied, @onsite! may modify the onsite potential even if it is zero. The same applies to @hopping!.

Examples

julia> model = hopping(1); peierls = @hopping!((t, r, dr; A = r -> SA[0,0]) -> t * cis(-dr' * A(r)))
 HoppingModifier{ParametricFunction{3}}:
   Region            : any
@@ -461,7 +461,7 @@
   Onsites          : 0
   Hoppings         : 600
   Coordination     : 3.0
-  Parameters       : [:A]

See also

`onsite`, `hopping`, `@onsite`, `@hopping`, `@onsite!`, `hamiltonian`
source
Quantica.@onsiteMacro
@onsite((; params...) -> o(; params...); sites...)
+  Parameters       : [:A]

See also

`onsite`, `hopping`, `@onsite`, `@hopping`, `@onsite!`, `hamiltonian`
source
Quantica.@onsiteMacro
@onsite((; params...) -> o(; params...); sites...)
 @onsite((r; params...) -> o(r; params...); sites...)

Build a ParametricModel representing a uniform or a position-dependent onsite potential, respectively, on sites selected by siteselector(; sites...) (see siteselector for details).

Site positions are r::SVector{E}, where E is the embedding dimension of the lattice. The onsite potential o can be a Number (for single-orbital sites), a UniformScaling (e.g. 2I) or an AbstractMatrix (use SMatrix for performance) of dimensions matching the number of orbitals in the selected sites. Parametric models may be applied to a lattice lat to produce a ParametricHamiltonian with hamiltonian(lat, model; ...), see hamiltonian. Position dependent models are forced to preserve the periodicity of the lattice.

The difference between regular and parametric tight-binding models (see onsite and hopping) is that parametric models may depend on arbitrary parameters, specified by the params keyword arguments. These are inherited by h::ParametricHamiltonian, which can then be evaluated very efficiently for different parameter values by callling h(; params...), to obtain a regular Hamiltonian without reconstructing it from scratch.

@onsite((ω; params...) -> Σᵢᵢ(ω; params...); sites...)
 @onsite((ω, r; params...) -> Σᵢᵢ(ω, r; params...); sites...)

Special form of a parametric onsite potential meant to model a self-energy (see attach).

Model algebra

Parametric models can be combined using +, - and *, or conjugated with ', e.g. @onsite((; o=1) -> o) - 2 * hopping(1)'. The combined parametric models can share parameters.

Examples

julia> model = @onsite((r; dμ = 0) -> (r[1] + dμ) * I; sublats = :A) + @onsite((; dμ = 0) -> - dμ * I; sublats = :B)
 ParametricModel: model with 2 terms
@@ -487,7 +487,7 @@
   Onsites          : 8
   Hoppings         : 0
   Coordination     : 0.0
-  Parameters       : [:dμ]

See also

`onsite`, `hopping`, `@hopping`, `@onsite!`, `@hopping!`, `attach`, `hamiltonian`
source
Quantica.@onsite!Macro
@onsite!((o; params...) -> o´(o; params...); sites...)
+  Parameters       : [:dμ]

See also

`onsite`, `hopping`, `@hopping`, `@onsite!`, `@hopping!`, `attach`, `hamiltonian`
source
Quantica.@onsite!Macro
@onsite!((o; params...) -> o´(o; params...); sites...)
 @onsite!((o, r; params...) -> o´(o, r; params...); sites...)

Build a uniform or position-dependent onsite term modifier, respectively, acting on sites selected by siteselector(; sites...) (see siteselector for details).

Site positions are r::SVector{E}, where E is the embedding dimension of the lattice. The original onsite potential is o, and the modified potential is , which is a function of o and possibly r. It may optionally also depend on parameters, enconded in params.

Modifiers are meant to be applied to an h:AbstractHamiltonian to obtain a ParametricHamiltonian (with hamiltonian(h, modifiers...) or hamiltonian(lat, model, modifiers...), see hamiltonian). Modifiers will affect only pre-existing model terms. In particular, if no onsite model has been applied to a specific site, its onsite potential will be zero, and will not be modified by any @onsite! modifier. Conversely, if an onsite model has been applied, @onsite! may modify the onsite potential even if it is zero. The same applies to @hopping!.

Examples

julia> model = onsite(0); disorder = @onsite!((o; W = 0) -> o + W * rand())
 OnsiteModifier{ParametricFunction{1}}:
   Region            : any
@@ -504,4 +504,4 @@
   Onsites          : 200
   Hoppings         : 0
   Coordination     : 0.0
-  Parameters       : [:W]

See also

`onsite`, `hopping`, `@onsite`, `@hopping`, `@hopping!`, `hamiltonian`
source
+ Parameters : [:W]

See also

`onsite`, `hopping`, `@onsite`, `@hopping`, `@hopping!`, `hamiltonian`
source diff --git a/dev/examples/index.html b/dev/examples/index.html index b0bdf27f..197d7f8d 100644 --- a/dev/examples/index.html +++ b/dev/examples/index.html @@ -1,2 +1,2 @@ -Examples · Quantica.jl
+Examples · Quantica.jl
diff --git a/dev/index.html b/dev/index.html index 0e4a129b..72d1a804 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · Quantica.jl

Quantica.jl logo

Quantica.jl is a Julia package for building generic tight-binding models and computing spectral and transport properties.

Installation

julia> import Pkg; Pkg.add("Quantica")

Quantica.jl requires Julia v1.9 or later. Some of its functionality, notably plotting, will become available only after using GLMakie, or some other plotting package from the Makie.jl family. Install GLMakie with

julia> import Pkg; Pkg.add("GLMakie")

Then, to begin using Quantica, just load it by doing

julia> using Quantica

(and possibly also e.g. using GLMakie if you need to plot Quantica objects).

Asking questions, reporting bugs

If you encounter problems, please read the tutorial and examples, your question is probably answered there. You can also check the docstring of each Quantica.jl function here or within the Julia REPL, by entering the function preceded by a ?, e.g. ?hamiltonian.

If you are still stuck, you may sometimes find me (@pablosanjose) at the Julia Slack or Julia Discourse.

If you believe you found a bug in Quantica.jl, please don't hesitate to file a GitHub issue, preferably with detailed instructions to reproduce it. Pull requests with fixes are also welcome!

+Home · Quantica.jl

Quantica.jl logo

Quantica.jl is a Julia package for building generic tight-binding models and computing spectral and transport properties.

Installation

julia> import Pkg; Pkg.add("Quantica")

Quantica.jl requires Julia v1.9 or later. Some of its functionality, notably plotting, will become available only after using GLMakie, or some other plotting package from the Makie.jl family. Install GLMakie with

julia> import Pkg; Pkg.add("GLMakie")

Then, to begin using Quantica, just load it by doing

julia> using Quantica

(and possibly also e.g. using GLMakie if you need to plot Quantica objects).

Asking questions, reporting bugs

If you encounter problems, please read the tutorial and examples, your question is probably answered there. You can also check the docstring of each Quantica.jl function here or within the Julia REPL, by entering the function preceded by a ?, e.g. ?hamiltonian.

If you are still stuck, you may sometimes find me (@pablosanjose) at the Julia Slack or Julia Discourse.

If you believe you found a bug in Quantica.jl, please don't hesitate to file a GitHub issue, preferably with detailed instructions to reproduce it. Pull requests with fixes are also welcome!

diff --git a/dev/tutorial/bandstructures/index.html b/dev/tutorial/bandstructures/index.html index 1819c645..5761e5bb 100644 --- a/dev/tutorial/bandstructures/index.html +++ b/dev/tutorial/bandstructures/index.html @@ -55,4 +55,4 @@ Edges : 462520 Simplices : 384000 -julia> qplot(b[(:, :, :, 0.2)], hide = (:nodes, :wireframe))Fermi surface of a cubic crystal at `µ = 0.2t`
On simplex orientation of bandstructure slices

The above example showcases a current (cosmetic) limitation of the band slicing algorithm: it sometimes fails to align all faces of the resulting manifold to the same orientation. The dark and bright regions of the surface above reveals that approximately half of the faces in this case are facing inward and the rest outward.

+julia> qplot(b[(:, :, :, 0.2)], hide = (:nodes, :wireframe))Fermi surface of a cubic crystal at `µ = 0.2t`
On simplex orientation of bandstructure slices

The above example showcases a current (cosmetic) limitation of the band slicing algorithm: it sometimes fails to align all faces of the resulting manifold to the same orientation. The dark and bright regions of the surface above reveals that approximately half of the faces in this case are facing inward and the rest outward.

diff --git a/dev/tutorial/glossary/index.html b/dev/tutorial/glossary/index.html index 2208c74c..1f7a9833 100644 --- a/dev/tutorial/glossary/index.html +++ b/dev/tutorial/glossary/index.html @@ -1,2 +1,2 @@ -Glossary · Quantica.jl

Glossary

This is a summary of the type of objects you will be studying.

  • Sublat: a sublattice, representing a number of identical sites within the unit cell of a bounded or unbounded lattice. Each site has a position in an E-dimensional space (E is called the embedding dimension). All sites in a given Sublat will be able to hold the same number of orbitals, and they can be thought of as identical atoms. Each Sublat in a Lattice can be given a unique name, by default :A, :B, etc.

  • Lattice: a collection of Sublats plus a collection of L Bravais vectors that define the periodicity of the lattice. A bounded lattice has L=0, and no Bravais vectors. A Lattice with L > 0 can be understood as a periodic (unbounded) collection of unit cells, each containing a set of sites, each of which belongs to a different sublattice.

  • SiteSelector: a rule that defines a subset of sites in a Lattice (not necessarily restricted to a single unit cell)

  • HopSelector: a rule that defines a subset of site pairs in a Lattice (not necessarily restricted to the same unit cell)

  • LatticeSlice: a finite subset of sites in a Lattice, defined by their cell index (an L-dimensional integer vector, usually denoted by n or cell) and their site index within the unit cell (an integer). A LatticeSlice an be constructed by combining a Lattice and a (bounded) SiteSelector.

  • AbstractModel: either a TightBindingModel or a ParametricModel

    • TightBindingModel: a set of HoppingTerms and OnsiteTerms
      • OnsiteTerm: a rule that, applied to a single site, produces a scalar or a (square) matrix that represents the intra-site Hamiltonian elements (single or multi-orbital)
      • HoppingTerm: a rule that, applied to a pair of sites, produces a scalar or a matrix that represents the inter-site Hamiltonian elements (single or multi-orbital)
    • ParametricModel: a set of ParametricOnsiteTerms and ParametricHoppingTerms
      • ParametricOnsiteTerm: an OnsiteTerm that depends on a set of free parameters that can be adjusted, and that may or may not have a default value
      • ParametricHoppingTerm: a HoppingTerm that depends on parameters, like ParametricOnsiteTerm above
  • AbstractHamiltonian: either a Hamiltonian or a ParametricHamiltonian

    • Hamiltonian: a Lattice combined with a TightBindingModel.

      It also includes a specification of the number of orbitals in each Sublat in the Lattice. A Hamiltonian represents a tight-binding Hamiltonian sharing the same periodicity as the Lattice (it is translationally invariant under Bravais vector shifts).

    • ParametricHamiltonian: like the above, but using a ParametricModel, which makes it dependent on a set of free parameters that can be efficiently adjusted.

    An h::AbstractHamiltonian can be used to produce a Bloch matrix h(ϕ; params...) of the same size as the number of orbitals per unit cell, where ϕ = [ϕᵢ...] are Bloch phases and params are values for the free parameters, if any.

  • Spectrum: the set of eigenpairs (eigenvalues and corresponding eigenvectors) of a Bloch matrix. It can be computed with a number of EigenSolvers.

  • Bandstructure: a collection of spectra, evaluated over a discrete mesh (typically a discretization of the Brillouin zone), that is connected to its mesh neighbors into a linearly-interpolated approximation of the AbstractHamiltonian's bandstructure.

  • SelfEnergy: an operator Σ(ω) defined to act on a LatticeSlice of an AbstractHamiltonian that depends on energy ω.

  • OpenHamiltonian: an AbstractHamiltonian combined with a set of SelfEnergies

  • GreenFunction: an OpenHamiltonian combined with a GreenSolver, which is an algorithm that can in general compute the retarded or advanced Green function at any energy between any subset of sites of the underlying lattice.

    • GreenSlice: a GreenFunction evaluated on a specific set of sites, but at an unspecified energy
    • GreenSolution: a GreenFunction evaluated at a specific energy, but on an unspecified set of sites
  • Observable: a physical observable that can be expressed in terms of a GreenFunction.

    Examples of supported observables include local density of states, current density, transmission probability, conductance and Josephson current

+Glossary · Quantica.jl

Glossary

This is a summary of the type of objects you will be studying.

  • Sublat: a sublattice, representing a number of identical sites within the unit cell of a bounded or unbounded lattice. Each site has a position in an E-dimensional space (E is called the embedding dimension). All sites in a given Sublat will be able to hold the same number of orbitals, and they can be thought of as identical atoms. Each Sublat in a Lattice can be given a unique name, by default :A, :B, etc.

  • Lattice: a collection of Sublats plus a collection of L Bravais vectors that define the periodicity of the lattice. A bounded lattice has L=0, and no Bravais vectors. A Lattice with L > 0 can be understood as a periodic (unbounded) collection of unit cells, each containing a set of sites, each of which belongs to a different sublattice.

  • SiteSelector: a rule that defines a subset of sites in a Lattice (not necessarily restricted to a single unit cell)

  • HopSelector: a rule that defines a subset of site pairs in a Lattice (not necessarily restricted to the same unit cell)

  • LatticeSlice: a finite subset of sites in a Lattice, defined by their cell index (an L-dimensional integer vector, usually denoted by n or cell) and their site index within the unit cell (an integer). A LatticeSlice an be constructed by combining a Lattice and a (bounded) SiteSelector.

  • AbstractModel: either a TightBindingModel or a ParametricModel

    • TightBindingModel: a set of HoppingTerms and OnsiteTerms
      • OnsiteTerm: a rule that, applied to a single site, produces a scalar or a (square) matrix that represents the intra-site Hamiltonian elements (single or multi-orbital)
      • HoppingTerm: a rule that, applied to a pair of sites, produces a scalar or a matrix that represents the inter-site Hamiltonian elements (single or multi-orbital)
    • ParametricModel: a set of ParametricOnsiteTerms and ParametricHoppingTerms
      • ParametricOnsiteTerm: an OnsiteTerm that depends on a set of free parameters that can be adjusted, and that may or may not have a default value
      • ParametricHoppingTerm: a HoppingTerm that depends on parameters, like ParametricOnsiteTerm above
  • AbstractHamiltonian: either a Hamiltonian or a ParametricHamiltonian

    • Hamiltonian: a Lattice combined with a TightBindingModel.

      It also includes a specification of the number of orbitals in each Sublat in the Lattice. A Hamiltonian represents a tight-binding Hamiltonian sharing the same periodicity as the Lattice (it is translationally invariant under Bravais vector shifts).

    • ParametricHamiltonian: like the above, but using a ParametricModel, which makes it dependent on a set of free parameters that can be efficiently adjusted.

    An h::AbstractHamiltonian can be used to produce a Bloch matrix h(ϕ; params...) of the same size as the number of orbitals per unit cell, where ϕ = [ϕᵢ...] are Bloch phases and params are values for the free parameters, if any.

  • Spectrum: the set of eigenpairs (eigenvalues and corresponding eigenvectors) of a Bloch matrix. It can be computed with a number of EigenSolvers.

  • Bandstructure: a collection of spectra, evaluated over a discrete mesh (typically a discretization of the Brillouin zone), that is connected to its mesh neighbors into a linearly-interpolated approximation of the AbstractHamiltonian's bandstructure.

  • SelfEnergy: an operator Σ(ω) defined to act on a LatticeSlice of an AbstractHamiltonian that depends on energy ω.

  • OpenHamiltonian: an AbstractHamiltonian combined with a set of SelfEnergies

  • GreenFunction: an OpenHamiltonian combined with a GreenSolver, which is an algorithm that can in general compute the retarded or advanced Green function at any energy between any subset of sites of the underlying lattice.

    • GreenSlice: a GreenFunction evaluated on a specific set of sites, but at an unspecified energy
    • GreenSolution: a GreenFunction evaluated at a specific energy, but on an unspecified set of sites
  • Observable: a physical observable that can be expressed in terms of a GreenFunction.

    Examples of supported observables include local density of states, current density, transmission probability, conductance and Josephson current

diff --git a/dev/tutorial/greenfunctions/index.html b/dev/tutorial/greenfunctions/index.html index d3fbfafc..0fe08335 100644 --- a/dev/tutorial/greenfunctions/index.html +++ b/dev/tutorial/greenfunctions/index.html @@ -98,4 +98,4 @@ julia> gx1 = sum(abs2, g(0.1)[siteselector(), 1], dims = 2); -julia> qplot(h, hide = :hops, sitecolor = (i, r) -> gx1[i], siteradius = (i, r) -> gx1[i], minmaxsiteradius = (0, 2), sitecolormap = :balance)Green function from a contact on the right
Caveat for multiorbital systems

Since, currently, g(ω)[sᵢ, sⱼ] yields a Matrix over orbitals (instead of over sites), the above example requires single-orbital sites to work. In the future we will probably introduce a way to slice a GreenSolution over sites, similar to the way diagonal works. For the moment, one can use observables like ldos for visualization (see next section), which are all site-based by default.

+julia> qplot(h, hide = :hops, sitecolor = (i, r) -> gx1[i], siteradius = (i, r) -> gx1[i], minmaxsiteradius = (0, 2), sitecolormap = :balance)Green function from a contact on the right
Caveat for multiorbital systems

Since, currently, g(ω)[sᵢ, sⱼ] yields a Matrix over orbitals (instead of over sites), the above example requires single-orbital sites to work. In the future we will probably introduce a way to slice a GreenSolution over sites, similar to the way diagonal works. For the moment, one can use observables like ldos for visualization (see next section), which are all site-based by default.

diff --git a/dev/tutorial/hamiltonians/index.html b/dev/tutorial/hamiltonians/index.html index 92bfd766..8bedd9ae 100644 --- a/dev/tutorial/hamiltonians/index.html +++ b/dev/tutorial/hamiltonians/index.html @@ -104,4 +104,4 @@ 0.0+0.0im ⋅ ⋅ ⋅ ⋅ 0.0+0.0im ⋅ ⋅ ⋅ ⋅ 0.0+0.0im ⋅ - ⋅ ⋅ ⋅ 0.0+0.0im

As a consequence, h and supercell(h) represent exactly the same system, with the same observables, but with a different choice of unitcell.

These two different behaviors make sense in different situations, so it is important to be aware of the order dependence of transformations. Similar considerations apply to transform, translate and wrap when models are position dependent.

+ ⋅ ⋅ ⋅ 0.0+0.0im

As a consequence, h and supercell(h) represent exactly the same system, with the same observables, but with a different choice of unitcell.

These two different behaviors make sense in different situations, so it is important to be aware of the order dependence of transformations. Similar considerations apply to transform, translate and wrap when models are position dependent.

diff --git a/dev/tutorial/lattices/index.html b/dev/tutorial/lattices/index.html index 614a4721..db5ace2f 100644 --- a/dev/tutorial/lattices/index.html +++ b/dev/tutorial/lattices/index.html @@ -109,4 +109,4 @@ [0.5, 1.0]

Currying: chaining transformations with the |> operator

Many functions in Quantica.jl have a "curried" version that allows them to be chained together using the pipe operator |>.

Definition of currying

The curried version of a function f(x1, x2...) is f´ = x1 -> f(x2...), so that the curried form of f(x1, x2...) is x2 |> f´(x2...), or f´(x2...)(x1). This gives the first argument x1 a privileged role. Users of object-oriented languages such as Python may find this use of the |> operator somewhat similar to the way the dot operator works there (i.e. x1.f(x2...)).

The last example above can then be written as

julia> LP.honeycomb(a0 = √3) |> transform(f) |> translate(δr) |> sites
 2-element Vector{SVector{2, Float64}}:
  [-0.5, 1.0]
- [0.5, 1.0]

This type of curried syntax is natural in Quantica, and will be used extensively in this tutorial.

+ [0.5, 1.0]

This type of curried syntax is natural in Quantica, and will be used extensively in this tutorial.

diff --git a/dev/tutorial/models/index.html b/dev/tutorial/models/index.html index b8f0c9ad..dbf18c3e 100644 --- a/dev/tutorial/models/index.html +++ b/dev/tutorial/models/index.html @@ -81,4 +81,4 @@ Cell distances : any Hopping range : Inf Reverse hops : false - Parameters : [:B]

The difference with model_perierls is that model_perierls! will never add any new hoppings. It will only modify previously existing hoppings in a model. Modifiers are not models themselves, and cannot be summed to other models. They are instead meant to be applied sequentially after applying a model.

In the next section we show how models and modifiers can be used in practice to construct Hamiltonians.

Mind the `;`

While syntax like onsite(2, sublats = :B) and onsite(2; sublats = :B) are equivalent in Julia, due to the way keyword arguments are parsed, the same is not true for macro calls like @onsite, @onsite!, @hopping and @hopping!. These macros just emulate the function call syntax. But to work you must currently always use the ; separator for keywords. Hence, something like @onsite((; p) -> p; sublats = :B) works, but @onsite((; p) -> p, sublats = :B) does not.

+ Parameters : [:B]

The difference with model_perierls is that model_perierls! will never add any new hoppings. It will only modify previously existing hoppings in a model. Modifiers are not models themselves, and cannot be summed to other models. They are instead meant to be applied sequentially after applying a model.

In the next section we show how models and modifiers can be used in practice to construct Hamiltonians.

Mind the `;`

While syntax like onsite(2, sublats = :B) and onsite(2; sublats = :B) are equivalent in Julia, due to the way keyword arguments are parsed, the same is not true for macro calls like @onsite, @onsite!, @hopping and @hopping!. These macros just emulate the function call syntax. But to work you must currently always use the ; separator for keywords. Hence, something like @onsite((; p) -> p; sublats = :B) works, but @onsite((; p) -> p, sublats = :B) does not.

diff --git a/dev/tutorial/observables/index.html b/dev/tutorial/observables/index.html index 9ffaaf18..1858c826 100644 --- a/dev/tutorial/observables/index.html +++ b/dev/tutorial/observables/index.html @@ -110,4 +110,4 @@ 0.03680096751905469 2.7677727119798235e-14 -julia> f = Figure(); a = Axis(f[1,1], xlabel = "φ", ylabel = "I [e/h]"); lines!(a, φs, Iφ); scatter!(a, φs, Iφ); fJosephson junction current-phase relation +julia> f = Figure(); a = Axis(f[1,1], xlabel = "φ", ylabel = "I [e/h]"); lines!(a, φs, Iφ); scatter!(a, φs, Iφ); fJosephson junction current-phase relation diff --git a/dev/tutorial/tutorial/index.html b/dev/tutorial/tutorial/index.html index 2eecd7cd..c6f1255a 100644 --- a/dev/tutorial/tutorial/index.html +++ b/dev/tutorial/tutorial/index.html @@ -1,2 +1,2 @@ -Welcome · Quantica.jl

Tutorial

Welcome to the Quantica.jl tutorial!

Here you will learn how to use Quantica.jl to build and compute properties of tight-binding models. This includes

  • Defining general Lattices in arbitrary dimensions
  • Defining generic tight-binding Models with arbitrary parameter dependences
  • Building Hamiltonians of mono- or multiorbital systems by combining Lattices and Models
  • Computing Bandstructures of Hamiltonians
  • Computing GreenFunctions of Hamiltonians or OpenHamiltonians (i.e. Hamiltonians with attached self-energies from other Hamiltonians, such as leads).
  • Computing Observables from Green functions, such as spectral densities, current densities, local and nonlocal conductances, Josephson currents, critical currents, transmission probabilities, etc.

Check the menu on the left for shortcuts to the relevant sections.

Check the docstrings

Full usage instructions on all Quantica.jl functions can be found here or within the Julia REPL by querying their docstrings. For example, to obtain details on the hamiltonian function or on the available LatticePresets, just type ?hamiltonian or ?LatticePresets.

+Welcome · Quantica.jl

Tutorial

Welcome to the Quantica.jl tutorial!

Here you will learn how to use Quantica.jl to build and compute properties of tight-binding models. This includes

  • Defining general Lattices in arbitrary dimensions
  • Defining generic tight-binding Models with arbitrary parameter dependences
  • Building Hamiltonians of mono- or multiorbital systems by combining Lattices and Models
  • Computing Bandstructures of Hamiltonians
  • Computing GreenFunctions of Hamiltonians or OpenHamiltonians (i.e. Hamiltonians with attached self-energies from other Hamiltonians, such as leads).
  • Computing Observables from Green functions, such as spectral densities, current densities, local and nonlocal conductances, Josephson currents, critical currents, transmission probabilities, etc.

Check the menu on the left for shortcuts to the relevant sections.

Check the docstrings

Full usage instructions on all Quantica.jl functions can be found here or within the Julia REPL by querying their docstrings. For example, to obtain details on the hamiltonian function or on the available LatticePresets, just type ?hamiltonian or ?LatticePresets.