I'm a bit new in TenPy but after following the docs and the forum I managed to reproduce a lot of results.
However I'm a bit stuck to get excited states. I'm working on an open spin chain. it's a well known systems in which the ground state and the 1st excited state are separated by a gap proportionnal to 1/L (L=length of the chain)
I used 'orthogonal_to' to get the excited state but it seems it's not working on my code
Code: Select all
import numpy as np
import scipy
import matplotlib.pyplot as plt
np.set_printoptions(precision=5, suppress=True, linewidth=100)
plt.rcParams['figure.dpi'] = 150
import tenpy
import tenpy.linalg.np_conserved as npc
from tenpy.algorithms import dmrg
from tenpy.networks.mps import MPS
L = 30
delta=0
J=np.array([1+delta,1-delta]*int(L//2-1))
J=np.append(J,1)
model_params = {
'L': L,
'Jx': J, 'Jy': J, 'Jz':J,
'hz': 0,
'conserve': 'best'
}
M = tenpy.models.spins.SpinChain(model_params)
dmrg_params = {
'mixer': None, # setting this to True helps to escape local minima
'max_E_err': 1.e-10,
'trunc_params': {
'chi_max': 100,
'svd_min': 1.e-10,
},
'verbose': True,
'combine': True
}
ps = [['up'], ['down']] *(M.options['L']//2) # Neel state in lattice order
psi0 = tenpy.networks.mps.MPS.from_lat_product_state(M.lat, ps)
states = dmrg_params['orthogonal_to']=[]
for i in range(2):
psi = psi0.copy()
results = dmrg.run(psi, M, dmrg_params)
states.append(psi)
print(M.H_MPO.expectation_value(psi))
UserWarning: unused options for config DMRG:['orthogonal_to', 'verbose']
I don't understand why it's not calculating the 1st excited state.
thank for your help