Is there any packages that already implement KPM?
We have GitHub - pablosanjose/Elsa.jl: Efficient lattice simulation algorithms - a Julia library
Still in development but has KPM built in.
I would actually appreciate it if you take it for a spin and report issues.
your package seems really good!, I will try it soon.
Please do. For the moment I’m afraid you’ll have to make do with the docstrings, as we haven’t had time to write a narrative documentation. To get you started, you could compute the density of states of a simple graphene monolayer (circular flake of radius 300a0) using stochastic traces with something like
julia> using Elsa, FFTW, Plots
julia> h = LatticePresets.honeycomb() |> hamiltonian(hopping(1, range = 1/√3)) |> unitcell(region = RegionPresets.circle(300))
Hamiltonian{<:Lattice} : Hamiltonian on a 0D Lattice in 2D space
Bloch harmonics : 1 (SparseMatrixCSC, sparse)
Harmonic size : 652966 × 652966
Orbitals : ((:a,), (:a,))
Element type : scalar (Complex{Float64})
Onsites : 0
Hoppings : 1956506
Coordination : 2.9963367158473795
julia> dos = dosKPM(h, order = 1000, bandrange = (-3,3), randomkets = 1);
julia> plot(dos)
EDIT: to reduce noise, increase system size or randomkets
. Also, if you use MKLSparse.jl you will get a nice performance boost on Intel machines, thanks to hyperthreaded sparse mul!
, at least for single-orbital hamiltonians (scalar eltype).