pablosanjose / Quantica.jl

Simulation of quantum systems on a lattice
Other
69 stars 8 forks source link

Allow construction of Hamiltonian by providing Harmonics #233

Open BacAmorim opened 9 months ago

BacAmorim commented 9 months ago

It would be useful to expose the creation of Hamiltonians / general operators by directly providing the matrices of the harmonics.

The interface could be the following:

h = hamiltonian(lat, 
[
((0), h0), 
((1), h1), 
((-1), h2)
]
)

Would create a Quantica Hamiltonian with 3 harmonics, where h0, h1 and h2 are matrices. This approach could be used to create Quantica Hamiltonians from a Wannier90 calculation, with the Harmonics being read using WannierIO.jl See also Wannier90 interface #4

pablosanjose commented 9 months ago

This can totally be done, and it is quite trivial, since we have HybridSparseMatrix(b::OrbitalBlockStructure{B}, flat::SparseMatrixCSC{Complex{T},Int}) constructors that can convert the flat input matrices to the required hybrid matrices.

I would probably make the second argument a Dict, though, like Dict(SA[0] => h0, SA[1] => h1,...).

Regardless of this functionality, that would be good to have, the Wannier90 problem could alternatively/additionally use an approach of the type @hopping([s´, s] -> wannier90((s´.dn, s´.i), (s.dn, s.i)), as described in #229, to import Wannier90 files, where wannier90::Wannier90 would be an object created from a Wannier90 output file, so we don't need to build the Dict as an intermediate object.

pablosanjose commented 5 months ago

With #229 and #264 now merged, I'm wondering if we still need this. @BacAmorim, could you make an argument for the usecase?