ITensor / ITensor/ITensorMPS.jl

`randomMPS` fails to create states with `linkdim>1` on heterogenous lattice when qns are conserved

Open
#63 1 comment 0 reactions 1 assignee View on GitHub

@emstoudenmire is already working on this.

Since Oct 27, 2021.

Dominant language
Julia
Stars
85
Forks
27
Avg merge
22m
Merged PRs (30d)
1

Description

Basically, if I have a lattice where alternating sites have different sitetypes, randomMPS(s, f; linkdims=k) for k>1 will end up erroring. Here is a MWE:

using ITensors

function ITensors.space(::SiteType"Sf=1/2";
                        conserve_qns=false)
    if conserve_qns
        return [QN("Sz", 1)=>1, QN("Sz",-1)=>1]
    end
    return 2
end

function ITensors.space(::SiteType"Sb=1/2";
                        conserve_qns=false)
    if conserve_qns
        return [QN("Sz", 2)=>1, QN("Sz",-2)=>1]
    end
    return 2
end

ITensors.state(::StateName"Up", ::SiteType"Sf=1/2") = [1.0, 0.0]
ITensors.state(::StateName"Dn", ::SiteType"Sf=1/2") = [0.0, 1.0]

ITensors.state(::StateName"Up", ::SiteType"Sb=1/2") = [1.0, 0.0]
ITensors.state(::StateName"Dn", ::SiteType"Sb=1/2") = [0.0, 1.0]

let 
    N = 4
    s = siteinds(n -> isodd(n) ? "Sf=1/2" : "Sb=1/2", N; conserve_qns=true)               
    ψ = randomMPS(s, n -> isodd(n) ? "Up" : "Dn"; linkdims=4)
end

#+RESULTS:
MPS center bond dim less than requested

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] randomizeMPS!(M::MPS, sites::Vector{Index{Vector{Pair{QN, Int64}}}}, linkdim::Int64)
   @ ITensors ~/.julia/packages/ITensors/XnM47/src/mps/mps.jl:126
 [3] randomMPS(ElType::Type, sites::Vector{Index{Vector{Pair{QN, Int64}}}}, state::Function; linkdims::Int64)
   @ ITensors ~/.julia/packages/ITensors/XnM47/src/mps/mps.jl:213
 [4] #randomMPS#829
   @ ~/.julia/packages/ITensors/XnM47/src/mps/mps.jl:207 [inlined]
 [5] top-level scope
   @ In[7]:28
 [6] eval
   @ ./boot.jl:373 [inlined]
 [7] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196

Important to this example is that Sb=1/2 sites carry a flux of two times greater than Sf=1/2 sites. If they carry the same flux, then the problem disappears.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.