Difference between MPO() and OpSum()

Hello,

Lately I’ve been trying to understand the ITensorInfiniteMPS package. For example, the one given here on Heisenberg model. I have the following questions:

  1. What do \psi.AL and \psi.C mean in the code?

  2. In the code for models, for example Ising model, we have the following:

    function ITensors.MPO(::Model"ising", s; J, h)
    N = length(s)
    a = OpSum()
    for n in 1:(N - 1)
    a .+= -J, “X”, n, “X”, n + 1
    end
    for n in 1:N
    a .+= -h, “Z”, n
    end
    return splitblocks(linkinds, MPO(a, s))
    end

    function ITensors.OpSum(::Model"ising", n1, n2; J, h)
    opsum = OpSum()
    if J != 0
    opsum += -J, “X”, n1, “X”, n2
    end
    if h != 0
    opsum += -h / 2, “Z”, n1
    opsum += -h / 2, “Z”, n2
    end
    return opsum
    end

This MPO() here seems to be defined specifically for the Ising model, is it different from the one used in finite system DMRG? Also, it seems that OpSum() is very similar to MPO(). Is there any difference? Is there a reason that .+= is used for one and += is used for the other?

  1. Where is the model “ising” defined? In the code ising.jl it seems that “ising” is used as an argument in defining the two functions MPO() and OpSum().

Thanks a lot for your time.
-Meng

Hi Meng,

Good questions.

  1. \psi.AL are the left gauged MPS tensors and \psi.C are the MPS bond matrices, respectively. \psi.AR are the right gauged MPS tensors. The ITensorInfiniteMPS.jl package uses the mixed canonical gauge, see [1701.07035] Variational optimization algorithms for uniform matrix product states for more details.
  2. MPO is the definition of the finite MPO for the Ising model, and Opsum defines the terms of the unit cell of the infinite system Hamiltonian. This interface is admittedly quite confusing (it grew organically while I was originally writing the package), I am simplifying the interface here: [WIP] Start simplifying the necessary OpSum definitions for Models by mtfishman · Pull Request #63 · ITensor/ITensorInfiniteMPS.jl · GitHub so that there will only be a single function ITensorInfiniteMPS.unit_cell_terms where you define the terms in the unit cell for a model.
    There isn’t a big reason for using .+= instead of +=, .+= adds the terms in-place so the OpSum doesn’t need to get reallocated for each term added, but the performance difference won’t be noticeable in general.
  3. The way to think about it is that each model is just a special instance of the general (parametric) type Model. So an instance of the Ising model is just Model("ising") and the type is Model"ising". The main use of this type is so that you can define the Hamiltonian for the model, currently through the functions MPO and OpSum but in the future through the single function ITensorInfiniteMPS.unit_cell_terms.
1 Like