ITensorInfiniteMPS.jl
ITensorInfiniteMPS.jl copied to clipboard
Add site-dependent QNs numbers
The final step I need for my FQHE code is to implement site-dependent QNs. I managed to make it work with a little bit of dirty code on ITensors for finite DMRG, so it should be also workable.
Now, it would be logical to implement this at the level of the CelledVectors. One possibility is to add a functional component to the structure (e.g. named QN_translation_operation) which would be called and applied on the QNs. To make the behavior transparent, I could make its default value "nothing", and add a few if lines in the code that only applies the function if it is assigned/not nothing.
What do you think of this solution?
A description of the implementation of the symmetry I need is given in the Supplemental Materials of https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.110.236801. Basically, if I note the shifted charge conservation C_n = q N_n - p (for site n at filling p/q), the local momentum operator is K_n = n C_n + s, where s is a constant shift that is fixed at the creation of the MPS. For a well chosen s, the transformation rules for all charge legs would be (c, k) -> (c, k + nsites(\psi) c) for all legs.
My ultimate plan has always been to make the CelledVector
type more general by defining it like this:
struct CelledVector{T,F} <: AbstractVector{T}
data::Vector{T}
translatecell::F
end
translatecell
would be a function of the form:
function my_translatecell_function(x::T, n)
# Function that translates an element of the unit cell by `n` cells
end
CelledVector(mps_tensors, my_translatecell_function)
Then, you can define any function you want, which could include both translating the cell tags and shifting the QNs for the case you outline above.
That seems to fit exactly what I had in mind. I will start having a look at it.
A prototype seems to be working.
I have a very stupid problem to benchmark my code. I am getting an error of the type
Overload of "op" or "op!" functions not found for operator name "N" and Index tags: "Fermions,Site,c=1,n=1")
I do not see where the overload was done for the spins
Looks like that error shows that you are using the site type "Fermions"
instead of "Fermion"
. This works:
julia> using ITensors
julia> s = siteind("Fermion")
(dim=2|id=199|"Fermion,Site")
julia> @show op("N", s);
op("N", s) = ITensor ord=2
Dim 1: (dim=2|id=199|"Fermion,Site")'
Dim 2: (dim=2|id=199|"Fermion,Site")
NDTensors.Dense{Float64, Vector{Float64}}
2×2
0.0 0.0
0.0 1.0
I was blind. Thanks for the fix, the generalized cellvectors are working.
I will make a PR once the current one is synchronized, probably also including a generalized subspace expansion I needed for my computations.
Amazing, thanks!
A quick comment: some default functions for translatecells are not implemented apparently (a colleague was struggling) => probably a consequence of the name change. I will try to make a PR for that tomorrow at the latest.