Adding MPO's, defined on different sites

Hi everyone,

I have the following problem, I would like to add two MPO’S, the problem is that mpo1 is defined on
“Boson,Site,n=1” and “Boson,Site,n=2” and the second one mpo2 on “Boson,Site,n=3” and “Boson,Site,n=4”. How can I do this?
Also just using OpSum and then convert them to an MPO is not possible, since the two MPO’s are already results of a partial MPS-MPO contraction, described in (partial MPS-MPO contraction)
Sorry I am quite new to itensor.

Best,
Peter

Hi Peter,
Just to make sure I understand, do you mean you have a system of four sites (or more, but let’s just consider the first four sites if more) and two operators acting on these sites, such that operator 1 acts on sites 1 and 2 and operator 2 acts on sites 3 and 4, and that you want to form an MPO which is a sum of these operators? (And that you first have them as MPO’s originally?)

If the above is correct, then ideally even though each of these operators acts non-trivially on only a subset of sites, you would still make them as MPO’s which act on all the sites. They would just act as identity operators on the sites where they don’t do anything.

Or alternatively, if you already have an MPO for operator 1 that only includes indices for sites 1 and 2 (two indices for each site, I mean) then you could make that MPO into an MPO acting on all the sites by just defining a larger MPO, copying the tensors for sites 1 and 2 over to that new MPO’s first two tensors, then setting the third and fourth MPO tensors to just be identity operators.

Hope that helps –

Thank you Miles for the answer.
But indeed my question was not clear, sorry. In the end I want to have a system, defined on two lattice sites, lets say 1 and 2. So mpo1 is already defined only on this and fine for my purpose, but mpo2, which is only defined on lattice site 3 and 4 I would like to copy on lattice site 1 and 2 and then add it to mpo1?
Sorry for not being precise enough.

Best, Peter

Maybe you’re looking for something like this:

using ITensors
n = 3
s1 = siteinds("S=1/2", n)
s2 = siteinds("S=1/2", n)
H1 = MPO(s1, "I")
H2 = MPO(s2, "I")
H2p = MPO([replaceinds(H2[j], (s2[j], s2[j]') => (s1[j], s1[j]')) for j in 1:n])
H1 + H2p

Thank you, that was exactly the thing I was looking for!