MPS.expectation_value_term() not working for iDMRG
Posted: 12 Sep 2021, 22:43
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 "iDMRG.py", line 716, in order
order += psi.expectation_value_terms_sum(list_sum)[
File "/TeNPy/tenpy/networks/mps.py", line 2200, in expectation_value_terms_sum
terms_sum = mpo_.expectation_value(self, max_range=ct.max_range())
File "/TeNPy/tenpy/networks/mpo.py", line 666, in expectation_value
env = MPOEnvironment(psi, self, psi, start_env_sites=0)
File "/TeNPy/tenpy/networks/mpo.py", line 1780, in __init__
super().__init__(bra, ket, cache, **init_env_data)
File "/TeNPy/tenpy/networks/mps.py", line 4072, in __init__
self.init_first_LP_last_RP(**init_env_data)
File "/TeNPy/tenpy/networks/mpo.py", 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/mps.py", 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,
Yixuan
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 "iDMRG.py", line 716, in order
order += psi.expectation_value_terms_sum(list_sum)[
File "/TeNPy/tenpy/networks/mps.py", line 2200, in expectation_value_terms_sum
terms_sum = mpo_.expectation_value(self, max_range=ct.max_range())
File "/TeNPy/tenpy/networks/mpo.py", line 666, in expectation_value
env = MPOEnvironment(psi, self, psi, start_env_sites=0)
File "/TeNPy/tenpy/networks/mpo.py", line 1780, in __init__
super().__init__(bra, ket, cache, **init_env_data)
File "/TeNPy/tenpy/networks/mps.py", line 4072, in __init__
self.init_first_LP_last_RP(**init_env_data)
File "/TeNPy/tenpy/networks/mpo.py", 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/mps.py", 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,
Yixuan