pablosanjose / Quantica.jl

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

Redefine the onsiteselectors and hoppingselectors of a TightbindingModel #15

Closed fernandopenaranda closed 4 years ago

fernandopenaranda commented 4 years ago

I wonder whether the capability to redefine the onsiteselectors and hoppingselectors of a given Tightbindingmodel made out of several hopping and onsite terms could be useful or not. I was thinking about a new function: modifierfunc!(model, region = ...) where model = onsite_1 + ... + onsite_N+ hopping_1 + ... +hopping_M and onsite_x (hopping_x) are arbitrary onsite(hopping) terms. This new functionality would enable us to initially write region-independent TBmodels. This may reduce the code complexity when building: a complex heterostructure or different heterostructures out of the same model, since the model is created only once. For instance, if we want to build the hamiltonians corresponding to two SNS junctions (1 and 2) with different geometries using the same model for the normal(N) and superconducting (S) regions, we could simply do:

hamSNS1 = hamiltonian(lat1, modifierfunc!(modelN,region=(r,dr)->regionN1) + modifierfunc!(modelS,regionS1))
hamSNS2 = hamiltonian(lat2, modifierfunc!(modelN,region=(r,dr)->regionN2) + modifierfunc!(modelS,regionS2))
pablosanjose commented 4 years ago

I think this could be a nice addition.

Since the Selectors for hoppings and onsites are different, we would need a slight variation of this. The natural API would be

onsiteselector!(model; kw...)
hoppingselector!(model; kw...)

Both would produce a new model with kws applied to the onsiteselector/hoppingselector in each term of model, respectively. The possible kw would include not only region but also dn, sublats, etc, as applicable. Only specified kws would be overwritten, the rest would be preserved (a merge of selectors, in a way)

fernandopenaranda commented 4 years ago

Generalising this functionality to the rest of availablekws sounds great to me!