Hi,

I am trying to simulate error correcting circuits which involves Hadamard gates and CZ gates. The CZ gates are implemented through the evolution of a specific truncated Hamiltonian which does not follow directly from the operators available through autoMPO. The Hamiltonian is :

where @@\Delta@@ is a control parameter and a function of time, and the ordering of basis elements in the matrix is @@|00\rangle,|01\rangle,|10\rangle,|11\rangle,|02\rangle,|20\rangle@@. I want to create the MPO for this Hamiltonian with the entire basis set (padding zeros for the missing basis elements). Is there a simple way to do this starting from the ITensor or otherwise?

The reason I want to create MPOs is I want to take advantage of approximate contraction methods. My circuit does not have a fixed starting state, so I cannot start out with an MPS, apply regular gates and keep truncating the MPS after each step. Instead I want to contract a bunch of MPOs and finally find the trace of the contracted thing.

Lastly, is there a simple way to represent a Hadamard gate (H) as an MPO on a three-level system i.e. acts as H on first two levels and Identity on the third level?

I have implemented all the above as regular tensors and its working great. The ITensor snippets for a single unitary step and Hadamard are given below :

```
ITensor
makeUi(Index const& s1, Index const& s2, float ci, float dt)
{
const float g = 15*2*PI;
const float eta = -220*2*PI;
const float g2 = SQRT2*g;
auto H = ITensor(s1,prime(s1),s2,prime(s2));
H.set(s1=1,s2=2,prime(s1)=2,prime(s2)=1,g);
H.set(s1=2,s2=1,prime(s1)=1,prime(s2)=2,g);
H.set(s1=2,s2=1,prime(s1)=2,prime(s2)=1,ci);
H.set(s1=2,s2=2,prime(s1)=2,prime(s2)=2,ci);
H.set(s1=2,s2=2,prime(s1)=1,prime(s2)=3,g2);
H.set(s1=2,s2=2,prime(s1)=3,prime(s2)=1,g2);
H.set(s1=1,s2=3,prime(s1)=2,prime(s2)=2,g2);
H.set(s1=1,s2=3,prime(s1)=1,prime(s2)=3,eta);
H.set(s1=3,s2=1,prime(s1)=2,prime(s2)=2,g2);
H.set(s1=3,s2=1,prime(s1)=3,prime(s2)=1,2*ci + eta);
auto Ui = expHermitian(-dt*H,1_i);
return Ui;
}
ITensor
makeHad3d(Index const& s)
{
auto Had = ITensor(s,prime(s));
Had.set(s=1,prime(s)=1,1.0/SQRT2);
Had.set(s=2,prime(s)=2,-1.0/SQRT2);
Had.set(s=1,prime(s)=2,1.0/SQRT2);
Had.set(s=2,prime(s)=1,1.0/SQRT2);
Had.set(s=3,prime(s)=3,1.0);
return Had;
}
```

The switch to MPOs is a bit rough. Any help would be appreciated.

Thank you for the entire ITensor package, it is really helpful.

Aditya