# Spectrum of open hamiltonian in Quantica

**URL:** <https://discourse.julialang.org/t/spectrum-of-open-hamiltonian-in-quantica/113731>\
**Category:** Quantum\
**Created:** [May 2, 2024, 11:43am UTC](https://discourse.julialang.org/t/spectrum-of-open-hamiltonian-in-quantica/113731 "2024-05-02T11:43:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Milt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milt/32/205510_2.png) [@Milt](https://discourse.julialang.org/u/Milt)\
**Post date:** [May 2, 2024, 11:43am UTC](https://discourse.julialang.org/t/spectrum-of-open-hamiltonian-in-quantica/113731/1 "2024-05-02T11:43:51Z")

</div>

Hi @pablosanjose ,

I am trying to evaluate the spectrum for a graphene ribbon of varying widths. I am trying to do this by attaching leads to graphene resulting in an open hamiltonian but this is not compatible with the spectrum method.

```julia
glead = LP.honeycomb() |> onsite(4) - hopping(1) |> supercell(4,2) |> supercell((0,-1))|> greenfunction(GS.Schur(boundary = 0));

h = LP.honeycomb() |> onsite(4) - hopping(1) |> supercell(4,5) |> supercell |> 
attach(glead, region = r -> SA[-√3/2,1/2]' * r > 3.5, reverse = true) |>
attach(glead, region = r -> SA[-√3/2,1/2]' * r < 0, reverse = false)

 energies, phis = spectrum(h, point; solver=ES.ShiftInvert(ES.ArnoldiMethod(nev=28), 0.0))

```

Is there a way to obtain the spectrum for a ribbon?

Many thanks

---

<div class="post-metadata">

**Author:** ![pablosanjose](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pablosanjose/32/7006_2.png) [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Post date:** [May 2, 2024, 3:51pm UTC](https://discourse.julialang.org/t/spectrum-of-open-hamiltonian-in-quantica/113731/2 "2024-05-02T15:51:42Z")

</div>

Hello @Milt !

There might be a slight conceptual problem here. Open systems don’t have, in general, a discrete eigenspectrum. In a way it has “infinite” number of eigenpairs, so it’s natural `spectrum` does not apply here. If the system is open but periodic (it has nothing `attach`-ed, you can compute its `bands` instead of the `spectrum`. In the case you describe, the appropriate equivalent is the local density of sates, or `ldos`.

This would be the ldos integrated over all your central region as a function of energy

```julia
julia> using GLMakie, Quantica

julia> glead = LP.honeycomb() |> onsite(4) - hopping(1) |> supercell(4,2) |> supercell((0,-1))|> greenfunction(GS.Schur(boundary = 0));

julia> g = LP.honeycomb() |> onsite(4) - hopping(1) |> supercell(4,5) |> supercell |>
       attach(glead, region = r -> SA[-√3/2,1/2]' * r > 3.5, reverse = true) |>
       attach(glead, region = r -> SA[-√3/2,1/2]' * r < 0, reverse = false) |> greenfunction;

julia> d = ldos(g[])
LocalSpectralDensitySlice{Float64} : local density of states at a fixed location and arbitrary energy
  kernel : LinearAlgebra.UniformScaling{Bool}(true)

julia> ωs = subdiv(0, 8, 500); ds = [sum(d(ω)) for ω in ωs];

julia> lines(ωs, ds)

```

 ![Screenshot 2024-05-02 at 17.50.51](https://global.discourse-cdn.com/julialang/original/3X/f/a/fa560c4b5227b5cbeb55e08c7579dd420904a148.png)

Note that the ldos is continuous, i.e. it is not a series of discrete eigenenergies, but a continuous _density_ of eigenenergies
