The convergence problem of Spin-1 AFM Heisenberg Chain

How do I use this algorithm? What does that parameter do?
Post Reply
Catcher
Posts: 4
Joined: 19 Sep 2025, 02:31

The convergence problem of Spin-1 AFM Heisenberg Chain

Post by Catcher »

I'm a newcomer of TeNPy, recently I want simulate the Spin-1 AFM Heisenberg Chain using tenpy-finite dmrg algorithm.
\(H = \sum_i^{L-1} S_i\cdot S_{i+1}\)
And my code as follow:

Python: Select all

import numpy as np
import matplotlib.pyplot as plt
from tenpy.networks.mps import MPS
from tenpy.models.spins import SpinModel
from tenpy.algorithms import dmrg


model_params = dict(
        L                   =32,
        S                   =1,  # spin 1
        Jx                  =1,
        Jy                  =1,
        Jz                  =1,  # couplings
        bc_MPS              ='finite',      #boundary condition
        conserve            ='best',
        )                               # conserved quantum qualities


dmrg_params = {
        "max_sweeps"            : 800,
        'mixer'                 : True,  # setting this to True helps to escape local minima. 
        'trunc_params'          : 
        {       'chi_max'       : 1600,
                'svd_min'       : 1.e-13,},
        'max_E_err'             : 1.e-13,
    }


def DMRG_heisenberg( model_params,dmrg_params ):
    print("DMRG")
    M = SpinModel(model_params) #类实例化

    L = int(model_params['L'])

    product_state = [0,1,-1,0]*(L//4)  # initial state

    psi = MPS.from_product_state(M.lat.mps_sites(), product_state, bc=M.lat.bc_MPS) #initial MPS

    info = dmrg.run(psi, M, dmrg_params)  # main work....

    E = info['E']
    print("E = {E:.13f}".format(E=E))
    print("final bond dimensions: ", psi.chi)


    Sz = psi.expectation_value("Sz")  # Sz instead of Sigma z: spin-1/2 operators!
    
    mag_z = np.mean(Sz)

    print("<S_z> = [{Sz0:.5f}, {Sz1:.5f}]; mean ={mag_z:.5f}".format(Sz0=Sz[0],
                                                                     Sz1=Sz[1],
                                                                     mag_z=mag_z))
    # note: it's clear that mean(<Sz>) is 0: the model has Sz conservation!

    return E, psi 

#执行DMRG算法
if __name__ == "__main__":
    import logging
    logging.basicConfig(level=logging.INFO)
    E,psi = DMRG_heisenberg(model_params,dmrg_params)
   

questions:

the energy is

Code: Select all

-37.4230420434121598/31 = -1.2....
per bond. Obviously, It's not right and so far from the exact result

Code: Select all

−1.401484039….
.And the wave function has non vanished mag_z ! Therefore, how can i do to fix this issue? Thanks so much!
User avatar
Johannes
Site Admin
Posts: 472
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: The convergence problem of Spin-1 AFM Heisenberg Chain

Post by Johannes »

The initial state should be chosen as

Python: Select all

product_state = ['0.0','1.0','-1.0','0.0']*(L//4)  # initial state
or even more simply

Python: Select all

product_state = ['0.0'] * L
Note that these are strings, labeling the differen Sz=-1, 0, +1 - this is different from simple integers, which actually give you the index based on which the Site locally defines the spin operators - but this can change, depending on what symmetry you conserve, and in the case of the SpinSite(S=1.0, conserve='Sz') used by the model, you get 0 to map to Sz='-1.0', 1 to map to Sz='0.0', and 2==-1 to map to Sz='+1.0' - that's why your Sz expectation value doesn't fit.

This is the big issue you have here. Apart from that, you shouldn't set E_tol to 1.e-13, then DMRG just keeps spinning trying to converge, and actually a much larger bond dimension (say 100) is sufficient for this model to very high accuracy already - you have a much larger error due to finite size effect (try running infinite DMRG as well.


Further, the energy for finite DMRG is the total energy of the full Hamiltonian. Divide by (psi.L-1) to scale it to the number of bonds. (I believe you already indicated that with the =1.2...)
Catcher
Posts: 4
Joined: 19 Sep 2025, 02:31

Re: The convergence problem of Spin-1 AFM Heisenberg Chain

Post by Catcher »

ok, thanks for your reply. And your suggestions are exceedingly important for me :)
Post Reply