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
13 changes: 11 additions & 2 deletions src/models/transfermatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,16 @@ end
"""
qstate_clock([elt::Type{<:Number}=ComplexF64], [symmetry::Type{<:Sector}=Trivial]; beta::Number=1.0, q::Integer=3)

MPO for the partition function of the two-dimensional discrete clock model with ``q`` states.
MPO for the partition function of the two-dimensional discrete clock model with ``q`` states,

```math
\\mathcal{Z}(\\beta) = \\sum_{\\{s\\}} \\exp(-\\beta H(s)) \\text{ with } H(s) = -\\sum_{\\langle i, j \\rangle} \\cos\\left(\\frac{2\\pi (s_i - s_j)}{q}\\right),
```

where each classical spin can take the values ``s = 0, …, q - 1``. The spins live on the
legs of the MPO tensor, which carries the interactions between neighbouring legs
`W - S - E - N - W` (legs ordered as `W ⊗ S ← N ⊗ E`). Every tensor therefore contains two
spins, and the partition function per tensor is the square of the partition function per spin.
"""
function qstate_clock(
elt::Type{<:Number} = ComplexF64, ::Type{Trivial} = Trivial;
Expand All @@ -120,7 +129,7 @@ function qstate_clock(
comega(d) = cos(2 * pi * d / q)
O = zeros(elt, q, q, q, q)
for i in 1:q, j in 1:q, k in 1:q, l in 1:q
O[i, j, k, l] = exp(beta * (comega(i - j) + comega(j - k) + comega(k - l) + comega(l - i)))
O[i, j, k, l] = exp(beta * (comega(i - j) + comega(j - l) + comega(l - k) + comega(k - i)))
end

return InfiniteMPO([TensorMap(O, ℂ^q * ℂ^q, ℂ^q * ℂ^q)])
Expand Down
36 changes: 36 additions & 0 deletions test/qstate_clock.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Test
using TensorKit
using QuadGK
using MPSKit
using MPSKitModels

# Onsager free energy per spin of the 2D classical Ising model with coupling J = 1
function classical_ising_free_energy(; beta)
k = 1 / sinh(2 * beta)^2
F = quadgk(
θ -> log(cosh(2 * beta)^2 + 1 / k * sqrt(1 + k^2 - 2 * k * cos(2 * θ))),
0, pi
)[1]
return -1 / beta * (log(2) / 2 + 1 / (2 * pi) * F)
end

alg = VUMPS(; tol = 1.0e-10, maxiter = 100, verbosity = 0)

# Every MPO tensor contains two spins, so the free energy per spin is -log(λ) / (2β).
function clock_free_energy(q, beta; D = 16)
O = qstate_clock(; beta, q)
ψ, envs, = leading_boundary(InfiniteMPS(ℂ^q, ℂ^D), O, alg)
λ = expectation_value(ψ, O, envs)
return -log(abs(λ)) / (2 * beta)
end

@testset "q = 2 is the Ising model (β = $beta)" for beta in (0.3, 0.6)
@test clock_free_energy(2, beta) ≈ classical_ising_free_energy(; beta) atol = 1.0e-6
end

# cos(θ - θ') = (σσ' + ττ') / 2 for σ = cos θ + sin θ and τ = cos θ - sin θ, so the q = 4 clock
# model is two decoupled Ising models at half the coupling.
@testset "q = 4 is two Ising models (β = $beta)" for beta in (0.6, 1.2)
f_ising = classical_ising_free_energy(; beta = beta / 2) * (beta / 2)
@test clock_free_energy(4, beta) * beta ≈ 2 * f_ising atol = 1.0e-6
end
Loading