Hi there,
I am currently using TenPy to try to calculate thermodynamic observables for bigger yet finite systems. For the first test I wanted to do some smaller ones to test all tools. There I noticed that the MPO.variance method does not work for "non standard MPS" I checked the code and saw the exception case.
My question is now , is there a workaround that can handle that , just as for example constructing a H**2 and calculate it with MPO.expectation or similiar without requring to rewrite complete bases of classes?
Already thanks in advance for any help that might come!
Variance of purified MPS state
- Johannes
- Site Admin
- Posts: 474
- Joined: 21 Jul 2018, 12:52
- Location: TU Munich
Re: Variance of purified MPS state
It's not hard to generalize and adjust the source of that variance function to work with purificationMPS - all you need to do is to initially check whether you have the additional q leg (at the top of the function), and if so, in addition contract the additional ['q'] with ['q*'] leg in the tensordot where you "close" one column, i.e. the tensordots of
contr with th.conj() and B.conj(), respectively.-
Leyin
- Posts: 2
- Joined: 11 Sep 2024, 12:36
Re: Variance of purified MPS state
Ah okay so for example for the 0 site i would add
in addition to the previos p leg contraction and same further on for B ?
Since the contraciton with the W's only happens on the physical legs p and all that gets added new are the virtual legs q and q* on top and bottom of the B - MPS right?
Or is it smarter to do it together with
not sure how much of a different in calculation time it would be
Python: Select all
contr = npc.tensordot(contr, contr, axes=[ 'q', 'q*' ]) Since the contraciton with the W's only happens on the physical legs p and all that gets added new are the virtual legs q and q* on top and bottom of the B - MPS right?
Or is it smarter to do it together with
Python: Select all
contr = npc.tensordot(contr, B.conj(), axes=[['vR*', 'p' , 'q'], ['vL*', 'p*, 'q*']])