Skip to content

Commit

Permalink
Fix :sequential for rectangular unit cells, fix tf_ising test
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrehmer committed Jan 20, 2025
1 parent 50c76f4 commit a0178b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/algorithms/ctmrg/sequential.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ function ctmrg_iteration(state, envs::CTMRGEnv, alg::SequentialCTMRG)
truncation_error = max(truncation_error, err)
condition_number = max(condition_number, cond)
for row in 1:size(state, 1)
U[dir, row, col] = U′[row]
S[dir, row, col] = S′[row]
V[dir, row, col] = V′[row]
rc_idx = isodd(dir) ? (row, col) : (col, row) # relevant for rectangular unit cells
U[dir, rc_idx...] = U′[row]
S[dir, rc_idx...] = S′[row]
V[dir, rc_idx...] = V′[row]
end

Check warning on line 50 in src/algorithms/ctmrg/sequential.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/ctmrg/sequential.jl#L43-L50

Added lines #L43 - L50 were not covered by tests
end
state = rotate_north(state, EAST)
Expand Down
3 changes: 2 additions & 1 deletion test/ctmrg/gaugefix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ using PEPSKit: ctmrg_iteration, gauge_fix, calc_elementwise_convergence

spacetypes = [ComplexSpace, Z2Space]
scalartypes = [Float64, ComplexF64]
unitcells = [(1, 1), (2, 2), (3, 2)]
# unitcells = [(1, 1), (2, 2), (3, 2)]
unitcells = [(3, 2)]
ctmrg_algs = [SequentialCTMRG, SimultaneousCTMRG]
projector_algs = [HalfInfiniteProjector, FullInfiniteProjector]
tol = 1e-6 # large tol due to χ=6
Expand Down
4 changes: 2 additions & 2 deletions test/tf_ising.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ peps, env, E, = fixedpoint(psi_init, H, opt_alg, env_init)
# compute magnetization
σx = TensorMap(scalartype(psi_init)[0 1; 1 0], ℂ^2, ℂ^2)
M = LocalOperator(H.lattice, (CartesianIndex(1, 1),) => σx)
magn = expectation_value(result.peps, M, result.env)
magn = expectation_value(peps, M, env)

@test E e atol = 1e-2
@test imag(magn) 0 atol = 1e-6
Expand All @@ -43,6 +43,6 @@ magn = expectation_value(result.peps, M, result.env)
# find fixedpoint in polarized phase and compute correlations lengths
H_polar = transverse_field_ising(InfiniteSquare(); g=4.5)
peps_polar, env_polar, E_polar, = fixedpoint(psi_init, H_polar, opt_alg, env_init)
ξ_h_polar, ξ_v_polar, = correlation_length(result_polar.peps, result_polar.env)
ξ_h_polar, ξ_v_polar, = correlation_length(peps_polar, env_polar)
@test ξ_h_polar < ξ_h
@test ξ_v_polar < ξ_v

0 comments on commit a0178b5

Please sign in to comment.