# TDVP for Hamiltonian with three-site interaction

**URL:** https://itensor.discourse.group/t/tdvp-for-hamiltonian-with-three-site-interaction/1557
**Category:** ITensor C++ Questions
**Tags:** mpo
**Created:** [March 18, 2024, 6:27am UTC](https://itensor.discourse.group/t/tdvp-for-hamiltonian-with-three-site-interaction/1557 "2024-03-18T06:27:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Federico](https://avatars.discourse-cdn.com/v4/letter/f/c2a13f/32.png) [@Federico](https://itensor.discourse.group/u/Federico)
#### Post date: [March 18, 2024, 6:27am UTC](https://itensor.discourse.group/t/tdvp-for-hamiltonian-with-three-site-interaction/1557/1 "2024-03-18T06:27:52Z")

</div>

Good morning,

I have a question related to ITensor c++.  
I was trying to implement the time evolution by exploting TDVP (present here [TDVP/tdvp.h at master · ITensor/TDVP · GitHub](https://github.com/ITensor/TDVP/blob/master/tdvp.h)) of of a system with three-site interaction such as:

```auto
    for(int i = 1; i <= N-3; ++ i)
        {
        ampo += 0.5,"S+",i,"S-",i+1,"S+",i+2;          
       } 

```

is it possible? I got the following error:  
“From line 1518, file mps/autompo.cc  
Only at most 2-operator terms allowed for AutoMPO conversion to MPO/IQMPO”

Thank you in advance,  
Federico

---

<div class="post-metadata">

### Author: ![miles](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/miles/32/6_2.png) [@miles](https://itensor.discourse.group/u/miles)
#### Post date: [March 19, 2024, 6:53pm UTC](https://itensor.discourse.group/t/tdvp-for-hamiltonian-with-three-site-interaction/1557/2 "2024-03-19T18:53:51Z")

</div>

Hi Federico,  
Glad you’re trying TDVP with ITensor.

Regarding the C++ version, what version of it are you using? We did add support for multi-site operator inputs to AutoMPO quite some time ago. For example, this code works for me with the latest version:

```cpp
#include "itensor/all.h"
#include "itensor/util/print_macro.h"
using namespace itensor;

int main()
    {
    int N = 10;

    auto sites = SpinOne(N,{"ConserveQNs=",false});

    auto ampo = AutoMPO(sites);
    for(int i = 1; i <= N-3; ++ i)
       {
       ampo += 0.5,"S+",i,"S-",i+1,"S+",i+2;
       }

    auto H = toMPO(ampo);

    return 0;
    }

```

P.S. Have you considered using our newer Julia-based version of ITensor? We are supporting and developing that one a lot more.
