# Build more-than-two-operator terms using AutoMPO

+1 vote

Hi Miles,

I am trying to use the new feature of building more-than-two-operator terms using AutoMPO with the sample code:

AutoMPO ampo(sites);
ampo += "Sz",1,"Sz",2,"Sz",3;
auto H = MPO(ampo);
auto E0 = dmrg(psi,H,sweeps,"Quiet");


And when running I get the error message

Only at most 2-operator terms allowed for exact AutoMPO conversion to MPO/IQMPO


What is the correct way of handling this?

Thanks!
Chengshu

+1 vote
selected by

Hi Chengshu,
So the multi-site operator support for AutoMPO is still a new feature that we are continuing to polish. Right now it only works for making IQMPO's (made out of quantum number conserving tensors). But we want to make it work for regular MPO's soon too.

Does your Hamiltonian have conserved quantum numbers? (Like the term you show clearly commutes with total Sz.) If so you can just change the code to read

auto H = IQMPO(ampo);


and change psi to be an IQMPS (see the sample/iqdmrg.cc code for how to do this; it's important to initialize the state). Then everything should work.

If your Hamiltonian does not conserve any quantum numbers, then unfortunately you'll have to wait for me to support that case. It shouldn't be too hard but it will take a bit of work.

Miles

commented by (680 points)
Hi Miles,

Thanks for the really fast reply! Unfortunately my Hamiltonian does contain terms like Sx, so I believe no conservative quantum number is available here.
commented by (70.1k points)
Hm, that is too bad. Ok I will see what I can do to fast track this code improvement, as it's a feature we definitely want to have anyway.  It should be easy in one sense: I just have to make the code "dumber" and not know about quantum numbers. But it's a complicated code so it's not totally trivial to modify it.
commented by (680 points)
Thanks a lot! It's of great help to know what is happening.
commented by (70.1k points)
Hi Chengshu,
I just pushed a change to the 'develop' branch of ITensor that fixes this issue (allowing AutoMPOs to have terms on more than two sites and be converted to regular MPOs and not just IQMPOs).

To try it out, pull the latest version of ITensor from github and do "git checkout develop" and recompile. If you try it out, let me know if you run into any issues - thanks.

Miles
commented by (680 points)
Hi Miles,

Thanks a lot for the update. Happy holidays!

Chengshu
commented by (390 points)
Dear Miles,
I am trying to construct a multi-site MPO now with the current version of ITensor and I obtain the same error "Only at most 2-operator terms allowed for AutoMPO conversion to MPO/IQMPO" even for a IQMPO. Is still not possible then to construct multi-site operators?

Thanks a lot!
Jacopo.
commented by (70.1k points)
Hi, which version are you using and are you making just an MPO or calling toExpH on the autompo? (The toExpH function only supports two site operators at the moment.)
commented by (70.1k points)
More than two site operators are definitely now supported for making MPOs and IQMPOs. If you’re still getting the error, please email me a minimal sample code - thanks!
commented by (390 points)
Dear Miles,

yes indeed, you are completely right, the problem is with calling toExpH and not with the making the MPO, I did not realize that. Thank you for your quick answer.
Are there ways to avoid this problem at the moment?
Thanks a lot!
commented by (70.1k points)
Hi, so unfortunately we just have too many other things we need to finish at the moment to add that feature to toExpH. But we hope to add it some time this year.

I would also add that a lot of evidence is coming out (see the recent article by Hubig et al.) that using MPO methods for time evolution is often the worst choice. I added toExpH because it was convenient to have (and I was hoping MPOs would perform better for time evolution) but apparently methods such as TDVP are much superior and can also handle long range interactions.

So actually our priority will really be to add a good TDVP code for ITensor.

In the meantime, if you need to time evolve with long-range interactions, I’d suggest you try your hand at writing TDVP. ITensor is a good choice for doing that.

If your model only has finite-range interactions (even if they’re not nearest-neighbor) then using Trotter gates plus swap gates is an excellent choice and gives really good results. Let me know if you have questions about doing that.

Best regards,
Miles