Can SpinChainNNN2 in the limits of the TFIM generate same results as TFIModel?

How do I use this algorithm? What does that parameter do?
Post Reply
nilanjan29
Posts: 1
Joined: 23 Sep 2024, 09:21

Can SpinChainNNN2 in the limits of the TFIM generate same results as TFIModel?

Post by nilanjan29 »

Hi, I am Nilanjan Sasmal

I am very much new to this topic of handling things in Tenpy (So, the question might seems too obvious to everyone, please forgive me for that!)

I am trying to simulate the 1D Transverse Field ANNNI Model (trying to obtain the phase diagram), the Hamiltonian is given by,

\( \displaystyle H_{ANNNI} = -\sum_{j=1}^{N-1} \sigma_j^z \sigma_{j+1}^z +\kappa \sum_{j=1}^{N-2} \ \sigma_{j}^z \sigma_{j+2}^z - h \sum_{j=1}^N \sigma_j^x \ \ \ \ : \ \ \text{with, } \kappa, h \geq 0 \)

I was suggested to run a Finite DMRG of this model and then proceed to iDMRG. However, before switching on all the necessary coefficients for the above model (ANNNI), to check the consistency of my code, I wanted to regenerate the results of 1D TFIM in the limit \(\kappa = 0\). Particlualry magnetization (\( \langle \sigma^z\rangle\)) vs field (\(h\)) and \(ZZ\)-correlation function.

But as it turns out, after repeated trying I am not being able to generate a consistent result for TFIM using SpinChainNNN2, I am sitting with this for more than 20 days now, and still no progress, can you please help me?

Below, I am giving my code for better reference!

Python: Select all

# Mandatory Imports!
import numpy as np
import matplotlib.pyplot as plt 
from pprint import pprint

# Tenpy imports
from tenpy.models.tf_ising import TFIModel
from tenpy.networks.mps import MPS
from tenpy.models.spins_nnn import SpinChainNNN2
from tenpy.algorithms.dmrg import SingleSiteDMRGEngine, TwoSiteDMRGEngine

# Parameters

L = 10                                                                        # System size
h_values = np.linspace(0, 1.5, 15)                               # Transverse field values
dmrg_params = {
    'mixer': True,                                                          # Mixer for better convergence
    'max_E_err': 1e-7,                                                  # Energy accuracy threshold
    'max_sweeps': 50,                                                  # Maximum DMRG sweeps
    'min_sweeps': 5,                                                    # Minimum DMRG sweeps
    'trunc_params': {'chi_max': 40, 'svd_min': 1e-10},    # Bond dimension
}

mz_annni = []
for h in h_values:
    # SpinChainNNN2 model parameters
    model_params = {
        'L': L,
        'S': 1,                       # I have tried using S = 0.5 as well as S = 1, it gives the same result
        'Jx': 0.0,
        'Jy': 0.0,
        'Jz': -1.0,
        'Jxp': 0.0,
        'Jyp': 0.0,
        'Jzp': 0.0,                    # No next-nearest-neighbor interaction (TFIM limit)
        'hx': h,
        'hy': 0.0,
        'hz': 0.0,
        'conserve': None                       # No Sz conservation
    }
    annni_model = SpinChainNNN2(model_params)
    
    # Initialize MPS
    p_state = ['up'] * (annni_model.lat.N_sites)
    psi = MPS.from_product_state(annni_model.lat.mps_sites(), p_state, bc = annni_model.lat.bc_MPS)
    
    # Run DMRG
    eng = SingleSiteDMRGEngine(psi, annni_model, dmrg_params)
    E, psi = eng.run()
    
    # Compute z-magnetization
    mz = np.mean([psi.expectation_value('Sz', site) for site in range(L)])
    mz_annni.append(mz)

mz_tfi = []
for h in h_values:
    # TFIModel parameters
    model_params = {
        'L': L,
        'J': 1.0,
        'g': h,
        'conserve': None  # No Sz conservation
    }
    tfi_model = TFIModel(model_params)
    
    # Initialize MPS
    p_state = ['up'] * (tfi_model.lat.N_sites)
    psi = MPS.from_product_state(tfi_model.lat.mps_sites(), p_state, bc = tfi_model.lat.bc_MPS)
    
    # Run DMRG
    eng = SingleSiteDMRGEngine(psi, tfi_model, dmrg_params)
    E, psi = eng.run()
    
    # Compute z-magnetization
    mz = np.mean([psi.expectation_value('Sz', site) for site in range(L)])
    mz_tfi.append(mz)

Now, If I Plot the magnetization values, I get freaky answers like, the magnetization becomes zero well before the critical point i.e., \(h = 1\). (I know, I might be doing something wrong, but I can't figure it out at the moment)
User avatar
Johannes
Site Admin
Posts: 461
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: Can SpinChainNNN2 in the limits of the TFIM generate same results as TFIModel?

Post by Johannes »

To detect spontaneous symmetry breaking, you shouldn't check the magnetization: it is only nonzero in the symmetry broken states, but you can write an (anti)-symmetric superposition of the symmetry-broken states which has magnetization 0.
Instead, you should check the decay of correlations at long distances!

See e.g. the exercise_tenpy.ipynb (with corresponding solutions_tenpy.ipynb) in the (also included in the online docs), among a number of other examples).
Post Reply