Skip to content

Subtle error message for symmetry broken unitcell #82

@ryanlevy

Description

@ryanlevy

[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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions