Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report a bug of ITensorMPOConstruction #19

Closed
mankai-chow opened this issue May 28, 2024 · 1 comment · Fixed by #20
Closed

Report a bug of ITensorMPOConstruction #19

mankai-chow opened this issue May 28, 2024 · 1 comment · Fixed by #20

Comments

@mankai-chow
Copy link

I encounter the following error message when using ITensorMPOConstruction.

ERROR: LoadError: MethodError: no method matching set_scalar!(::OpIDSum{ComplexF64}, ::Int64, ::Float64)

Closest candidates are:
  set_scalar!(::OpIDSum{C}, ::Integer, ::C) where C
   @ ITensorMPOConstruction ~/.julia/packages/ITensorMPOConstruction/VZH0Q/src/OpIDSum.jl:84

Stacktrace:
 [1] macro expansion
   @ ~/.julia/packages/ITensorMPOConstruction/VZH0Q/src/OpIDSum.jl:158 [inlined]
 [2] merge_terms!(os::OpIDSum{ComplexF64})
   @ ITensorMPOConstruction ~/.julia/packages/TimerOutputs/Lw5SP/src/TimerOutput.jl:237
 [3] macro expansion
   @ ~/.julia/packages/ITensorMPOConstruction/VZH0Q/src/OpIDSum.jl:309 [inlined]
 [4] prepare_opID_sum!(os::OpIDSum{ComplexF64}, sites::Vector{Index{Int64}}, opCacheVec::Vector{Vector{OpInfo}}, basisOpCacheVec::Vector{Vector{OpInfo}})
   @ ITensorMPOConstruction ~/.julia/packages/TimerOutputs/Lw5SP/src/TimerOutput.jl:237
 [5] MPO_new(ValType::Type{Float64}, os::OpIDSum{ComplexF64}, sites::Vector{Index{Int64}}, opCacheVec::Vector{Vector{OpInfo}}; basisOpCacheVec::Vector{Vector{OpInfo}}, tol::Int64)
   @ ITensorMPOConstruction ~/.julia/packages/ITensorMPOConstruction/VZH0Q/src/MPOConstruction.jl:255
 [6] MPO_new
   @ ~/.julia/packages/ITensorMPOConstruction/VZH0Q/src/MPOConstruction.jl:245 [inlined]
 [7] MPO_new(os::OpIDSum{ComplexF64}, sites::Vector{Index{Int64}}, opCacheVec::Vector{Vector{OpInfo}}; basisOpCacheVec::Vector{Vector{OpInfo}}, tol::Int64)
   @ ITensorMPOConstruction ~/.julia/packages/ITensorMPOConstruction/VZH0Q/src/MPOConstruction.jl:264
 [8] MPO_new(os::Sum{Scaled{ComplexF64, Prod{Op}}}, sites::Vector{Index{Int64}}; basisOpCacheVec::Vector{Vector{OpInfo}}, tol::Int64)
   @ ITensorMPOConstruction ~/.julia/packages/ITensorMPOConstruction/VZH0Q/src/MPOConstruction.jl:284
 [9] top-level scope

The minimal example I have is

using ITensors
using ITensorMPOConstruction
os = OpSum()
os += "Cdag", 2, "C", 2, "Cdag", 1, "C", 1
os += "Cdag", 1, "C", 1, "Cdag", 2, "C", 2
sites = siteinds("Fermion", 2)
operatorNames = [ "I", "C", "Cdag", "N" ]
opCacheVec = [ [OpInfo(ITensors.Op(name, n), sites[n]) for name in operatorNames] for n in eachindex(sites)  ]
mpo = MPO_new(os, sites ; basisOpCacheVec = opCacheVec)

The error would not occur if either of the two terms were removed.

@corbett5
Copy link
Collaborator

Sorry for the delay, I was on vacation. Once #20 is merged it should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants