# 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
answered by (29.7k points)
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 (650 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 (29.7k 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 (650 points)
Thanks a lot! It's of great help to know what is happening.
commented by (29.7k 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 (650 points)
Hi Miles,

Thanks a lot for the update. Happy holidays!

Chengshu