Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 28 additions & 58 deletions src/algorithms/contractions/ctmrg_contractions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ Contract the enlarged southwest corner of the CTMRG environment, either by speci
coordinates, environments and network, or by directly providing the tensors.

```
| |
| |
E_west -- A --
| |
C_southwest -- E_south --
| |
C_southwest -- E_south --
```
"""
function enlarge_southwest_corner(
Expand Down Expand Up @@ -301,7 +301,7 @@ The environment can also be contracted directly from all its constituent tensors

```
C_1 -- E_2 -- E_3 -- C_2
| | | |
| | | |
E_1 -- A_1 -- A_2 -- E_4
| | | |
```
Expand All @@ -310,7 +310,7 @@ Alternatively, contract the environment with a vector `x` acting on it

```
C_1 -- E_2 -- E_3 -- C_2
| | | |
| | | |
E_1 -- A_1 -- A_2 -- E_4
| | | |
[~~~x~~~~]
Expand Down Expand Up @@ -452,7 +452,7 @@ The environment can also be contracted directly from all its constituent tensors

```
C_1 -- E_2 -- E_3 -- C_2
| | | |
| | | |
E_1 -- A_1 -- A_2 -- E_4
| | | |
| |
Expand All @@ -466,7 +466,7 @@ Alternatively, contract the environment with a vector `x` acting on it

```
C_1 -- E_2 -- E_3 -- C_2
| | | |
| | | |
E_1 -- A_1 -- A_2 -- E_4
| | | |
| |
Expand Down Expand Up @@ -890,7 +890,7 @@ Alternatively, provide the constituent tensors and perform the complete contract

```
|~~~~~~~| -- E_north -- C_northeast
-- |P_right| | |
-- |P_right| | |
|~~~~~~~| -- A -- E_east
| |
[~~~~~P_left~~~~~]
Expand Down Expand Up @@ -1067,7 +1067,7 @@ end

Apply bottom projector to southwest corner and south edge.
```
|
|
[P_bottom]
| |
C -- E -- in
Expand Down Expand Up @@ -1108,10 +1108,10 @@ end

Apply top projector to northwest corner and north edge.
```
C -- E --
C -- E --
| |
[~P_top~]
|
|
```
"""
function renormalize_top_corner((row, col), env::CTMRGEnv, projectors)
Expand Down Expand Up @@ -1149,9 +1149,9 @@ Absorb a local effective tensor `A` into the north edge using the given projecto
environment tensors.

```
|~~~~~~| -- E_north -- |~~~~~~~|
|~~~~~~| -- E_north -- |~~~~~~~|
-- |P_left| | |P_right| --
|~~~~~~| -- A -- |~~~~~~~|
|~~~~~~| -- A -- |~~~~~~~|
|
```
"""
Expand All @@ -1165,20 +1165,9 @@ function renormalize_north_edge(
network[row, col], # so here it's fine
)
end
function renormalize_north_edge(
E_north::CTMRG_PEPS_EdgeTensor, P_left, P_right, A::PEPSSandwich
)
out = @autoopt @tensor edge[χ_W D_Sab D_Sbe; χ_E] :=
E_north[χ1 D1 D2; χ2] *
ket(A)[d; D1 D3 D_Sab D5] *
conj(bra(A)[d; D2 D4 D_Sbe D6]) *
P_left[χ2 D3 D4; χ_E] *
P_right[χ_W; χ1 D5 D6]
return out
end
function renormalize_north_edge(E_north::CTMRG_PF_EdgeTensor, P_left, P_right, A::PFTensor)
return @autoopt @tensor edge[χ_W D_S; χ_E] :=
E_north[χ1 D1; χ2] * A[D5 D_S; D1 D3] * P_left[χ2 D3; χ_E] * P_right[χ_W; χ1 D5]
function renormalize_north_edge(E_north, P_left, P_right, A)
A_west = _rotl90_localsandwich(A)
return renormalize_west_edge(E_north, P_left, P_right, A_west)
end

"""
Expand Down Expand Up @@ -1208,19 +1197,9 @@ function renormalize_east_edge(
network[row, col],
)
end
function renormalize_east_edge(
E_east::CTMRG_PEPS_EdgeTensor, P_bottom, P_top, A::PEPSSandwich
)
return @autoopt @tensor edge[χ_N D_Wab D_Wbe; χ_S] :=
E_east[χ1 D1 D2; χ2] *
ket(A)[d; D5 D1 D3 D_Wab] *
conj(bra(A)[d; D6 D2 D4 D_Wbe]) *
P_bottom[χ2 D3 D4; χ_S] *
P_top[χ_N; χ1 D5 D6]
end
function renormalize_east_edge(E_east::CTMRG_PF_EdgeTensor, P_bottom, P_top, A::PFTensor)
return @autoopt @tensor edge[χ_N D_W; χ_S] :=
E_east[χ1 D1; χ2] * A[D_W D3; D5 D1] * P_bottom[χ2 D3; χ_S] * P_top[χ_N; χ1 D5]
function renormalize_east_edge(E_east, P_bottom, P_top, A)
A_west = _rot180_localsandwich(A)
return renormalize_west_edge(E_east, P_bottom, P_top, A_west)
end

"""
Expand All @@ -1232,9 +1211,9 @@ environment tensors.

```
|
|~~~~~~~| -- A -- |~~~~~~|
|~~~~~~~| -- A -- |~~~~~~|
-- |P_right| | |P_left| --
|~~~~~~~| -- E_south -- |~~~~~~|
|~~~~~~~| -- E_south -- |~~~~~~|
|
```
"""
Expand All @@ -1248,19 +1227,10 @@ function renormalize_south_edge(
network[row, col],
)
end
function renormalize_south_edge(
E_south::CTMRG_PEPS_EdgeTensor, P_left, P_right, A::PEPSSandwich
)
return @autoopt @tensor edge[χ_E D_Nab D_Nbe; χ_W] :=
E_south[χ1 D1 D2; χ2] *
ket(A)[d; D_Nab D5 D1 D3] *
conj(bra(A)[d; D_Nbe D6 D2 D4]) *
P_left[χ2 D3 D4; χ_W] *
P_right[χ_E; χ1 D5 D6]
end
function renormalize_south_edge(E_south::CTMRG_PF_EdgeTensor, P_left, P_right, A::PFTensor)
return @autoopt @tensor edge[χ_E D_N; χ_W] :=
E_south[χ1 D1; χ2] * A[D3 D1; D_N D5] * P_left[χ2 D3; χ_W] * P_right[χ_E; χ1 D5]

function renormalize_south_edge(E_south, P_left, P_right, A)
A_west = _rotr90_localsandwich(A)
return renormalize_west_edge(E_south, P_left, P_right, A_west)
end

"""
Expand All @@ -1274,7 +1244,7 @@ environment tensors.
|
[~P_bottom~]
| |
E_west -- A --
E_west -- A --
| |
[~~P_top~~~]
|
Expand Down Expand Up @@ -1332,7 +1302,7 @@ end
# Gauge fixing contractions
# -------------------------

# corners
# corners

"""
$(SIGNATURES)
Expand All @@ -1341,7 +1311,7 @@ Multiply corner tensor with incoming and outgoing gauge signs.

```
corner -- σ_out --
|
|
σ_in
|
```
Expand Down
43 changes: 43 additions & 0 deletions test/ctmrg/unitcell.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,47 @@ end
chis = [Venv Venv; Venv Venv]

test_unitcell(ctm_alg, unitcell, Pspaces, Nspaces, Nspaces, chis, chis, chis, chis)

# 4x4 unit cell with all 32 inequivalent bonds
#
# 10 4 7 32
# | | | |
# 3--A--1--B--5--C--8--D--3
# | | | |
# 2 6 9 11
# | | | |
# 14--E-12--F-15--G-17--H-14
# | | | |
# 13 16 18 19
# | | | |
# 22--I-20--J-23--K-25--L-22
# | | | |
# 21 24 26 27
# | | | |
# 29--M-28--N-30--O-31--P-29
# | | | |
# 10 4 7 32

phys_space = Vect[U1Irrep](1 => 1, -1 => 1)
corner_space = Vect[U1Irrep](0 => 1, 1 => 1, -1 => 1)
vspaces = map(i -> Vect[U1Irrep](0 => 1 + i % 4, 1 => i ÷ 4 % 4, -2 => i ÷ 16), 1:32)
@test length(Set(vspaces)) == 32

Espaces = [
vspaces[1] vspaces[5] vspaces[8] vspaces[3]
vspaces[12] vspaces[15] vspaces[17] vspaces[14]
vspaces[20] vspaces[23] vspaces[25] vspaces[22]
vspaces[28] vspaces[30] vspaces[31] vspaces[29]
]

Nspaces = [
vspaces[10] vspaces[4] vspaces[7] vspaces[32]
vspaces[2] vspaces[6] vspaces[9] vspaces[11]
vspaces[13] vspaces[16] vspaces[18] vspaces[19]
vspaces[21] vspaces[24] vspaces[26] vspaces[27]
]
Pspaces = fill(phys_space, (4, 4))
chis = fill(corner_space, (4, 4))

test_unitcell(ctm_alg, unitcell, Pspaces, Nspaces, Nspaces, chis, chis, chis, chis)
end
Loading