Skip to content

Commit 4472d37

Browse files
committed
Circumvent unsupported tensorkit feature
1 parent 8bebddc commit 4472d37

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/algorithms/toolbox.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ function periodic_boundary_conditions(mpo::InfiniteMPO{O},
275275
F_right = i == L ? cup :
276276
isomorphism(ST, V_right V_wrap' * right_virtualspace(mpo, i))
277277
# account for fermionic boundary conditions
278-
o = i == L ? twist(mpo[i], 4) : mpo[i]
278+
o = i == L ? _twist(mpo[i], 4) : mpo[i]
279279
@plansor output[i][-1 -2; -3 -4] = F_left[-1; 1 2] *
280280
τ[-3 1; 4 3] *
281281
o[2 -2; 3 5] *
@@ -424,8 +424,8 @@ function periodic_boundary_conditions(H::InfiniteMPOHamiltonian, L=length(H))
424424
k′ = indmap[j, k, chi]
425425
k′ == size(output[end], 1) && continue
426426
# apply twist for fermionic boundary conditions
427-
h = twist(h, 4)
428-
@plansor o[-1 -2; -3 -4] := F_left[-1; 1 2 6] * h[1 3; -3 4] * τ[3 2; 4 5] *
427+
h = _twist(h, 4)
428+
@plansor o[-1 -2; -3 -4] := F_left[-1; 1 2 6] * h[1 3; -3 4] * τ[3 2; 4 5] *
429429
τ[5 6; -4 -2]
430430
output[end][k′, 1, 1, 1] = o
431431
end

src/utility/utility.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ function fuser(::Type{T}, V1::S, V2::S) where {T,S<:IndexSpace}
133133
return isomorphism(T, fuse(V1 V2), V1 V2)
134134
end
135135

136+
# TODO: remove once TensorKit supports this
137+
_twist(t::AbstractTensorMap, i::Int) = _twist(BraidingStyle(t), t, i)
138+
_twist(::SymmetricBraiding, t::AbstractTensorMap, i::Int) = t
139+
function _twist(::NoBraiding, t::AbstractTensorMap, i::Int)
140+
check_ambiguous_braiding(space(t, i))
141+
return t
142+
end
143+
_twist(::BraidingStyle, t::AbstractTensorMap, i::Int) = twist(t, i)
144+
136145
# Verify that the braiding is unambiguous: either through symmetric braiding or because the
137146
# sectors are all trivial
138147
function check_ambiguous_braiding(::Type{Bool}, V::VectorSpace)

0 commit comments

Comments
 (0)