MPS.expectation_value_term() not working for iDMRG

How do I use this algorithm? What does that parameter do?
Post Reply
Posts: 2
Joined: 20 May 2021, 00:31

MPS.expectation_value_term() not working for iDMRG

Post by yixuan »

Hi all,

I found that the segment_boundaries in the MPS class is only defined for finite DMRG, and I run into this error for iDMRG when calling expectation_value() or its relatives expectation_value_term(), expectation_value_terms_sum() like this:

File "", line 716, in order
order += psi.expectation_value_terms_sum(list_sum)[
File "/TeNPy/tenpy/networks/", line 2200, in expectation_value_terms_sum
terms_sum = mpo_.expectation_value(self, max_range=ct.max_range())
File "/TeNPy/tenpy/networks/", line 666, in expectation_value
env = MPOEnvironment(psi, self, psi, start_env_sites=0)
File "/TeNPy/tenpy/networks/", line 1780, in __init__
super().__init__(bra, ket, cache, **init_env_data)
File "/TeNPy/tenpy/networks/", line 4072, in __init__
File "/TeNPy/tenpy/networks/", line 1828, in init_first_LP_last_RP
super().init_first_LP_last_RP(init_LP, init_RP, age_LP, age_RP, start_env_sites)
File "/tenpy/networks/", line 4097, in init_first_LP_last_RP
ket_U, ket_V = self.ket.segment_boundaries
AttributeError: 'MPS' object has no attribute 'segment_boundaries'

The correlation_function() works fine, but I need to calculate many terms so the MPO conversion in the function above may be more efficient. How can I define the segment boundaries for MPS class in iDMRG? (I use v0.8.4)

Best regards,

Post Reply