Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexing into a Bandstructure to get interpolated eigenpairs #134

Merged
merged 5 commits into from
Nov 13, 2020

Conversation

pablosanjose
Copy link
Owner

@pablosanjose pablosanjose commented Nov 13, 2020

Closes #120

This implements getindex methods for bs::Bandstructure, such as bs[(ϕs...), around = 0.0] that obtains interpolated eigenenergies and eigenvectors at base mesh coordinates ϕs.

julia> h = LatticePresets.honeycomb() |> hamiltonian(hopping(1)) |> unitcell(2);

julia> bs = bandstructure(h, subticks = 13);

julia> s = bs[(1.0, 2.0), around = (0.0, 2)]
2-element view(::Array{Subspace{Complex{Float64},Float64,Array{Complex{Float64},2}},1}, 1:2) with eltype Subspace{Complex{Float64},Float64,Array{Complex{Float64},2}}:
 Subspace{Complex{Float64},Float64}: eigenenergy subspace
  Energy       : -0.7562363086283448
  Degeneracy   : 1
 Subspace{Complex{Float64},Float64}: eigenenergy subspace
  Energy       : 0.7562363086283459
  Degeneracy   : 1

EDIT: as explained in the bandstructure docstring, to obtain a specific eigenstate/eigenenergy from s above, one can use destructuring ϵ, ψ = s[1] or ψ = s[2].basis, ϵ = s[2].energy.

The access and interpolation strategy has been reworked to be of O(1) complexity. The performance as compared with diagonalization makes it worthwhile even for small systems. The PR also includes an enhancement to Diagonalizers, now embedded into bandstructures, that allows re-diagonalizing at any given ϕs using the unexported interface bs.diag((ϕs...)). This is handy for comparisons with the interpolation machinery, and will be crucial to enable bandstructure refinement in the near future.

There is a catch, however. This PR includes a broken test where bs[(ϕs...)] returns a number of eigenpairs larger than the dimension of the Hamiltonian. The reason is a deep problem of the algorithm introduced in #123, and discovered when deving this PR. #123 follows a band-building strategy whereby the adjacency matrix of band meshes is computed first (based on degenerate subspace overlaps), and then simplices are built from the adjacency matrix in a second step. The first step is fully correct. However, there exist band topologies around high-symmetry points for which not all possible simplices compatible with the adjacency matrix are valid simplices. Since we cannot currently detect these, we can end up with a few simplices too many, which produces the broken test.

Fixing the broken test is going to require some serious work, so I release this PR first, and will try to address the problem later.

spectrum indexing

fix around

prealloc in spectrum

WIP bandstructure indexing

wip interpolate_bandstructure
@codecov-io
Copy link

codecov-io commented Nov 13, 2020

Codecov Report

Merging #134 (72042ce) into master (762fd5e) will increase coverage by 0.61%.
The diff coverage is 68.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #134      +/-   ##
==========================================
+ Coverage   59.99%   60.60%   +0.61%     
==========================================
  Files          16       16              
  Lines        2807     2922     +115     
==========================================
+ Hits         1684     1771      +87     
- Misses       1123     1151      +28     
Impacted Files Coverage Δ
src/Quantica.jl 100.00% <ø> (ø)
src/greens.jl 0.00% <0.00%> (ø)
src/plot_makie.jl 0.00% <0.00%> (ø)
src/plot_vegalite.jl 0.00% <0.00%> (ø)
src/bandstructure.jl 81.93% <66.66%> (-4.46%) ⬇️
src/diagonalizer.jl 52.17% <100.00%> (+2.17%) ⬆️
src/lattice.jl 81.81% <100.00%> (ø)
src/presets.jl 36.84% <100.00%> (+4.76%) ⬆️
src/tools.jl 37.00% <100.00%> (+1.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9c7c51...72042ce. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eigenpair accessors
2 participants