Skip to content

Commit be79b03

Browse files
committed
Fix and tests fermionic PBC
1 parent 83cf3e6 commit be79b03

File tree

3 files changed

+76
-4
lines changed

3 files changed

+76
-4
lines changed

src/algorithms/toolbox.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,11 @@ function periodic_boundary_conditions(mpo::InfiniteMPO{O},
274274
F_left = i == 1 ? cup : F_right
275275
F_right = i == L ? cup :
276276
isomorphism(ST, V_right V_wrap' * right_virtualspace(mpo, i))
277+
# account for fermionic boundary conditions
278+
o = i == L ? twist(mpo[i], 4) : mpo[i]
277279
@plansor output[i][-1 -2; -3 -4] = F_left[-1; 1 2] *
278280
τ[-3 1; 4 3] *
279-
mpo[i][2 -2; 3 5] *
281+
o[2 -2; 3 5] *
280282
conj(F_right[-4; 4 5])
281283
end
282284

@@ -421,7 +423,9 @@ function periodic_boundary_conditions(H::InfiniteMPOHamiltonian, L=length(H))
421423
F_left = fusers[end][j, k, chi]
422424
k′ = indmap[j, k, chi]
423425
k′ == size(output[end], 1) && continue
424-
@plansor o[-1 -2; -3 -4] := F_left[-1; 1 2 6] * h[1 3; -3 4] * τ[3 2; 4 5] *
426+
# 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] *
425429
τ[5 6; -4 -2]
426430
output[end][k′, 1, 1, 1] = o
427431
end

test/algorithms.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,13 +759,24 @@ end
759759

760760
@testset "periodic boundary conditions" begin
761761
Hs = [transverse_field_ising(), heisenberg_XXX(), classical_ising(), sixvertex()]
762-
for N in 2:6
762+
for N in 2:5
763763
for H in Hs
764764
TH = convert(TensorMap, periodic_boundary_conditions(H, N))
765765
@test TH
766766
permute(TH, ((vcat(N, 1:(N - 1))...,), (vcat(2N, (N + 1):(2N - 1))...,)))
767767
end
768768
end
769+
770+
# fermionic tests
771+
for N in 3:5
772+
h = real(c_plusmin() + c_minplus())
773+
H = InfiniteMPOHamiltonian([space(h, 1)], (1, 2) => h)
774+
H_periodic = periodic_boundary_conditions(H, N)
775+
terms = [(i, i + 1) => h for i in 1:(N - 1)]
776+
push!(terms, (1, N) => -h)
777+
H_periodic2 = FiniteMPOHamiltonian(physicalspace(H_periodic), terms)
778+
@test H_periodic H_periodic2
779+
end
769780
end
770781

771782
@testset "TaylorCluster time evolution" begin

test/setup.jl

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ using Combinatorics: permutations
1313

1414
# exports
1515
export S_xx, S_yy, S_zz, S_x, S_y, S_z
16+
export c_plusmin, c_minplus, c_number
1617
export force_planar
1718
export symm_mul_mpo
18-
export transverse_field_ising, heisenberg_XXX, bilinear_biquadratic_model, XY_model
19+
export transverse_field_ising, heisenberg_XXX, bilinear_biquadratic_model, XY_model,
20+
kitaev_model
1921
export classical_ising, finite_classical_ising, sixvertex
2022

2123
# using TensorOperations
@@ -224,6 +226,61 @@ function bilinear_biquadratic_model(::Type{SU2Irrep}; θ=atan(1 / 3), L=Inf)
224226
end
225227
end
226228

229+
function c_plusmin()
230+
P = Vect[FermionParity](0 => 1, 1 => 1)
231+
t = zeros(ComplexF64, P^2 P^2)
232+
I = sectortype(P)
233+
t[(I(1), I(0), dual(I(0)), dual(I(1)))] .= 1
234+
return t
235+
end
236+
237+
function c_minplus()
238+
P = Vect[FermionParity](0 => 1, 1 => 1)
239+
t = zeros(ComplexF64, P^2 P^2)
240+
I = sectortype(t)
241+
t[(I(0), I(1), dual(I(1)), dual(I(0)))] .= 1
242+
return t
243+
end
244+
245+
function c_plusplus()
246+
P = Vect[FermionParity](0 => 1, 1 => 1)
247+
t = zeros(ComplexF64, P^2 P^2)
248+
I = sectortype(t)
249+
t[(I(1), I(1), dual(I(0)), dual(I(0)))] .= 1
250+
return t
251+
end
252+
253+
function c_minmin()
254+
P = Vect[FermionParity](0 => 1, 1 => 1)
255+
t = zeros(ComplexF64, P^2 P^2)
256+
I = sectortype(t)
257+
t[(I(0), I(0), dual(I(1)), dual(I(1)))] .= 1
258+
return t
259+
end
260+
261+
function c_number()
262+
P = Vect[FermionParity](0 => 1, 1 => 1)
263+
t = zeros(ComplexF64, P P)
264+
block(t, fℤ₂(1)) .= 1
265+
return t
266+
end
267+
268+
function kitaev_model(; t=1.0, mu=1.0, Delta=1.0, L=Inf)
269+
TB = scale!(c_plusmin() + c_minplus(), -t / 2) # tight-binding term
270+
SC = scale!(c_plusplus() + c_minmin(), Delta / 2) # superconducting term
271+
CP = scale!(c_number(), -mu) # chemical potential term
272+
273+
if L == Inf
274+
lattice = PeriodicArray([space(TB, 1)])
275+
return InfiniteMPOHamiltonian(lattice, (1, 2) => TB + SC, (1,) => CP)
276+
else
277+
lattice = fill(space(TB, 1), L)
278+
terms = Iterators.flatten((((i, i + 1) => TB + SC for i in 1:(L - 1)),
279+
(i,) => CP for i in 1:L))
280+
return FiniteMPOHamiltonian(lattice, terms)
281+
end
282+
end
283+
227284
function ising_bond_tensor(β)
228285
t = [exp(β) exp(-β); exp(-β) exp(β)]
229286
r = eigen(t)

0 commit comments

Comments
 (0)