Page 1 of 1

Evaluate energy expectation value in infinite Purification MPS

Posted: 22 Dec 2025, 10:25
by rmldj
I ran into trouble trying to evaluate energy expectation value in an infinite purification MPS (which will model a thermal state). I installed the newest version of TeNPy (1.1.0) using conda today.

My setup is as follows:

Python: Select all

from tenpy.models.tf_ising import TFIChain
from tenpy.networks.purification_mps import PurificationMPS

model_params = {"L": 2,"J": 1.0, "g": 1.0, "bc_MPS": "infinite"}
model = TFIChain(model_params)
sites = model.lat.mps_sites()
psi = PurificationMPS.from_infiniteT(sites, bc="infinite", form="B")
Then in principle I run imaginary PurificationTEBD.

Then when I try

Python: Select all

print(psi.expectation_value(model.H_MPO))
I get AttributeError: 'MPO' object has no attribute 'rank'
while

Python: Select all

print(model.H_MPO.expectation_value(psi))
gives ValueError: different rank!

What is the correct way to evaluate such a thermal expectation value in the PurificationMPS formulation?
In the documentation I could just find examples for spin operators.

I would be grateful for any help, as I am a complete novice in TeNPy...
Romuald

Re: Evaluate energy expectation value in infinite Purification MPS

Posted: 30 Jan 2026, 12:13
by Jakob
Hi!

In MPS.expectation_value, use the axes parameter.
Hope this already helps, if not, post again =)

Cheers
Jakob