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

Subtle error message for symmetry broken unitcell

Open ryanlevy opened this issue 2 months ago • 0 comments

[From the forum here ] The following OpSum appears to break the code due to a single Op not being wrapped into a sum

function ITensorInfiniteMPS.unit_cell_terms(::Model"bad")
    opsum = OpSum()
    opsum += 0.5, "Z",1
    opsum += 0.4, "Z",2 # the problem
    opsum += -1, "X",1,"X",2
    return opsum
end

initstate(n) = isodd(n) ? "Up" : "Dn"
s = infsiteinds("S=1/2", N;  conserve_qns = false, initstate)
model = Model("bad")
# Form the Hamiltonian
H = InfiniteSum{MPO}(model, s;)

with the error MethodError: no method matching translatecell(::ITensorInfiniteMPS.var”#_shift_cell#176"{Int64}, ::Scaled{ComplexF64, Prod{Op}}, ::Int64) "

What's happening is that there's only one term in the second "translate" term

 julia> _infinite_terms = ITensorInfiniteMPS.infinite_terms(model)
 sum(
  0.5 Z(1,)
  -1.0 X(1,) X(2,)
)
 0.4 Z(2,)

For this to be a legal unit cell, I'd expect the user to include"X",2,"X",3 (otherwise its a trivial uniform product state I suppose). Not sure if its possible to catch this and write a more helpful message, etc

ryanlevy avatar Apr 26 '24 20:04 ryanlevy