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

[ITensors] [BUG] Sum of MPOs in DMRG for excited states doesn't work #1289

Open
muuusso opened this issue Dec 16, 2023 · 2 comments
Open

[ITensors] [BUG] Sum of MPOs in DMRG for excited states doesn't work #1289

muuusso opened this issue Dec 16, 2023 · 2 comments
Labels
bug Something isn't working ITensorMPS Issues related to the ITensorMPS submodule mps Issues related to MPS/MPO functionality

Comments

@muuusso
Copy link

muuusso commented Dec 16, 2023

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 of dmrg for this particular case is missing.

Minimal runnable code

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

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

  • Output from versioninfo():
julia> versioninfo()
Julia Version 1.9.4
Commit 8e5136fa297 (2023-11-14 08:46 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10 × Apple M1 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 8 on 8 virtual cores
Environment:
  JULIA_NUM_THREADS = 8
  • Output from using Pkg; Pkg.status("ITensors"):
julia> using Pkg; Pkg.status("ITensors")
Status `~/.julia/environments/v1.9/Project.toml`
  [9136182c] ITensors v0.3.52
@muuusso muuusso added bug Something isn't working ITensors Issues or pull requests related to the `ITensors` package. labels Dec 16, 2023
@mtfishman
Copy link
Member

mtfishman commented Feb 16, 2024

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.

@emstoudenmire
Copy link
Collaborator

@mtfishman thanks, definitely helpful. I'm keeping a list of cases to cover and I'll add this one.

@mtfishman mtfishman added mps Issues related to MPS/MPO functionality ITensorMPS Issues related to the ITensorMPS submodule and removed ITensors Issues or pull requests related to the `ITensors` package. labels May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ITensorMPS Issues related to the ITensorMPS submodule mps Issues related to MPS/MPO functionality
Projects
None yet
Development

No branches or pull requests

3 participants