Calculating First Excited State w/ DMRG

General discussions on the ideas behind the algorithm.
Post Reply
stephenjnaus
Posts: 4
Joined: 15 Jul 2023, 01:04

Calculating First Excited State w/ DMRG

Post by stephenjnaus »

I've been trying to use this post (viewtopic.php?t=157) from 2021 to find excited states of a finite system using DMRG.
However, when I use the code Johannes lays out for us, I find that the states I get are all the GS with the same energy.
I get the following warning message suggesting it's not even taking into account the states I'm trying to orthogonalize to:

WARNING : /Users/stephennaus/miniconda3/envs/julia-arm/lib/python3.10/site-packages/tenpy/tools/params.py:232: UserWarning: unused option ['orthogonal_to'] for config DMRG
warnings.warn(msg.format(keys=sorted(unused), name=self.name))

Below is the code, I'm using:

Python: Select all

def run_dmrg_excited_states(L,V1,V2,Om,Del,chi,bc_x = 'open',bc_MPS = 'finite',n=2):
    model_params = dict(L=L, V1=V1, V2=V2, Om=Om, Del=Del,   bc_MPS=bc_MPS, conserve='parity',bc_x = bc_x) 
    dmrg_params = {
            'mixer': True,
            'chi_list':{0:round(chi/10.), 5:round(2.*chi/10.), 10:round(3.*chi/10.), 15:round(4.*chi/10.),20:round(5.*chi/10.),25:round(6.*chi/10.),30:round(7.*chi/10.),35:round(8.*chi/10.),38:round(9.*chi/10.),42:chi},
            'trunc_params': {
                'chi_max': chi,
                'svd_min': 1.e-10
            },
            'max_E_err': 1.e-8,
            'max_sweeps':10000,
        }
    psidict = {}
    Edict = {}
    M = myTFLIMModel(model_params)
    product_state = [np.array([1./np.sqrt(2),1./np.sqrt(2)])]* M.lat.N_sites #init state
    psi0 = MPS.from_product_state(M.lat.mps_sites(), product_state, bc=M.lat.bc_MPS)
    psi0.canonical_form()
    states = dmrg_params['orthogonal_to'] = []
    for i in range(n):
        psi = psi0.copy()
        results = dmrg.run(psi, M, dmrg_params)
        print(dmrg_params['orthogonal_to'])
        states.append(psi)
        Edict[str(i)] = results['E']
        psidict[str(i)] = psi
    return psidict,Edict,dmrg_params

psi,Energy,dmrg_params = run_dmrg_excited_states(L=11,V1=100.,V2=0.0,Del=0.66445,Om=1.,chi = 300, bc_x = 'open',n=3)
I'm pretty confused... any idea, what's going wrong here or how to fix it?
stephenjnaus
Posts: 4
Joined: 15 Jul 2023, 01:04

Re: Calculating First Excited State w/ DMRG

Post by stephenjnaus »

Ah Johannes mentions in this forum post (viewtopic.php?p=1551&hilit=excit%2A#p1551) that since tenpy version 0.9.0 you have to explicitly include the argument for orthogonal states. So I replaced the “dmrg.run(psi, M, dmrg_params)” line with “dmrg.run(psi, M, dmrg_params, orthogonal_to=states)”, and now I'm able to calculate excited states!
Post Reply