Closed pablosanjose closed 1 year ago
Given the fact that ScatteringSystem
is essentially the same as EffectiveHamiltonian
, it would be possible to drop the former by storing open
sites in the latter in groups from the start.
struct EffectiveHamiltonian{T,E,B,S<:AbstractAppliedGreenSolver} <: AbstractHamiltonian{T,E,0,B}
h::ParametricHamiltonian{T,E,0,B}
solver::S
open::Vector{Vector{Int}}
external::Vector{Int}
end
Whenever we couple two effective Hamiltonians we could just keep their open sites (and external sites) in different groups. The we would just do
conductance(heff, i, j, ω; params...)
smatrix(heff, i, j, ω; params...)
We could also introduce some way to redefine contacts by regrouping open sites into different groups. I can think of one use case. If you integrate out a collection of sites in an heff
with heff
with effective(heff; siteselectors...)
, the result will loose its open site grouping. Then you would need to do something like
contacts!(heff, ss::Selectors...)
to regroup them. This should check that no open site is repeated or left out.
An important observation that came up while implementing Coupler
. When coupling two AbstractHamiltonian
s, sublattices with the same names are not merged, but renamed and kept separate. Doing the opposite introduces a surprising degree of complexity in two fronts: (1) the resulting Hamiltonian matrices do not have a block structure, so coupling blocks with c[1,2] = model
implies keeping track of disjoint index ranges in the matrix in general; and (2) when updating the modifier pointers to the coupled Hamiltonian sparse matrices, the code becomes gnarly.
For this reason, we defer to a future PR the functionality of merging sublattices, including the corresponding update to modifier pointers in a ParametricHamiltonian. We reserve the name Base.merge(lattices...)
for that, and adopt combine(lattices...)
for the present functionality.
EDIT: Removed due to revision
(Now implemented in the greens
branch, to be soon merged into greatrefactor
)
coupler
approach. Instead we recover tree-like connection of subsystems without the possibility of loops via a syntax h |> attach(args...; site_selection...)
, where args
can be different thingsattach
-ing something to an AbstractHamiltonian
creates an OpenHamiltonian
which wraps one or more SelfEnergy
. One can attach
several systems to the OpenHamiltonian, each time adding a SelfEnergy
to itSelfEnergy
wraps a latslice::LatticeSlice
(portion of h
's lattice selected by site_selection
, can span one or more unit cells) and a solver::SelfEnergySolver
, which produces an Σ::AbstractMatrix
over the orbitals in latslice
when we do call!(solver, ω; params...)
. call!(solver, ω; params...)
can also produce three AbstractMatrix
, Vᵣₑ, gₑₑ⁻¹, Vₑᵣ
when solver
is an ExtendedSelfEnergySolver
instead of a RegularSelfEnergySolver
, so that Σ = Vᵣₑ gₑₑ Vₑᵣ
.GreenFunction
with g = greenfunction(o::OpenHamiltonian, GS.SomeGreenSolver(options...))
, or g = o |> greenfunction(GS.SomeGreenSolver(options...))
o
, without knowing the point or the energygω = g(ω; params...)
, which produces a gω::GreenSolution
, that wraps, in particular, a GreenSlicer
that will produce a flat matrix when we pass the points.gω[(; site_selection...), (; site_selection´...)]
or gω[cellsites(cell, sites), cellsites(cell´, sites´)]
or gω[contact(i), contact(j)]
produces the final matrix at energy ω
and the selected points. contact(i)
denotes all sites selected when we attach
ed the i-th self-energy to o
The above machinery relies on a number of new types, such as Contacts
or ContactBlockStructure
that are invisible to the user.
The possible syntaxes for attach
will be expanded as we go. For the moment we have attach(h, model; ...)
to define a selfenergy through a model (like we define a Hamiltonian), and attach(h, glead; ...)
to attach a 1D lead with Green function glead
. We will also add attach(h, glead, model;...)
to use a specific coupling between lead and h
, and in general attach(h, g;...)
for an arbitrary g::GreenFunction
. GreenFunction solvers live in the GreenSolvers === GS
submodule. For the moment we have GS.Schur
for 1D systems and GS.SparseLU
for 0D systems.
Closes #1, #2
This is a concrete design of scattering systems and Green functions that combines ideas from #1 and #2, and then some. There are still some implementation details to clarify that could affect some parts of the proposal.
Problems
The basic problems to solve are:
GreenFunction
: Compute Green's function (dense) matrices, or derived quantities such as spectral functions, within a given unit cell of any finite or unbounded AbstractHamiltonians.EffectiveHamiltonian
: Allow to compute effective, frequency dependent (sparse) AbstractHamiltonians that incorporate the effect of coupling to other infinite/finite system through open boundaries (i.e. through self-energies or ). Case on point: effective Hamiltonian for the first cell of a semi-infinite lead.GreenFunction
between arbitrary sites in anyEffectiveHamiltonian
API
As suggested by the list of problems to solve, the whole API revolves around two core types:
GreenFunction
andEffectiveHamiltonian <: AbstractHamiltonian
. Given anh::AbstractHamiltonian{B}
(possibly aParametricHamiltonian
) we build each of these over a set of sites and cells, and in the presence of certain boundaries, withsolver
is aGreenSolvers.AbstractSolver
, one of several possible, each with their own kwargs.gω = g(ω; params...)
is then the Green function matrixgω::Matrix{B}
at frequencyω
.hω = heff(ω; params...)
is a 0-dimensionalhω::Hamiltonian
, andhω[]
itsSparseMatrixCSC{B}
.Note:
EffectiveHamiltonian
is essentially aParametricHamiltonian
under the hood (with an extra compulsoryω
parameter). It must therefore remain possible to parametrically modify one withOpen and external sites
Both
g
andh
have an underlying 0-dimensionalLattice
on which the matrices are defined. We do not consider (in this proposal) any periodicGreenFunction
s orEffectiveHamiltonian
s. In this lattice there are two subsets of special sites:open
sites (coupled to the environment) and, optionally,external
sites (which represent the environment). The latter can be absent, depending on what thesolver
provides, in which case the environment has been fully integrated out, inducing a self-energy onopen
sites.Only
EffectiveHamiltonian
's can haveexternal
sites; they are always integrated out inGreenFunctions
. Ifhω
has noexternal
sites, then the following holdsOtherwise, the matrix
hω[]
will be larger thangω
.The purpose of keeping
external
sites as part of theEffectiveHamiltonian
is that it can be numerically more stable to compute(ω-hω[]) \ sources
with them included inhω
than to first integrate them out and then do theldiv
.The
GreenFunction
of a givenEffectiveHamiltonian
is obtained withgreen(heff)(ω; params...)
is guaranteed to be equal togω
within numerical precision.Open sites are obtained with
The self-energy of the environment on said sites is computed with
Note that this matrix will be square and of size equal to the number of open sites (
external
sites are again integrated out).Solvers
Solvers for
green
andeffective
are subtypes ofAbstractGreenSolver
, and are all bundled in the submoduleGreenSolvers
, aliased asGS
. Two solvers are currently envisionedTo make use of them, these need to be applied first to an
h::AbstractHamiltonian
withwhich yields an
AbstractAppliedGreenSolver
.The internal API of an
AbstractAppliedGreenSolver
is the followingThe functionality of other methods in the external API rely on these internal ones.
Integrating out sites
Apart from the option to select sites of interest upon constructing a
GreenFunction
or anEffectiveHamiltonian
as above, we also have the option to integrate out a subset of sites after construction. This is done withThese work by bundling the internal
solver
ofg
orheff
into a special type of solver that selects a view of the originalsolver
,Note that
GreenView
also needs to know which sites are open after projecting out, namely any site that was originally open or that was coupled to a site that is not included inindices
.Coupling systems
We need a general way to couple a number of
EffectiveHamiltonian
s into anotherEffectiveHamiltonian
, e.g. to be able to define arbitraryScatteringSystem
for transport (where the leads are all instances ofEffectiveHamiltonians
), or to compute local density of states composite unbounded systems. To this end we need to generalize thecouple
functionality in master.The coupling API will now rely on a
Coupler
object with the following APIThe
setindex!
method applieshopping_model
to a given pair ofhs
, populating the corresponding blocks in the final Hamiltonian harmonics upon finalizing the coupler.Note that one can succintly apply an all-to-all coupling model using broadcasting
Note: Any coupled pair should be "compatible", which essentially means both
h
should have the same Bravais vectors (up to ±1 factors).Scattering systems
A Scattering system is little more than an
EffectiveHamiltonian
, where we group differentopen
sites into a number ofcontacts
. We build one simply withwhere the
ss
select the different contact sites among open sites.A
ScatteringSystem
supports additional methods to compute the conductance and scattering matrix between contactsi
andj
Implementation
A possible sketch of core types:
The
Coupler
type can perhaps be restructured to allow for more efficient coupling insertions. For example, instead of building a whole coupling Hamiltonian when applying a givenhopping_model
, one could start by decomposing and merging all the non-zero elements of the differenths
harmonics (withfindnz
), and then appending to that list the ones from each of the couplings when finalizing.