|
| 1 | +#= |
| 2 | +The construction of bond environment for Neighborhood Tensor Update (NTU) |
| 3 | +is adapted from YASTN (https://github.com/yastn/yastn). |
| 4 | +Copyright 2024 The YASTN Authors. All Rights Reserved. |
| 5 | +Licensed under the Apache License, Version 2.0 |
| 6 | +=# |
| 7 | + |
| 8 | +""" |
| 9 | +Algorithms to construct bond environment for Neighborhood Tensor Update (NTU). |
| 10 | +""" |
| 11 | +abstract type NeighbourEnv end |
| 12 | + |
| 13 | +""" |
| 14 | +Construct the "NTU-NN" bond environment. |
| 15 | +``` |
| 16 | + (-1 +0)══(-1 +1) |
| 17 | + ║ ║ |
| 18 | + (+0 -1)═════X══ ═══Y═══(+0 +2) |
| 19 | + ║ ║ |
| 20 | + (+1 +0)══(+1 +1) |
| 21 | +``` |
| 22 | +""" |
| 23 | +struct NNEnv <: NeighbourEnv end |
| 24 | +""" |
| 25 | +Calculate the bond environment within "NTU-NN" approximation. |
| 26 | +""" |
| 27 | +function bondenv_ntu( |
| 28 | + row::Int, col::Int, X::T, Y::T, state::S, alg::NNEnv |
| 29 | + ) where {T <: StateTensor, S <: InfinitePEPS} |
| 30 | + neighbors = [(-1, 0), (0, -1), (1, 0), (1, 1), (0, 2), (-1, 1)] |
| 31 | + m = collect_neighbors(state, row, col, neighbors) |
| 32 | + #= contraction indices |
| 33 | +
|
| 34 | + (-1 +0) ══ Dn ══ (-1 +1) |
| 35 | + ║ ║ |
| 36 | + ........Dnw...... Dne |
| 37 | + ║ : ║ |
| 38 | + (+0 -1) ═══ X ══ Dw : De ══ Y ═══ (+0 +2) |
| 39 | + ║ : ║ |
| 40 | + Dsw :.......Dse........ |
| 41 | + ║ ║ |
| 42 | + (+1 +0) ══ Ds ══ (+1 +1) |
| 43 | + =# |
| 44 | + # bottom-left half |
| 45 | + @autoopt @tensor benv_sw[Dse1 Dse0 Dw1 Dw0 Dnw1 Dnw0] := |
| 46 | + cor_se(m[1, 1])[Dse1 Dse0 Ds1 Ds0] * |
| 47 | + cor_sw(m[1, 0])[Dsw1 Dsw0 Ds1 Ds0] * |
| 48 | + edge_w(X, hair_w(m[0, -1]))[Dnw1 Dnw0 Dw1 Dw0 Dsw1 Dsw0] |
| 49 | + normalize!(benv_sw, Inf) |
| 50 | + # top-right half |
| 51 | + @autoopt @tensor benv_ne[Dnw1 Dnw0 De1 De0 Dse1 Dse0] := |
| 52 | + cor_nw(m[-1, 0])[Dn1 Dn0 Dnw1 Dnw0] * |
| 53 | + cor_ne(m[-1, 1])[Dne1 Dne0 Dn1 Dn0] * |
| 54 | + edge_e(Y, hair_e(m[0, 2]))[Dne1 Dne0 Dse1 Dse0 De1 De0] |
| 55 | + normalize!(benv_ne, Inf) |
| 56 | + @tensor benv[Dw1 De1; Dw0 De0] := |
| 57 | + benv_sw[Dse1 Dse0 Dw1 Dw0 Dnw1 Dnw0] * benv_ne[Dnw1 Dnw0 De1 De0 Dse1 Dse0] |
| 58 | + normalize!(benv, Inf) |
| 59 | + return benv |
| 60 | +end |
| 61 | + |
| 62 | +""" |
| 63 | +Construct the "NTU-NN+" bond environment. |
| 64 | +``` |
| 65 | + (-2 +0)┈┈(-2 +1) |
| 66 | + ║ ║ |
| 67 | + (-1 -1)┈(-1 +0)══(-1 +1)┈(-1 +2) |
| 68 | + ┊ ║ ║ ┊ |
| 69 | + (+0 -2)=(+0 -1)═════X══ ═══Y═══(+0 +2)=(+0 +3) |
| 70 | + ┊ ║ ║ ┊ |
| 71 | + (+1 -1)┈(+1 +0)══(+1 +1)┈(+1 +2) |
| 72 | + ║ ║ |
| 73 | + (+2 +0)┈┈(+2 +1) |
| 74 | +``` |
| 75 | +The tensors connected with dotted lines (e.g. (-1 +2)) |
| 76 | +are splitted into two hair tensors. |
| 77 | +""" |
| 78 | +struct NNpEnv <: NeighbourEnv end |
| 79 | +""" |
| 80 | +Calculate the bond environment within "NTU-NN+" approximation. |
| 81 | +""" |
| 82 | +function bondenv_ntu( |
| 83 | + row::Int, col::Int, X::T, Y::T, state::S, alg::NNpEnv |
| 84 | + ) where {T <: StateTensor, S <: InfinitePEPS} |
| 85 | + neighbors = [ |
| 86 | + (-1, -1), (0, -1), (1, -1), (1, 0), (1, 1), (1, 2), (0, 2), (-1, 2), |
| 87 | + (-1, 1), (-1, 0), (0, -2), (2, 0), (2, 1), (0, 3), (-2, 1), (-2, 0), |
| 88 | + ] |
| 89 | + m = collect_neighbors(state, row, col, neighbors) |
| 90 | + error("To be implemented.") |
| 91 | +end |
| 92 | + |
| 93 | +""" |
| 94 | +Construct the "NTU-NNN" bond environment. |
| 95 | +``` |
| 96 | + (-1 -1)=(-1 +0)══(-1 +1)=(-1 +2) |
| 97 | + ║ ║ ║ ║ |
| 98 | + (+0 -1)═════X══ ═══Y═══(+0 +2) |
| 99 | + ║ ║ ║ ║ |
| 100 | + (+1 -1)=(+1 +0)══(+1 +1)=(+1 +2) |
| 101 | +``` |
| 102 | +""" |
| 103 | +struct NNNEnv <: NeighbourEnv end |
| 104 | +""" |
| 105 | +Calculates the bond environment within "NTU-NNN" approximation. |
| 106 | +""" |
| 107 | +function bondenv_ntu( |
| 108 | + row::Int, col::Int, X::T, Y::T, state::S, alg::NNNEnv |
| 109 | + ) where {T <: StateTensor, S <: InfinitePEPS} |
| 110 | + neighbors = [ |
| 111 | + (-1, -1), (0, -1), (1, -1), |
| 112 | + (1, 0), (1, 1), (1, 2), (0, 2), |
| 113 | + (-1, 2), (-1, 1), (-1, 0), |
| 114 | + ] |
| 115 | + m = collect_neighbors(state, row, col, neighbors) |
| 116 | + #= left half |
| 117 | + (-1 -1)══════(-1 +0)═ -1/-2 |
| 118 | + ║ ║ |
| 119 | + (+0 -1)════════ X ═══ -3/-4 |
| 120 | + ║ ║ |
| 121 | + ....D1..........D2......... |
| 122 | + ║ ║ |
| 123 | + (+1 -1)═ D3 ═(+1 +0)═ -5/-6 |
| 124 | + =# |
| 125 | + vecl = enlarge_corner_nw(cor_nw(m[-1, -1]), edge_n(m[-1, 0]), edge_w(m[0, -1]), X) |
| 126 | + @tensor vecl[:] := |
| 127 | + cor_sw(m[1, -1])[D11 D10 D31 D30] * |
| 128 | + edge_s(m[1, 0])[D21 D20 -5 -6 D31 D30] * |
| 129 | + vecl[D11 D10 D21 D20 -1 -2 -3 -4] |
| 130 | + normalize!(vecl, Inf) |
| 131 | + #= right half |
| 132 | + -1/-2 ══ (-1 +1)═ D1 ═(-1 +2) |
| 133 | + ║ ║ |
| 134 | + ............D2..........D3... |
| 135 | + ║ ║ |
| 136 | + -3/-4 ═════ Y ═══════(+0 +2) |
| 137 | + ║ ║ |
| 138 | + -5/-6 ══ (+1 +1)═════(+1 +2) |
| 139 | + =# |
| 140 | + vecr = enlarge_corner_se(cor_se(m[1, 2]), edge_s(m[1, 1]), edge_e(m[0, 2]), Y) |
| 141 | + @tensor vecr[:] := |
| 142 | + edge_n(m[-1, 1])[D11 D10 D21 D20 -1 -2] * |
| 143 | + cor_ne(m[-1, 2])[D31 D30 D11 D10] * |
| 144 | + vecr[D21 D20 D31 D30 -3 -4 -5 -6] |
| 145 | + normalize!(vecr, Inf) |
| 146 | + # combine left and right part |
| 147 | + @tensor benv[-1 -2; -3 -4] := vecl[1 2 -1 -3 3 4] * vecr[1 2 -2 -4 3 4] |
| 148 | + normalize!(benv, Inf) |
| 149 | + return benv |
| 150 | +end |
0 commit comments