+1 vote
asked by (340 points)

I notice that the toIQMPO() method in MPO class has been removed in itensor v2.0. I wander if there exist an easy way to convert a MPO to IQMPO?

1 Answer

0 votes
answered by (70.1k points)
selected by
 
Best answer

Hi, yes the toIQMPO method was getting difficult to maintain and I wasn't sure if it was necessary to have anymore since the library now includes AutoMPO, which can make many common types of IQMPOs.

We could consider putting toIQMPO back in, but before doing that, what is the use case for which you need it? Perhaps you can accomplish what you are trying to do another way.

I should mention that toIQMPO was only ever reliable for "hand made" MPOs which had entries which were either order 1 or else zero. I would not recommend using it for MPOs which were, say, obtained numerically by summing many smaller MPOs together, as such MPOs could have lots of small entries which were nonetheless important.

Best,
Miles

commented by (340 points)
Hi Miles,
Thank you!

AutoMPO works great for common types of IQMPOs.
I use toIQMPO for MPOs that haven't been implemented in itensor,  i.e, long-range interactions.  It is much easier for me to make MPOs by hand for those interactions, and then convert it to IQMPO for simulation. Any way, I'll try to make those directly in terms of IQMPO type.

Thank your again for your excellent work.
commented by (70.1k points)
Hm, I see yes that would be a nice case for which to have toIQMPO ideally. However, that's also one of the cases where one might worry about whether toIQMPO would function correctly, since the long-range interactions have small tails and toIQMPO would truncate these away at some point depending on the cutoff used. But if I upgraded it the cutoff would be adjustable such that you could test it.

If you'd like to create an issue on github for this (restoring toIQMPO), mentioning your use case, then I can plan to get it working again and notify you when it's done by closing the issue. It will take at least a few weeks, though, maybe more since I have some other high-priority things too. For instance we are finalizing a version of AutoMPO that will support more than 2-site interactions.

But all that said, if it's not too hard to implement your case directly as an IQMPO then that's the best solution both for all involved. It will be more robust as you don't have to worry about whether toIQMPO modified your Hamiltonian in some complicated way.
commented by (340 points)
Hi Miles, I am trying to write an toIQMPO myself.  Where is the substitution of IndexSet.addindex() in Itensor2 now?
commented by (70.1k points)
So the new way to do this is to use a class called IQIndexSetBuilder. You call a method on this class called .nextIndex(I) where I is the IQIndex you want to add. For an example of how to use this class look at iqtensor.cc around line 380. After you are done adding all the indices you want, you call .build() to make an IQIndexSet.

The reason for this class is I wanted IndexSets and IQIndexSets to be "const", where you could not change which indices they contain after creating them. Otherwise things could get pretty confusing and lead to bugs.
Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.

Categories

...