Skip to content

max_virtualspaces throw ArgumentError: Sector has negative dimension #285

@ZongYongyue

Description

@ZongYongyue

For large size systems, max_virtualspaces will throw ArgumentError: Sector has negative dimension but it is fine in small size systems.

using TensorKit
using MPSKit
using DynamicalCorrelators: hubbard

#small size system
julia> H = hubbard(Float64, SU2Irrep, U1Irrep, FiniteStrip(2,4);t=1,U=8);
julia> max_virtualspaces(physicalspace(H))
5-element Vector{GradedSpace{ProductSector{Tuple{FermionParity, SU2Irrep, U1Irrep}}, TensorKit.SortedVectorDict{ProductSector{Tuple{FermionParity, SU2Irrep, U1Irrep}}, Int64}}}:
 Vect[(FermionParity  Irrep[SU₂]  Irrep[U₁])]((0, 0, 0)=>1)
 Vect[(FermionParity  Irrep[SU₂]  Irrep[U₁])]((1, 1/2, 0)=>1, (0, 0, 1)=>1, (0, 0, -1)=>1)
 Vect[(FermionParity  Irrep[SU₂]  Irrep[U₁])]((0, 0, 0)=>3, (0, 1, 0)=>1, (1, 1/2, 1)=>2, (1, 1/2, -1)=>2, (0, 0, 2)=>1, (0, 0, -2)=>1)
 Vect[(FermionParity  Irrep[SU₂]  Irrep[U₁])]((1, 1/2, 0)=>1, (0, 0, 1)=>1, (0, 0, -1)=>1)
 Vect[(FermionParity  Irrep[SU₂]  Irrep[U₁])]((0, 0, 0)=>1)

#lage size system 
julia> H = hubbard(elt, SU2Irrep, U1Irrep, FiniteStrip(8,192);t=1,U=8);
julia> max_virtualspaces(physicalspace(H))
ERROR: ArgumentError: Sector (FermionParity(1)  Irrep[SU₂](1/2)  Irrep[U₁](1)) has negative dimension -3252704806379397616
Stacktrace:
 [1] GradedSpace{ProductSector{Tuple{…}}, TensorKit.SortedVectorDict{ProductSector{…}, Int64}}(dims::TensorKit.SortedVectorDict{ProductSector{Tuple{…}}, Int64}; dual::Bool)
   @ TensorKit ~/.julia/packages/TensorKit/hkxhv/src/spaces/gradedspace.jl:55
 [2] GradedSpace
   @ ~/.julia/packages/TensorKit/hkxhv/src/spaces/gradedspace.jl:50 [inlined]
 [3] fuse(V₁::GradedSpace{ProductSector{…}, TensorKit.SortedVectorDict{…}}, V₂::GradedSpace{ProductSector{…}, TensorKit.SortedVectorDict{…}})
   @ TensorKit ~/.julia/packages/TensorKit/hkxhv/src/spaces/gradedspace.jl:167
 [4] max_virtualspaces(Ps::Vector{…}; left::GradedSpace{…}, right::GradedSpace{…})
   @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/states/finitemps.jl:398
 [5] max_virtualspaces(Ps::Vector{GradedSpace{ProductSector{Tuple{FermionParity, SU2Irrep, U1Irrep}}, TensorKit.SortedVectorDict{ProductSector{Tuple{}}, Int64}}})
   @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/states/finitemps.jl:392
 [6] top-level scope
   @ REPL[54]:1

It should have nothing to do with the way the Hamiltonian is defined. I also encounter this error when using hubbard_model in MPSKitModels.

using TensorKit
using MPSKit
using MPSKitModels:hubbard_model
julia> H2 = hubbard_model(Float64, U1Irrep, U1Irrep,FiniteStrip(8, 192);t=1,U=8);
julia> max_virtualspaces(physicalspace(H2))
ERROR: ArgumentError: Sector (FermionParity(0)  Irrep[U₁](30)  Irrep[U₁](0)) has negative dimension -7897609303118766016
Stacktrace:
 [1] GradedSpace{ProductSector{Tuple{…}}, TensorKit.SortedVectorDict{ProductSector{…}, Int64}}(dims::TensorKit.SortedVectorDict{ProductSector{Tuple{…}}, Int64}; dual::Bool)
   @ TensorKit ~/.julia/packages/TensorKit/hkxhv/src/spaces/gradedspace.jl:55
 [2] GradedSpace
   @ ~/.julia/packages/TensorKit/hkxhv/src/spaces/gradedspace.jl:50 [inlined]
 [3] fuse(V₁::GradedSpace{ProductSector{…}, TensorKit.SortedVectorDict{…}}, V₂::GradedSpace{ProductSector{…}, TensorKit.SortedVectorDict{…}})
   @ TensorKit ~/.julia/packages/TensorKit/hkxhv/src/spaces/gradedspace.jl:167
 [4] max_virtualspaces(Ps::Vector{…}; left::GradedSpace{…}, right::GradedSpace{…})
   @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/states/finitemps.jl:398
 [5] max_virtualspaces(Ps::Vector{GradedSpace{ProductSector{Tuple{FermionParity, U1Irrep, U1Irrep}}, TensorKit.SortedVectorDict{ProductSector{Tuple{}}, Int64}}})
   @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/states/finitemps.jl:392
 [6] top-level scope
   @ REPL[57]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions