I want to compute different time two point correlator at a finite temp \(1/\beta\). I have in mind XXZ type chain with 'Sz' conserved. I've written a code for that but I am not pretty sure since I have not been using TenPy for long. I am attaching here the code snippet, I would be really grateful if you kindly have a look and let know if I am correct. (I want to compute \( \langle S_{z}^{j}(t) S_{z}^{i}(0) \rangle_{\beta}\), with i=2 (in the following example)).

The basic steps are :

Create model --------> Initiate infinite temp state------------> cool it down to temp beta------> two more real time evolution to compute the correlator (everything is done in purificationMPS set up).

Code: Select all

```
#--------------------Creating the model-------------------#
class XXZnewchain(CouplingModel, NearestNeighborModel, MPOModel):
def __init__(self, model_params):
model_params = asConfig(model_params, "XXZnewchain")
L = model_params.get('L', 2.)
J = model_params.get('J', 1.)
Jz = model_params.get('Jz', 1.)
hz = model_params.get('hz', 1.)
bc_MPS = model_params.get('bc_MPS', 'finite')
leg = npc.LegCharge.from_qflat(npc.ChargeInfo([1], ['2*Sz']), [1, -1])
#leg = tenpy.linalg.np_conserved.LegCharge.from_trivial(2)
Sp = [[0., 1.], [0., 0.]]
Sm = [[0., 0.], [1., 0.]]
Sz = [[0.5, 0.], [0., -0.5]]
site = Site(leg, ['up', 'down'], Sp=Sp, Sm=Sm, Sz=Sz)
lat = Chain(L, site, bc='open', bc_MPS=bc_MPS)
CouplingModel.__init__(self, lat)
self.add_onsite(-hz, 0, 'Sz')
self.add_coupling(J * 0.5, 0, 'Sp', 0, 'Sm', 1, plus_hc=True)
self.add_coupling(Jz, 0, 'Sz', 0, 'Sz', 1)
MPOModel.__init__(self, lat, self.calc_H_MPO())
NearestNeighborModel.__init__(self, lat, self.calc_H_bond())
#--------------------Model Characterization---------------------------#
L, J, Jz, hz = 10, 1., 0.5, 0.2
model_newparams = dict(L=L,J=J,Jz=Jz,hz=hz,bc_MPS='finite')
M = XXZnewchain(model_newparams)
#------------Initial Temp Initial state---------------------------#
psi = PurificationMPS.from_infiniteT(M.lat.mps_sites(), bc='finite')
#--------------Sites i in <S_{z}^{j}(t)S_{z}^{i}(0)>_{\beta}-------------------------#
i = 2
#-----------------Cooling down to finite temp-----------------------------#
order_1 , dt_1, beta_max = 2, 0.01, 5.0
options = {'trunc_params': {'chi_max': 100,'svd_min': 1.e-8},'order': order_1,'dt': dt_1,'N_steps': 1}
beta = 0.
eng_1 = PurificationTEBD(psi, M, options) #------ TEBD engine to be used for cooling---------------#
while beta < beta_max:
beta += 2. * dt_1 # factor of 2: |psi> ~= exp^{- dt H}, but rho = |psi><psi|
eng_1.run_imaginary(dt_1) # cool down by dt
#-----------------Evoling psi via real time TEBD for computing <S_{z}^{j}(t)S_{z}^{i}(0)>_{\beta} #
phi = psi.copy()
phi.apply_local_op(i, 'Sz')
order, dt, dtm, chi, tmax = 2, 0.025, 0.5, 100, 10.
M_tebd = models.model.NearestNeighborModel.from_MPOModel(M)
tebd_params = {'order': order,'dt': dt,'N_steps': int(dtm / dt + 0.5),'trunc_params': {'chi_max': chi,'svd_min': 1.e-14},}
eng2 = PurificationTEBD(psi, M_tebd, tebd_params) # TEBD for evolving < \phi | exp(-\beta H/2)#
eng3 = PurificationTEBD(phi, M_tebd, tebd_params) # TEBD for evolving Sz_{i} exp(-\beta H/2) |\phi >#
for n in range(int(tmax / dtm + 0.5)):
eng2.run()
eng3.run()
C_i = MPSEnvironment(psi, phi).expectation_value('Sz') #------measuring the correlator---------------------#
```

Thanks in advance

Best,

Sourav.