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

VegaLite support for non-periodic fields #152

Merged
merged 13 commits into from
Jan 22, 2021
Merged

VegaLite support for non-periodic fields #152

merged 13 commits into from
Jan 22, 2021

Conversation

pablosanjose
Copy link
Owner

@pablosanjose pablosanjose commented Jan 15, 2021

Closes #151

This implements the proposal in #151, on top of the PR #150. Together, these allow to plot Greens functions and other fields on unbounded lattices.

As an example we plot the (square of the) local density of states at ω = 0.01 of a semi-infinite (x>0) zigzag graphene nanoribbon, which is not uniform since the boundary creates a standing wave close to the two zigzag edges.

julia> using VegaLite, ProgressMeter, LinearAlgebra, Quantica

julia> h = LatticePresets.honeycomb() |> hamiltonian(hopping(1)) |> unitcell((1,-1),(30,30)) |> unitcell((1,0))
Hamiltonian{<:Lattice} : Hamiltonian on a 1D Lattice in 2D space
  Bloch harmonics  : 3 (SparseMatrixCSC, sparse)
  Harmonic size    : 120 × 120
  Orbitals         : ((:a,), (:a,))
  Element type     : scalar (ComplexF64)
  Onsites          : 0
  Hoppings         : 358
  Coordination     : 2.9833333333333334

julia> g = greens(h, SingleShot1D(), boundaries = (0,))
GreensFunction{SingleShot1DGreensSolver}: Green's function using the single-shot 1D method
  Matrix size    : 120 × 120
  Element type   : scalar (ComplexF64)
  Boundaries     : (0,)
  Reduced dims   : 60

julia> g0 = g(0.01, missing)
#391 (generic function with 1 method)

julia> ldos = @showprogress [(n,) => -imag.(diag(g0(n=>n))) for n in 1:200];
Progress: 100%|████████████████████████████████████| Time: 0:00:00

julia> vlplot(h, ldos, sitecolor = ldos -> ldos^2, sitesize = ldos -> ldos^2, maxdiameter = 10, mindiameter = 2, plotlinks = false)

Screen Shot 2021-01-15 at 21 16 25

Note that the cost of extending the plot to longer portions of the nanoribbon is negligible, as the 1D Greens function using the single-shot method in #150 makes this essentially free. The real bottleneck for very long nanoribbons is plotting through VegaLite

wip
nonsquare phiR problem

seems to work

refactor

more refactor

fix

almost, but formally clunky

works away from true bound states

split off devdocs

cleanup

removed omega0 heuristics

change cell default

cleanup

show method

more show

fix test
@pablosanjose pablosanjose force-pushed the vlplotcells branch 2 times, most recently from 353cfef to be1df16 Compare January 15, 2021 20:51
@codecov-io
Copy link

codecov-io commented Jan 16, 2021

Codecov Report

Merging #152 (07356a1) into master (83ea296) will decrease coverage by 4.14%.
The diff coverage is 15.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #152      +/-   ##
==========================================
- Coverage   66.92%   62.78%   -4.15%     
==========================================
  Files          16       16              
  Lines        3232     3450     +218     
==========================================
+ Hits         2163     2166       +3     
- Misses       1069     1284     +215     
Impacted Files Coverage Δ
src/Quantica.jl 100.00% <ø> (ø)
src/greens.jl 0.00% <0.00%> (ø)
src/plot_vegalite.jl 0.00% <0.00%> (ø)
src/tools.jl 50.69% <50.00%> (-0.24%) ⬇️
src/hamiltonian.jl 85.73% <94.28%> (-0.18%) ⬇️
src/bandstructure.jl 86.14% <100.00%> (ø)
src/diagonalizer.jl 63.01% <100.00%> (+0.51%) ⬆️
src/iterators.jl 73.22% <100.00%> (ø)

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 83ea296...07356a1. Read the comment docs.

@pablosanjose pablosanjose merged commit b9e66cb into master Jan 22, 2021
@pablosanjose pablosanjose deleted the vlplotcells branch January 22, 2021 19:36
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.

Visualize local density of states in semi-infinite systems
2 participants