From a0178b54422e1c3135a7796c8134610c17e2954d Mon Sep 17 00:00:00 2001 From: Paul Brehmer Date: Mon, 20 Jan 2025 20:28:33 +0100 Subject: [PATCH] Fix :sequential for rectangular unit cells, fix tf_ising test --- src/algorithms/ctmrg/sequential.jl | 7 ++++--- test/ctmrg/gaugefix.jl | 3 ++- test/tf_ising.jl | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/algorithms/ctmrg/sequential.jl b/src/algorithms/ctmrg/sequential.jl index 7ba5af20..807f4c0e 100644 --- a/src/algorithms/ctmrg/sequential.jl +++ b/src/algorithms/ctmrg/sequential.jl @@ -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 end state = rotate_north(state, EAST) diff --git a/test/ctmrg/gaugefix.jl b/test/ctmrg/gaugefix.jl index 52231498..1b053ff0 100644 --- a/test/ctmrg/gaugefix.jl +++ b/test/ctmrg/gaugefix.jl @@ -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 diff --git a/test/tf_ising.jl b/test/tf_ising.jl index aa4181e8..51276f85 100644 --- a/test/tf_ising.jl +++ b/test/tf_ising.jl @@ -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 @@ -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