# Translational invariance not respected by TDVP algorithm

**URL:** <https://itensor.discourse.group/t/translational-invariance-not-respected-by-tdvp-algorithm/1344>\
**Category:** ITensor Julia Questions\
**Tags:** julia\
**Created:** [December 8, 2023, 4:23pm UTC](https://itensor.discourse.group/t/translational-invariance-not-respected-by-tdvp-algorithm/1344 "2023-12-08T16:23:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![saveboci](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/saveboci/32/362_2.png) [@saveboci](https://itensor.discourse.group/u/saveboci)\
**Post date:** [December 8, 2023, 4:23pm UTC](https://itensor.discourse.group/t/translational-invariance-not-respected-by-tdvp-algorithm/1344/1 "2023-12-08T16:23:10Z")

</div>

Hi ITensor community,

I am trying to study the real-time evolution of a system with periodic boundary conditions starting from a homogeneous state. For concreteness, let’s consider time evolution under a nearest-neighbour transverse-field Ising Hamiltonian starting form the state where all the spins are aligned along the nearest-neighbour interaction axis.  
I read on the forum that, for simple models, the built-in `OpSum` should be able to correctly construct the pbc Hamiltonian. I have also read that the suggested algorithm for real-time evolution is TDVP.

The problem that I am encountering is that the translational invariance of the initial state is lost during time evolution (this problem becomes particularly pronounced for large times, though its manifestation is evident right from the initial stages). This can be seen by looking at the magnetisation profile \langle \sigma^z\_\ell\rangle.  
I have compared the TDVP time evolution with TEBD time evolution and the latter preserves translational invariance quite well (with the same values of time step, bond dimension and cutoff). I suspect that there is a way to make TDVP also work, but I could not find it, so I am reaching out to inquire if someone knows a potential remedy for this issue.

Thank you!!

Here is the example code upon which I have based my claims:

```julia
using ITensors
using ITensorTDVP

# ==============================================================================
# TDVP FOR ISING
# ==============================================================================

function H_ising(sites, h=2)
    N = length(sites)    
    os = OpSum()
    for j in 1:(N - 1)
        os += 1, "X", j, "X", j + 1
        os += h, "Z", j
    end
    os += 1, "X", 1, "X", N
    os += h, "Z", N
    return MPO(os, sites)
end

N = 12
sites = siteinds("S=1/2", N)
ψ0 = productMPS(sites, n -> "X+")
H = H_ising(sites)

dt = 0.01
Nsteps = 100
χ = 50

tdvp_kwargs = (time_step=-1im*dt, normalize=false, maxdim=χ, cutoff=1.0e-10)

ψ_tdvp = tdvp(H, ψ0, -1im * dt * Nsteps; tdvp_kwargs)

@show magn_tdvp = expect(ψ_tdvp, "Sz");

# ==============================================================================
# COMPARISON WITH TEBD
# ==============================================================================

function TEBD_ising(psi, cutoff, bond_dim_max, tau, Nsteps, h=2)        
    siti = siteinds(psi)
    LL = length(psi)
        
    gates = ITensor[] 
    for j=1:LL-1
        s0 = siti[j]
        s1 = siti[j+1]

        term1a = op("X",s0) * op("X",s1) 
        term2a = h * op("Z",s0) * op("Id",s1) 
        
        hj = term1a + term2a
        Gj = exp(-1.0im * tau/2 * hj)
        push!(gates,Gj)
    end

    term1a = op("X", siti[1]) * op("X", siti[end]) 
    term2a = h * op("Id", siti[1]) * op("Z", siti[LL]) 
    hj = term1a + term2a
    Gj = exp(-1.0im * tau/2 * hj)
    push!(gates,Gj)
    
    append!(gates, reverse(gates));
    
    for step in 1:Nsteps
        psi = apply(gates, psi; cutoff=cutoff, maxdim = bond_dim_max) 
    end
    
    psi
end

ψ_tebd = TEBD_ising(ψ0, 1E-10, χ, dt, Nsteps);

@show magn_tebd = expect(ψ_tebd, "Sz");

```

---

<div class="post-metadata">

**Author:** ![saveboci](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/saveboci/32/362_2.png) [@saveboci](https://itensor.discourse.group/u/saveboci)\
**Post date:** [January 12, 2024, 1:29pm UTC](https://itensor.discourse.group/t/translational-invariance-not-respected-by-tdvp-algorithm/1344/2 "2024-01-12T13:29:29Z")

</div>

Update:

The issue can be solved artificially increasing the bond dimension of the initial state. I understand now that this is a well known trick used in this kind of algorithms.

However one question remains: the issue is solved only if the (artificial) bond dimension of the initial state is set equal to the max bond dimension of the final state. If the former is e.g. 30 and the latter is 40, translational invariance is again lost. I do not really understand if there is a specific reason the 2TDVP cannot increase the bond dimension without making errors here (I guess the important info is projected out, but I wonder if there is a more precise argument).

---

<div class="post-metadata">

**Author:** ![mtfishman](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/mtfishman/32/11_2.png) [@mtfishman](https://itensor.discourse.group/u/mtfishman)\
**Post date:** [January 12, 2024, 2:06pm UTC](https://itensor.discourse.group/t/translational-invariance-not-respected-by-tdvp-algorithm/1344/3 "2024-01-12T14:06:04Z")

</div>

You could try the global subspace expansion being developed in this PR: [Basis extension method by emstoudenmire · Pull Request #24 · ITensor/ITensorTDVP.jl · GitHub](https://github.com/ITensor/ITensorTDVP.jl/pull/24)

---

<div class="post-metadata">

**Author:** ![mtfishman](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/mtfishman/32/11_2.png) [@mtfishman](https://itensor.discourse.group/u/mtfishman)\
**Post date:** [January 12, 2024, 2:06pm UTC](https://itensor.discourse.group/t/translational-invariance-not-respected-by-tdvp-algorithm/1344/4 "2024-01-12T14:06:45Z")

</div>

Also you can try using TEBD for the initial time evolution and then switch to TDVP.

---

<div class="post-metadata">

**Author:** ![saveboci](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/saveboci/32/362_2.png) [@saveboci](https://itensor.discourse.group/u/saveboci)\
**Post date:** [January 22, 2024, 11:53am UTC](https://itensor.discourse.group/t/translational-invariance-not-respected-by-tdvp-algorithm/1344/5 "2024-01-22T11:53:52Z")

</div>

Hi Matt, thanks a lot for your suggestions.

I’m checking out the global subspace expansion in the PR you mentioned. It seems to do exactly what I need (I have also read the related paper), however I’m having some troubles making it work. As you point out in the related comments section, the function `expand` and `basis_expand` rely on `directsum_itensors`, which is outdated. This results in the functions `expand` and `basis_expand` not passing the tests in `tests_basis_extend.jl`. So I was wondering: should I activate a specific environment in which the tests are passed? (Maybe an environment that runs an older version of `ITensors.jl`…) or is there any other workaround?

Thanks a lot again!

---

<div class="post-metadata">

**Author:** ![mtfishman](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/mtfishman/32/11_2.png) [@mtfishman](https://itensor.discourse.group/u/mtfishman)\
**Post date:** [January 22, 2024, 1:35pm UTC](https://itensor.discourse.group/t/translational-invariance-not-respected-by-tdvp-algorithm/1344/6 "2024-01-22T13:35:22Z")

</div>

From the comments, it seems like Miles tested replacing `directsum_itensors` but didn’t update the PR.

@miles what’s that status of that? It seems like we should update that PR and get it merged.
