How to use TDVP for one site

How do I use this algorithm? What does that parameter do?
Post Reply
pasa
Posts: 23
Joined: 09 Mar 2020, 12:45

How to use TDVP for one site

Post by pasa »

Dear community,

I am trying to use TDVP on one site. I understand the theory behind the construction and I thought I also understood how to use it in practice. I checked the example code provided by Tenpy developers. My specific problem is that I manage to run the two site TDVP obtaining non-trivial results (e.g., check the evolution of the particle density which for small system size I verified to be correct), but when using one site TDVP, the initial state does not evolve at all. I might be missing something stupid but attending to the documentation I look to be setting it correctly. Could anyone give me a hint? I attach a simple code I used to test the implementation. To change between two and one site TDVP one only needs to change the line eng_H.run_two_sites to eng_H.run_one_site.

Thanks in advance.

Code: Select all

from tenpy.networks.mps import MPS
from tenpy.algorithms import tdvp
from tenpy.models.hubbard import FermiHubbardModel


if __name__ == "__main__":
    

    
    J=1.
    D_bond = 50
    U=3.
    dt=0.01    
    product_state = ['empty','up','empty','down','empty','up','empty','down','empty','up','empty','down','empty']
    L = len(product_state)
    model_params = {'L': L, 'U': U, 't': J,'bc_MPS': 'finite', 'cons_N':'N','cons_Sz':'Sz',  'verbose': 0}
     
    
    print("parameters: ", model_params)
    M = FermiHubbardModel(model_params) 
       
    psi = MPS.from_product_state(M.lat.mps_sites(), product_state, bc=M.lat.bc_MPS)
    

    tdvp_params = {
        'start_time': 0,
        'dt': dt,
        'trunc_params': {
            'chi_max': D_bond,
            'svd_min': 1.e-16,
            'trunc_cut': None
        }}


    eng_H = tdvp.Engine(psi, M, tdvp_params)
    for n in range(30):
        
        eng_H.run_one_site(N_steps=1)        
        print(psi.expectation_value('Ntot'))
User avatar
Johannes
Site Admin
Posts: 413
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: How to use TDVP for one site

Post by Johannes »

Hi Pablo,

The definition of TDVP in the context of MPS means to project the time evolution into the subspace/manifold of MPS at a fixed bond dimension.
Single-Site TDVP is doing exactly that: whatever bond dimension you start with, it will keep that bond dimension. That means when you start from a product state with bond dimension 0, it remains a product state! Needless to say that this is far from the actual evolution if you would do it exactly.
Two-Site TDVP is generalizing this by projecting the time evolution on two sites instead of single site, which allows to dynamically grow the bond dimension.

When you want to use single-site TDVP, you should either
  • start from a state with significant bond dimension (and the charge blocks you expect to be releavant for the time evolution), or
  • use another time evolution method initially to dynamically grow the bond dimension up to a desired limit, at which point you switch to single-site TDVP.
    What other method you use depends on your preferences: it could be any of two-site TDVP, TEBD, ExpMPOEvolution or some other time evolution method we currently don't have in TeNPy....
pasa
Posts: 23
Joined: 09 Mar 2020, 12:45

Re: How to use TDVP for one site

Post by pasa »

Hi Johannes! that makes perfect sense. Let me enter a bit more detail in the problem I am having. I wanted to use single site TDVP such that energy is conserved at all times. Thus I wanted to avoid using TEBD or two-site TDVP.

Updated answer: after talking to Umberto Borla and following your previous answer, it looks like the easiest way to go is to run with two site TDVP while the maximal bond dimension is less than the aimed one, and use one site TDVP once that bond dimension is reached.

Thanks!
pasa
Posts: 23
Joined: 09 Mar 2020, 12:45

Re: How to use TDVP for one site

Post by pasa »

Hi!

It looks like that it would make more sense to use the truncation error for two sites TDVP rather than the maximal bond dimension. However, I am having problems to obtain the truncation error for TDVP. Does it work as for the TEBD engine? The following lines worked for TEBD but give an error for TDVP. I couldn't understand how to use the TruncationError module directly.

Code: Select all

eng = tdvp.Engine(psi, M, tdvp_params)
eng.run_two_sites()
eng.trunc_err.eps
Post Reply