Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert(::Type{TensorMap}, H::FiniteMPOHamiltonian) fails #255

Closed
benjamints opened this issue Feb 20, 2025 · 1 comment · Fixed by #256
Closed

convert(::Type{TensorMap}, H::FiniteMPOHamiltonian) fails #255

benjamints opened this issue Feb 20, 2025 · 1 comment · Fixed by #256

Comments

@benjamints
Copy link

Using the Heisenberg Hamiltonian from the test/setup.jl the function convert(::Type{TensorMap}, H::FiniteMPOHamiltonian) fails with AssertionError: iscyclicpermutation(p), see example below:

using MPSKit, TensorKit

function heisenberg_XXX(::Type{SU2Irrep}; spin=1, L=Inf)
    h = ones(ComplexF64, SU2Space(spin => 1)^2  SU2Space(spin => 1)^2)
    for (c, b) in blocks(h)
        S = (dim(c) - 1) / 2
        b .= S * (S + 1) / 2 - spin * (spin + 1)
    end
    scale!(h, 4)

    if L == Inf
        lattice = PeriodicArray([space(h, 1)])
        return InfiniteMPOHamiltonian(lattice, (i, i + 1) => h for i in 1:1)
    else
        lattice = fill(space(h, 1), L)
        return FiniteMPOHamiltonian(lattice, (i, i + 1) => h for i in 1:(L - 1))
    end
end

H = heisenberg_XXX(SU2Irrep; L=4)
h = convert(TensorMap, H)
@lkdvos
Copy link
Member

lkdvos commented Feb 21, 2025

Thanks for reporting as well as providing the breaking example, that helps out a lot for getting things fixed quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants