Hi all!
I have an MPS called state
and an MPO called H
; I’m trying to calculate the product of the projection, using ProjMPO
, of H
with some tensors obtained from state
.
This is partly like a typical TDVP1 sweep, and in fact I based my code on that algorithm.
I need to compute the following.
- The product of
H
’s one-site projection on the first site with the first tensor of the MPS (with its orthogonality center on the first site):
PH = ProjMPO(H)
PH.nsite = 1
orthogonalize!(state, 1)
ITensors.position!(PH, state, 1)
H1 = PH(state[1])
- then, I need to decompose the first site of the MPS in a left-orthogonal tensor
A_1
and a “residue”C
, and multiply this by the zero-site projection ofH
:
_, S, V = svd(state[1], uniqueinds(state[1], state[2]))
C = S * V
PH.nsite = 0
ITensors.position!(PH, state, 2)
K = PH(C)
- The same as point 1, but on the second bond, i.e. the product of
H
’s one-site projection on the second site with the second tensor ofstate
with the orthogonality center moved on the second bond as well:
PH.nsite = 1
orthogonalize!(state, 2)
ITensors.position!(PH, state, 2)
H2 = PH(state[2]) # <---- error
When I run this code (in sequence) I get the following error, referring to the line I pointed out:
ERROR: LoadError: The order of the ProjMPO-ITensor product P*v is not equal to the order of the ITensor v, this is probably due to an index mismatch.
Common reasons for this error:
(1) You are trying to multiply the ProjMPO with the 1-site wave-function at the wrong position.
(2) `orthogonalize!` was called, changing the MPS without updating the ProjMPO.
P*v inds: ((dim=1|id=245|"Link,l=1"), (dim=1|id=875|"Link,l=1"), (dim=1|id=875|"Link,l=1")', (dim=4|id=788|"Site,n=2,vS=1/2")', (dim=1|id=898|"Link,l=2")')
v inds: ((dim=4|id=788|"Site,n=2,vS=1/2"), (dim=1|id=898|"Link,l=2"), (dim=1|id=245|"Link,l=1"))
I can see that there are two spurious indices on P*v
, id=875
and its primed version, that weren’t present in v
, but I don’t get where they come from.
I did call orthogonalize!
on the state, but also I updated the ProjMPO as well. Or so I think. Does my code not do what I think it does?