From 00c781d404c4ab4dddab910ba9745ef334cf7e1d Mon Sep 17 00:00:00 2001 From: VictorVanthilt Date: Tue, 24 Nov 2026 09:48:42 +0000 Subject: [PATCH 1/6] Apply the Yamazaki fix to the U1 sixvertex implementation --- src/models/transfermatrices.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/transfermatrices.jl b/src/models/transfermatrices.jl index 0f7fc54..74c0871 100644 --- a/src/models/transfermatrices.jl +++ b/src/models/transfermatrices.jl @@ -74,7 +74,7 @@ end function sixvertex(elt::Type{<:Number}, ::Type{U1Irrep}; a = 1.0, b = 1.0, c = 1.0) pspace = U1Space(-1 // 2 => 1, 1 // 2 => 1) mpo = zeros(elt, pspace ⊗ pspace, pspace ⊗ pspace) - block(mpo, Irrep[U₁](0)) .= [b c; c b] + block(mpo, Irrep[U₁](0)) .= [c b; b c] block(mpo, Irrep[U₁](1)) .= reshape([a], (1, 1)) block(mpo, Irrep[U₁](-1)) .= reshape([a], (1, 1)) return InfiniteMPO([permute(mpo, ((1, 2), (4, 3)))]) From dc661778230b52ccaf5394e7fd7fe8b6f7eadd09 Mon Sep 17 00:00:00 2001 From: VictorVanthilt Date: Tue, 24 Nov 2026 09:51:53 +0000 Subject: [PATCH 2/6] Add a crosscheck for the 3 implementations of the sixvertex model --- test/sixvertex.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/sixvertex.jl b/test/sixvertex.jl index 3952937..f977799 100644 --- a/test/sixvertex.jl +++ b/test/sixvertex.jl @@ -40,3 +40,13 @@ end F = leading_eigenvalue(ψ, mpo2) @test abs(F)^(1 / 4) ≈ F₀ atol = 1.0e-2 end + +@testset "Crosscheck" begin + a, b, c = 1.0, 2.0, 3.0 + Ttriv = convert(Array, sixvertex(Trivial; a, b, c)) + Tu1 = convert(Array, sixvertex(U1Irrep; a, b, c)) + Tcu1 = convert(Array, sixvertex(CU1Irrep; a, b, c)) + @test iszero(norm(Ttriv - Tu1)) + @test iszero(norm(Ttriv - Tcu1)) + @test iszero(norm(Tu1 - Tcu1)) +end From 66ae832ff7cd241d79aec99055be8f5397358ccb Mon Sep 17 00:00:00 2001 From: VictorVanthilt Date: Tue, 24 Nov 2026 11:04:27 +0000 Subject: [PATCH 3/6] unpack the MPOs before converting to Array --- test/sixvertex.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/sixvertex.jl b/test/sixvertex.jl index f977799..139040f 100644 --- a/test/sixvertex.jl +++ b/test/sixvertex.jl @@ -43,9 +43,9 @@ end @testset "Crosscheck" begin a, b, c = 1.0, 2.0, 3.0 - Ttriv = convert(Array, sixvertex(Trivial; a, b, c)) - Tu1 = convert(Array, sixvertex(U1Irrep; a, b, c)) - Tcu1 = convert(Array, sixvertex(CU1Irrep; a, b, c)) + Ttriv = convert(Array, sixvertex(Trivial; a, b, c)[1]) + Tu1 = convert(Array, sixvertex(U1Irrep; a, b, c)[1]) + Tcu1 = convert(Array, sixvertex(CU1Irrep; a, b, c)[1]) @test iszero(norm(Ttriv - Tu1)) @test iszero(norm(Ttriv - Tcu1)) @test iszero(norm(Tu1 - Tcu1)) From 6c9b74f2933deba7f3da48c8d4142c336bda55fe Mon Sep 17 00:00:00 2001 From: VictorVanthilt Date: Tue, 24 Nov 2026 11:07:35 +0000 Subject: [PATCH 4/6] set an atol of 1e-14 --- test/sixvertex.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/sixvertex.jl b/test/sixvertex.jl index 139040f..104b817 100644 --- a/test/sixvertex.jl +++ b/test/sixvertex.jl @@ -46,7 +46,9 @@ end Ttriv = convert(Array, sixvertex(Trivial; a, b, c)[1]) Tu1 = convert(Array, sixvertex(U1Irrep; a, b, c)[1]) Tcu1 = convert(Array, sixvertex(CU1Irrep; a, b, c)[1]) - @test iszero(norm(Ttriv - Tu1)) - @test iszero(norm(Ttriv - Tcu1)) - @test iszero(norm(Tu1 - Tcu1)) + + atol = 1.0e-14 + @test isapprox(Ttriv, Tu1; atol) + @test isapprox(Ttriv, Tcu1; atol) + @test isapprox(Tu1, Tcu1; atol) end From 322eb449b23ed462847457050c3f0b384168c733 Mon Sep 17 00:00:00 2001 From: leburgel Date: Tue, 24 Nov 2026 14:49:53 +0100 Subject: [PATCH 5/6] Use Baxter's convention for the sixvertex weights Drop the permute in all three implementations, so the tensors match TNRKit's and `c` is the turning vertex as in Baxter (1982). Define the weights in the docstring, set up DocumenterCitations, and test a frozen ferroelectric point that fails when `b` and `c` are swapped. Co-Authored-By: Claude Opus 5.5 --- docs/Project.toml | 2 ++ docs/make.jl | 7 ++++++- docs/src/assets/mpskitmodels.bib | 18 ++++++++++++++++++ docs/src/references.md | 4 ++++ src/models/transfermatrices.jl | 29 +++++++++++++++++++++++++---- test/sixvertex.jl | 12 ++++++++++++ 6 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 docs/src/assets/mpskitmodels.bib create mode 100644 docs/src/references.md diff --git a/docs/Project.toml b/docs/Project.toml index a22832b..32fc64e 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,7 +1,9 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244" MPSKit = "bb1c41ca-d63c-52ed-829e-0820dda26502" MPSKitModels = "ca635005-6f8c-4cd1-b51d-8491250ef2ab" [compat] Documenter = "1" +DocumenterCitations = "1" diff --git a/docs/make.jl b/docs/make.jl index 937ed67..2490bd9 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -8,8 +8,11 @@ if Base.active_project() != joinpath(@__DIR__, "Project.toml") end using Documenter +using DocumenterCitations using MPSKitModels +bib = CitationBibliography(joinpath(@__DIR__, "src", "assets", "mpskitmodels.bib"); style = :authoryear) + makedocs(; modules = [MPSKitModels], sitename = "MPSKitModels.jl", @@ -26,9 +29,11 @@ makedocs(; "man/lattices.md", "man/models.md", ], + "References" => "references.md", "Index" => "package_index.md", ], - checkdocs = :public + checkdocs = :public, + plugins = [bib] ) deploydocs(; repo = "github.com/QuantumKitHub/MPSKitModels.jl.git") diff --git a/docs/src/assets/mpskitmodels.bib b/docs/src/assets/mpskitmodels.bib new file mode 100644 index 0000000..f00f5dd --- /dev/null +++ b/docs/src/assets/mpskitmodels.bib @@ -0,0 +1,18 @@ +@book{baxter1982, + title = {Exactly Solved Models in Statistical Mechanics}, + author = {Baxter, Rodney J.}, + year = {1982}, + publisher = {Academic Press}, + address = {London} +} + +@article{lieb1967exact, + title = {Exact Solution of the Problem of the Entropy of Two-Dimensional Ice}, + author = {Lieb, Elliott H.}, + year = {1967}, + journal = {Physical Review Letters}, + volume = {18}, + number = {17}, + pages = {692--694}, + doi = {10.1103/PhysRevLett.18.692} +} diff --git a/docs/src/references.md b/docs/src/references.md new file mode 100644 index 0000000..78f29bc --- /dev/null +++ b/docs/src/references.md @@ -0,0 +1,4 @@ +# References + +```@bibliography +``` diff --git a/src/models/transfermatrices.jl b/src/models/transfermatrices.jl index 74c0871..56058aa 100644 --- a/src/models/transfermatrices.jl +++ b/src/models/transfermatrices.jl @@ -55,7 +55,28 @@ end sixvertex([elt::Type{<:Number}=ComplexF64], [symmetry::Type{<:Sector}=Trivial]; a=1.0, b=1.0, c=1.0) -MPO for the partition function of the two-dimensional six vertex model. +MPO for the partition function of the two-dimensional six-vertex model, with vertex weights +`a`, `b` and `c` in the convention of [baxter1982](@citet), Ch. 8. + +Every bond carries an arrow, and only the six vertices with two incoming and two outgoing +arrows have a nonzero weight. The MPO tensor has legs `W ⊗ S ← N ⊗ E`. Listing the arrows +on the horizontal legs as (W, E) and on the vertical legs as (S, N), the weights are + +| weight | horizontal (W, E) | vertical (S, N) | +|:------:|:-----------------:|:---------------:| +| `a` | (→, →) | (↑, ↑) | +| `a` | (←, ←) | (↓, ↓) | +| `b` | (→, →) | (↓, ↓) | +| `b` | (←, ←) | (↑, ↑) | +| `c` | (→, ←) | (↓, ↑) | +| `c` | (←, →) | (↑, ↓) | + +so `a` and `b` are the two kinds of vertex where both arrows pass straight through, and +`c` is the vertex where they turn. The phase is set by the anisotropy +``Δ = (a^2 + b^2 - c^2) / (2ab)``: ferroelectric (frozen) for ``Δ > 1``, critical for +``-1 < Δ < 1`` and antiferroelectric for ``Δ < -1``. The default `a = b = c = 1` is the ice +point (``Δ = 1/2``), with partition function per site ``(4/3)^{3/2}`` +[lieb1967exact](@cite). """ function sixvertex end sixvertex(symmetry::Type{<:Sector}; kwargs...) = sixvertex(ComplexF64, symmetry; kwargs...) @@ -69,7 +90,7 @@ function sixvertex( 0 b c 0 0 0 0 a ] - return InfiniteMPO([permute(TensorMap(d, ℂ^2 ⊗ ℂ^2, ℂ^2 ⊗ ℂ^2), ((1, 2), (4, 3)))]) + return InfiniteMPO([TensorMap(d, ℂ^2 ⊗ ℂ^2, ℂ^2 ⊗ ℂ^2)]) end function sixvertex(elt::Type{<:Number}, ::Type{U1Irrep}; a = 1.0, b = 1.0, c = 1.0) pspace = U1Space(-1 // 2 => 1, 1 // 2 => 1) @@ -77,7 +98,7 @@ function sixvertex(elt::Type{<:Number}, ::Type{U1Irrep}; a = 1.0, b = 1.0, c = 1 block(mpo, Irrep[U₁](0)) .= [c b; b c] block(mpo, Irrep[U₁](1)) .= reshape([a], (1, 1)) block(mpo, Irrep[U₁](-1)) .= reshape([a], (1, 1)) - return InfiniteMPO([permute(mpo, ((1, 2), (4, 3)))]) + return InfiniteMPO([mpo]) end function sixvertex(elt::Type{<:Number}, ::Type{CU1Irrep}; a = 1.0, b = 1.0, c = 1.0) pspace = CU1Space(1 // 2 => 1) @@ -85,7 +106,7 @@ function sixvertex(elt::Type{<:Number}, ::Type{CU1Irrep}; a = 1.0, b = 1.0, c = block(mpo, Irrep[CU₁](0, 0)) .= reshape([b + c], (1, 1)) block(mpo, Irrep[CU₁](0, 1)) .= reshape([-b + c], (1, 1)) block(mpo, Irrep[CU₁](1, 2)) .= reshape([a], (1, 1)) - return InfiniteMPO([permute(mpo, ((1, 2), (4, 3)))]) + return InfiniteMPO([mpo]) end #=========================================================================================== diff --git a/test/sixvertex.jl b/test/sixvertex.jl index 104b817..41ad19a 100644 --- a/test/sixvertex.jl +++ b/test/sixvertex.jl @@ -52,3 +52,15 @@ end @test isapprox(Ttriv, Tcu1; atol) @test isapprox(Tu1, Tcu1; atol) end + +@testset "Baxter convention" begin + # max(a, b) > min(a, b) + c means Δ > 1: frozen ferroelectric phase, with partition + # function per site max(a, b). The second set has c + a < b, so swapping b and c + # makes it antiferroelectric (c > a + b) and changes the result. + for (a, b, c) in ((3.0, 1.0, 1.5), (1.0, 3.0, 1.5)) + mpo = sixvertex(; a, b, c) + ψ = InfiniteMPS(ℂ^2, ℂ^4) + ψ, _ = leading_boundary(ψ, mpo, alg) + @test expectation_value(ψ, mpo)[1] ≈ max(a, b) atol = 1.0e-8 + end +end From 0fe814668da6d580508c8b85b505010f004cbdc4 Mon Sep 17 00:00:00 2001 From: leburgel Date: Tue, 24 Nov 2026 19:29:04 +0100 Subject: [PATCH 6/6] Compare basis-independent traces in the sixvertex crosscheck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `convert(Array, ⋅)` need not give the same basis for different symmetries, so compare tr(Rᵏ) of the periodic four-site row transfer matrix instead of the dense tensors. Co-Authored-By: Claude Opus 5.5 --- test/sixvertex.jl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/test/sixvertex.jl b/test/sixvertex.jl index 41ad19a..fc9cc66 100644 --- a/test/sixvertex.jl +++ b/test/sixvertex.jl @@ -1,6 +1,7 @@ using MPSKitModels using MPSKit using TensorKit +using LinearAlgebra using Test F₀ = (4 / 3)^(3 / 2) @@ -41,16 +42,19 @@ end @test abs(F)^(1 / 4) ≈ F₀ atol = 1.0e-2 end +# `convert(Array, ⋅)` need not use the same basis for different symmetries, so compare +# tr(Rᵏ) of the periodic row transfer matrix R on four sites, which does not depend on it. @testset "Crosscheck" begin - a, b, c = 1.0, 2.0, 3.0 - Ttriv = convert(Array, sixvertex(Trivial; a, b, c)[1]) - Tu1 = convert(Array, sixvertex(U1Irrep; a, b, c)[1]) - Tcu1 = convert(Array, sixvertex(CU1Irrep; a, b, c)[1]) - - atol = 1.0e-14 - @test isapprox(Ttriv, Tu1; atol) - @test isapprox(Ttriv, Tcu1; atol) - @test isapprox(Tu1, Tcu1; atol) + function ring_traces(T) + W = convert(Array, sixvertex(T; a = 1.0, b = 2.0, c = 3.0)[1]) + @tensor R[s1 s2 s3 s4; n1 n2 n3 n4] := + W[v1 s1 n1 v2] * W[v2 s2 n2 v3] * W[v3 s3 n3 v4] * W[v4 s4 n4 v1] + R = reshape(R, 16, 16) + return [tr(R^k) for k in 1:6] + end + t = ring_traces(Trivial) + @test ring_traces(U1Irrep) ≈ t + @test ring_traces(CU1Irrep) ≈ t end @testset "Baxter convention" begin