Open emstoudenmire opened 2 years ago
Interesting, looks like somehow the density matrix ends up with a nonzero flux. We should probably actually print flux(A)
in that error message.
Yes and I think the bug could really be originating back with one of the MPS constructors
@emstoudenmire I'm trying to clear out some issues. Is this still an issue?
Appears to still be an issue, though the error message has changed. I checked that with the current version of everything that the inputs to apply
seem reasonable (i.e. it's not failing before that). Both the W
MPO in the example and the psi
MPS look to be valid and well-formed, unless there is something subtly wrong with one of them.
It's something I could look into as well. Anyway yes let's keep this open.
Description of bug
When applying certain MPOs to MPS, there is an error coming from
eigen
from within theapply(::MPO,::MPS)
function. It seems to only happen when:Looking into it some more, it could actually be a problem with randomMPS (and a similar problem occurring with productMPS), which is that the link indices seem to have the wrong quantum numbers in the case of making a product state. See below for the product state I made.
Minimal code demonstrating the bug or unexpected behavior
Actual output or behavior
Output of minimal runnable code
```julia ERROR: LoadError: AssertionError: flux(A) == QN() Stacktrace: [1] macro expansion @ ~/.julia/dev/ITensors/src/decomp.jl:229 [inlined] [2] macro expansion @ ~/.julia/dev/ITensors/src/global_variables.jl:177 [inlined] [3] eigen(A::ITensor, Linds::Vector{Index{Vector{Pair{QN, Int64}}}}, Rinds::Vector{Index{Vector{Pair{QN, Int64}}}}; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:ishermitian, :tags), Tuple{Bool, TagSet}}}) @ ITensors ~/.julia/dev/ITensors/src/decomp.jl:227 [4] contract(::ITensors.Algorithm{:densitymatrix}, A::MPO, ψ::MPS; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ ITensors ~/.julia/dev/ITensors/src/mps/mpo.jl:631 [5] contract @ ~/.julia/dev/ITensors/src/mps/mpo.jl:587 [inlined] [6] contract(A::MPO, ψ::MPS; alg::String, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ ITensors ~/.julia/dev/ITensors/src/mps/mpo.jl:531 [7] contract @ ~/.julia/dev/ITensors/src/mps/mpo.jl:516 [inlined] [8] #apply#922 @ ~/.julia/dev/ITensors/src/mps/mpo.jl:507 [inlined] [9] product(A::MPO, ψ::MPS) @ ITensors ~/.julia/dev/ITensors/src/mps/mpo.jl:507 [10] top-level scope @ ~/software/troubleshooting/miles/ampo_redesign/apply_bug.jl:14 [11] include(fname::String) @ Base.MainInclude ./client.jl:451 [12] top-level scope @ REPL[4]:1 in expression starting at /Users/mstoudenmire/software/troubleshooting/miles/ampo_redesign/apply_bug.jl:3 ```
Version information
versioninfo()
:Using latest development branch of ITensors.jl