ITensorInfiniteMPS.jl icon indicating copy to clipboard operation
ITensorInfiniteMPS.jl copied to clipboard

Add site-dependent QNs numbers

Open LHerviou opened this issue 3 years ago • 7 comments

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.

LHerviou avatar Feb 08 '22 17:02 LHerviou

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.

mtfishman avatar Feb 08 '22 18:02 mtfishman

That seems to fit exactly what I had in mind. I will start having a look at it.

LHerviou avatar Feb 08 '22 20:02 LHerviou

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

LHerviou avatar Feb 09 '22 18:02 LHerviou

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

mtfishman avatar Feb 10 '22 01:02 mtfishman

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.

LHerviou avatar Mar 01 '22 13:03 LHerviou

Amazing, thanks!

mtfishman avatar Mar 01 '22 13:03 mtfishman

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.

LHerviou avatar Apr 26 '22 16:04 LHerviou