Different time two point correlator at finite temperature.

Discussing the best way to implement feature X
Post Reply
Sourav Nandy
Posts: 5
Joined: 03 Aug 2022, 11:30

Different time two point correlator at finite temperature.

Post by Sourav Nandy »


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)):
    C_i =  MPSEnvironment(psi, phi).expectation_value('Sz')  #------measuring the correlator---------------------#

Thanks in advance

User avatar
Site Admin
Posts: 428
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: Different time two point correlator at finite temperature.

Post by Johannes »

Yes, this looks correct.

The line

Code: Select all

M_tebd = models.model.NearestNeighborModel.from_MPOModel(M)
is not really necessary, the Model which you have already is a NearestNeighborModel defining H_bond, so there's no need to create a new model here.
In fact, you don't need to define the XXZchainnew here at all, since it is already defined in TeNPy, but it also doesn't hurt (assuming there's not bug in either implementation).

During the real time evolution in the end, you might want to enable the "backwards" disentangling, with the purification tebd parameter disentangle='backwards'. Note that you have to do this consistently on the two engines, you get wrong results, if you do it only in one...

PS: Sorry for the late reply, I hope it still helps.
Sourav Nandy
Posts: 5
Joined: 03 Aug 2022, 11:30

Re: Different time two point correlator at finite temperature.

Post by Sourav Nandy »


Sorry for the so delayed reply. Your reply is indeed helpful, thanks a lot !
Post Reply