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)