0 votes
asked by (680 points)

I am trying to write code to represent a thermal state using the ancilla purification technique. I want to implement the cooling step using Trotter gates, since 'toExpH' does not seem to give me the desired accuracy. I am using the XX Hamiltonian.

I believe I have to use swapgates, since the time evolution gates are not on adjacent sites. I was just wondering if there is some example code to do this?

Effectively what I am doing now, is if say I have a gate 'hterm' that acts on sites 1 and 3,

vector<BondGate> gates();
auto s1 = BondGate(sites,2,3);
gates.push_back(s1);
auto g = BondGate(sites,1,3,BondGate::tImag,tau,hterm);
gates.push_back(g);
gates.push_back(s1);

So I swap 2&3, then have my gate on sites 1&3, and then I swap back sites 2&3.

However, I get the error

b+2 < r_orth_lim_

when gateTEvol hits the second gate, the actual gate that time evolves.

I am just wondering what I should be doing? I can send more code if necessary, but the full code is over several files, so hopefully this is enough.

Best,
Nick

1 Answer

0 votes
answered by (70.1k points)

Hi Nick,
Thanks for the question. So I think the issue is with the site arguments you passed to BondGate. The idea there is that these should actually be 1,2, not 1,3. The reason is that after you swap site 3 over to site 2, now acting on sites 1 and 2 is effectively like acting on sites 1 and 3 of the original wavefunction. Then swapping 2 and 3 again would complete that process (though sometimes there are more efficient swapping patterns when acting on multiple bonds in a row).

I should consider just making it an error to input a pair of site numbers which are more that 1 apart, actually. The BondGate system is a bit of an older part of ITensor and could be a little better designed in hindsight. But it does work quite well and is very efficient (state of the art) when used for these kinds of calculations.

Please feel free to post additional questions below or of course let me know if that fix doesn't work -

Best regards,
Miles

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

...