Open muuusso opened 8 months ago
Thanks for the report. We are currently working on a rewrite of the projected MPO code, it should be easy to add support for this once that is done (we have a plan for a more general and flexible design than the current one).
@emstoudenmire this is a good use case to keep in mind for the new projected MPO code.
@mtfishman thanks, definitely helpful. I'm keeping a list of cases to cover and I'll add this one.
In the example page in the documentation it is reported that passing an MPO which is a sum of some MPOs as a vector to the
dmrg
function results in faster computation. For bigger system I found the speedup is non-negligible and I would like to use the same trick for excited states, but the implementation ofdmrg
for this particular case is missing.Minimal runnable code
```julia using ITensors N = 4 sites = siteinds("S=1/2", N) os_HA = OpSum() os_HA += 1, "Z", 1, "Z", 2 os_HA += 1, "Z", 3, "Z", 4 os_HA += -1, "Z", 1, "Z", 3 os_HA += -1, "Z", 2, "Z", 4 W = rand(N) os_HB = OpSum() for j in 1:N os_HB += W[j], "Z", j end HA = MPO(os_HA, sites) HB = MPO(os_HB, sites) psi0 = randomMPS(sites, 5) psi1 = randomMPS(sites, 5) E0, psi0 = dmrg([HA, HB], psi0, nsweeps=10, outputlevel=0) E1, psi1 = dmrg([HA, HB], [psi0], psi1, nsweeps=10) ```
The first
dmrg
call works as expected, while the second one gives the error reported below.Output of minimal runnable code
```julia MethodError: no method matching dmrg(::Vector{MPO}, ::Vector{MPS}, ::MPS, ::Sweeps) Closest candidates are: dmrg(::MPO, ::Vector{MPS}, ::MPS, ::Sweeps; weight, kwargs...) @ ITensors ~/.julia/packages/ITensors/MnaxI/src/mps/dmrg.jl:40 dmrg(::Any, ::Any, ::MPS; nsweeps, maxdim, mindim, cutoff, noise, kwargs...) @ ITensors ~/.julia/packages/ITensors/MnaxI/src/mps/dmrg.jl:365 dmrg(::Vector{MPO}, ::MPS, ::Sweeps; kwargs...) @ ITensors ~/.julia/packages/ITensors/MnaxI/src/mps/dmrg.jl:30 ... Stacktrace: [1] dmrg(x1::Vector{MPO}, x2::Vector{MPS}, psi0::MPS; nsweeps::Int64, maxdim::Int64, mindim::Int64, cutoff::Float64, noise::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ ITensors ~/.julia/packages/ITensors/MnaxI/src/mps/dmrg.jl:376 [2] top-level scope @ In[20]:26 ```
Version information
versioninfo()
:using Pkg; Pkg.status("ITensors")
: