# DOS and LDOS using Quantica

Hello @pablosanjose , looking through the Quantica documentation, I could only see how to find the LDOS at a fixed energy at all sites in the lattice.

Is there a way to get the LDOS at a fixed position for a range of energies?

And is there a way to calculate the total DOS of the lattice for different energies?

Thanks.

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.