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
12 changes: 6 additions & 6 deletions src/schemes/ctm/sublattice_ctm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function lnz(ctm::Sublattice_CTM)
bottom[4; 5] *
ctm.ElA[5 8; 6] *
ctm.ElB[6 7; 1]
return log(abs(A * B / (C * D)))
return log(abs(A * B / (C * D))) / 4
end

ρA(ctm::Sublattice_CTM) = ctm.Ctl1 * ctm.Ctr1 * ctm.Cbr1 * ctm.Cbl1
Expand All @@ -86,9 +86,9 @@ function CTM_init(TA, TB; bc = ones, bc_free = false)
if bc_free
V = Vps_A[1]
end
C = TensorMap(bc, elt, V ← V)
ElA, EbA, EtA, ErA = [TensorMap(bc, elt, V ⊗ Vps_B[i] ← V) for i in 1:4]
ElB, EbB, EtB, ErB = [TensorMap(bc, elt, V ⊗ Vps_A[i] ← V) for i in 1:4]
C = bc(elt, V ← V)
ElA, EbA, EtA, ErA = [bc(elt, V ⊗ Vps_B[i] ← V) for i in 1:4]
ElB, EbB, EtB, ErB = [bc(elt, V ⊗ Vps_A[i] ← V) for i in 1:4]
return C, C, C, C, C, C, C, C, ElA, ElB, EbA, EbB, ErA, ErB, EtA, EtB
end

Expand Down Expand Up @@ -219,7 +219,7 @@ function run!(
@infov 1 "Starting CTM calculation\n $(ctm)\n"
while crit
ES_new = step!(ctm, trunc)
if space(ES) == space(ES_new)
if size(ES) == size(ES_new)
normdiff = norm(ES - ES_new)
@infov 2 "Step $(steps + 1), |ES - ES_new| = $(normdiff)"
push!(hist, normdiff)
Expand All @@ -236,7 +236,7 @@ function run!(
@infov 1 "CTM reached the maximum iteration $(steps)"
end
end
return hist
return lnz(ctm)
end

function Base.show(io::IO, scheme::Sublattice_CTM)
Expand Down
11 changes: 11 additions & 0 deletions test/schemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,17 @@ end
@test fs ≈ f_onsager rtol = 1.0e-6
end

# Sublattice CTM
@testset "Sublattice_CTM - Ising Model" begin
@info "Sublattice_CTM ising free energy"
scheme = Sublattice_CTM(T, T)

lz = run!(scheme, truncrank(32), maxiter(256))
fs = lz * -1 / ising_βc

@test fs ≈ f_onsager rtol = 1.0e-6
end

# ctm_TRG
@testset "ctm_TRG - Ising Model" begin
@info "ctm_TRG ising free energy"
Expand Down
Loading