Gap in open spin chain :

How do I use this algorithm? What does that parameter do?
Post Reply
Sylvain
Posts: 1
Joined: 29 Jul 2024, 15:23

Gap in open spin chain :

Post by Sylvain »

Hello,

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))

the energy are identical for the 2 states and I have these warning :

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
User avatar
Johannes
Site Admin
Posts: 456
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: Gap in open spin chain :

Post by Johannes »

The Warning is very relevant here: since version 0.9.0, the `orthogonal_to` should not be an entry in the `dmrg_params`, but should be a direct keyword argument to the dmrg.run() function, i.e. somthing like dmrg.run(psi, M, dmrg_params, orthogonal_to=states).

As an alternative, you might want to look into the simulation setups, first running a tenpy.simulations.ground_state_search.GroundStateSearch to find the ground state, and then run the tenpy.simulations.ground_state_search.OrthogonalExcitations to find (one or more) excited states.
Post Reply