@@ -40,7 +40,12 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG, envs=environments(ost
4040 for pos in 1 : length (ψ)
4141 h = AC_hamiltonian (pos, ψ, H, ψ, envs)
4242 _, ψ. AC[pos] = fixedpoint (h, ψ. AC[pos], :SR , alg_eigsolve)
43- ψ. AL[pos], ψ. C[pos] = leftorth! (ψ. AC[pos])
43+ if pos == length (ψ)
44+ # AC needed in next sweep
45+ ψ. AL[pos], ψ. C[pos] = leftorth (ψ. AC[pos])
46+ else
47+ ψ. AL[pos], ψ. C[pos] = leftorth! (ψ. AC[pos])
48+ end
4449 transfer_leftenv! (envs, ψ, H, ψ, pos + 1 )
4550 end
4651
@@ -124,7 +129,7 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG2, envs=environments(os
124129
125130 # sweep from left to right
126131 for pos in 1 : (length (ψ) - 1 )
127- ac2 = ψ . AC[pos] * _transpose_tail (ψ . AR[ pos + 1 ] )
132+ ac2 = AC2 (ψ, pos; kind = :ACAR )
128133 h_ac2 = AC2_hamiltonian (pos, ψ, H, ψ, envs)
129134 _, ac2′ = fixedpoint (h_ac2, ac2, :SR , alg_eigsolve)
130135
@@ -141,20 +146,22 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG2, envs=environments(os
141146 end
142147
143148 # update the edge
144- @plansor ac2[- 1 - 2 ; - 3 - 4 ] := ψ. AC[end ][- 1 - 2 ; 1 ] * inv (ψ. C[0 ])[1 ; 2 ] *
145- ψ. AL[1 ][2 - 4 ; 3 ] * ψ. C[1 ][3 ; - 3 ]
149+ ψ. AL[end ] = ψ. AC[end ] / ψ. C[end ]
150+ ψ. AC[1 ] = _mul_tail (ψ. AL[1 ], ψ. C[1 ])
151+ ac2 = AC2 (ψ, 0 ; kind= :ALAC )
146152 h_ac2 = AC2_hamiltonian (0 , ψ, H, ψ, envs)
147153 _, ac2′ = fixedpoint (h_ac2, ac2, :SR , alg_eigsolve)
148154
149155 al, c, ar, = tsvd! (ac2′; trunc= alg. trscheme, alg= alg. alg_svd)
150156 normalize! (c)
151157
152- ψ. AC[end ] = al * c
153158 ψ. AL[end ] = al
154159 ψ. C[end ] = complex (c)
155160 ψ. AR[1 ] = _transpose_front (ar)
161+
162+ ψ. AC[end ] = _mul_tail (al, c)
156163 ψ. AC[1 ] = _transpose_front (c * ar)
157- ψ. AL[1 ] = ψ. AC[1 ] * inv ( ψ. C[1 ])
164+ ψ. AL[1 ] = ψ. AC[1 ] / ψ. C[1 ]
158165
159166 C_current = complex (c)
160167
@@ -164,15 +171,15 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG2, envs=environments(os
164171
165172 # sweep from right to left
166173 for pos in (length (ψ) - 1 ): - 1 : 1
167- ac2 = ψ . AL[pos] * _transpose_tail (ψ . AC[ pos + 1 ] )
174+ ac2 = AC2 (ψ, pos; kind = :ALAC )
168175 h_ac2 = AC2_hamiltonian (pos, ψ, H, ψ, envs)
169176 _, ac2′ = fixedpoint (h_ac2, ac2, :SR , alg_eigsolve)
170177
171178 al, c, ar, = tsvd! (ac2′; trunc= alg. trscheme, alg= alg. alg_svd)
172179 normalize! (c)
173180
174181 ψ. AL[pos] = al
175- ψ. AC[pos] = al * c
182+ ψ. AC[pos] = _mul_tail (al, c)
176183 ψ. C[pos] = complex (c)
177184 ψ. AR[pos + 1 ] = _transpose_front (ar)
178185 ψ. AC[pos + 1 ] = _transpose_front (c * ar)
@@ -182,17 +189,19 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG2, envs=environments(os
182189 end
183190
184191 # update the edge
185- @plansor ac2[- 1 - 2 ; - 3 - 4 ] := ψ. C[end - 1 ][- 1 ; 1 ] * ψ. AR[end ][1 - 2 ; 2 ] *
186- inv (ψ. C[end ])[2 ; 3 ] * ψ. AC[1 ][3 - 4 ; - 3 ]
192+ ψ. AC[end ] = _mul_front (ψ. C[end - 1 ], ψ. AR[end ])
193+ ψ. AR[1 ] = _transpose_front (ψ. C[end ] \ _transpose_tail (ψ. AC[1 ]))
194+ ac2 = AC2 (ψ, 0 ; kind= :ACAR )
187195 h_ac2 = AC2_hamiltonian (0 , ψ, H, ψ, envs)
188196 _, ac2′ = fixedpoint (h_ac2, ac2, :SR , alg_eigsolve)
189197 al, c, ar, = tsvd! (ac2′; trunc= alg. trscheme, alg= alg. alg_svd)
190198 normalize! (c)
191199
192- ψ. AR[end ] = _transpose_front (inv (ψ. C[end - 1 ]) * _transpose_tail (al * c))
193200 ψ. AL[end ] = al
194201 ψ. C[end ] = complex (c)
195202 ψ. AR[1 ] = _transpose_front (ar)
203+
204+ ψ. AR[end ] = _transpose_front (ψ. C[end - 1 ] \ _transpose_tail (al * c))
196205 ψ. AC[1 ] = _transpose_front (c * ar)
197206
198207 transfer_leftenv! (envs, ψ, H, ψ, 1 )
0 commit comments