Hello Alex,
yes, you need to pass a GreenSlice to ldos
, like this:
First build your Hamiltonian and GreenFunction. I’ll use the one in the ldos
documentation
h = LP.square() |> onsite(4) - hopping(1) |> supercell(region = r -> norm(r) < 40*(1+0.2*cos(5*atan(r[2],r[1]))));
g = h|> greenfunction;
Then you select the sites you want (see siteselector
), creating a GreenSlice
julia> gs = g[region = r->norm(r) < 2]
GreenSlice{Float64,2,0}: Green function at arbitrary energy, but at a fixed lattice positions
Then you pass that to ldos
julia> ρ = ldos(gs)
LocalSpectralDensitySlice{Float64} : local density of states at a fixed location and arbitrary energy
kernel : LinearAlgebra.UniformScaling{Bool}(true)
Finally, you choose your energies
julia> ρ(0.2)
9-element Vector{Float64}:
2.2297735490934158e-6
2.436670202919316e-6
2.229773549066893e-6
2.974103757821811e-6
3.2313768522869836e-6
2.974103757803625e-6
3.194724428617991e-6
3.463660881255997e-6
3.194724428575867e-6
One value for each orbital (unless you use kernel
, see the ldos
docstring).
In the near future (very soon), you will be able to use siteselectors also on this result.
If your GreenSolver allows for cheap evaluation of different energies (like GS.KPM
) the latter should be fast. Here, we have used the default GS.SparseLU
, which needs to do an ldiv!
for each energy, but it is exact.