From b982f2ff89a74b5bf2d0b77905a7bd0f316b802a Mon Sep 17 00:00:00 2001 From: Miles Date: Sun, 9 Nov 2025 12:24:24 -0500 Subject: [PATCH 1/4] Change METTS example to use product initial state and print product states --- examples/finite_temperature/metts.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/finite_temperature/metts.jl b/examples/finite_temperature/metts.jl index 56a7f37..a3800a0 100644 --- a/examples/finite_temperature/metts.jl +++ b/examples/finite_temperature/metts.jl @@ -1,5 +1,6 @@ using ITensors, ITensorMPS using Printf +using Random: rand #= @@ -50,8 +51,9 @@ function main(; N = 10, cutoff = 1.0e-8, δτ = 0.1, beta = 2.0, NMETTS = 3000, # Make y-rotation gates to use in METTS collapses Ry_gates = ops([("Ry", n, (θ = π / 2,)) for n in 1:N], s) - # Arbitrary initial state - psi = random_mps(s) + # Arbitrary initial Z-product state + init_state = rand(["Z+","Z-"],N) + psi = MPS(s, init_state) # Make H for measuring the energy terms = OpSum() @@ -108,6 +110,7 @@ function main(; N = 10, cutoff = 1.0e-8, δτ = 0.1, beta = 2.0, NMETTS = 3000, samp = sample!(psi) new_state = [samp[j] == 1 ? "Z+" : "Z-" for j in 1:N] end + @printf(" Next Product State = %s\n",new_state) psi = MPS(s, new_state) end From c568e49d19900d767cde9f2357886fd4f4c8036a Mon Sep 17 00:00:00 2001 From: Miles Date: Sun, 9 Nov 2025 12:29:11 -0500 Subject: [PATCH 2/4] Formatting --- examples/finite_temperature/metts.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/finite_temperature/metts.jl b/examples/finite_temperature/metts.jl index a3800a0..c0b7e5f 100644 --- a/examples/finite_temperature/metts.jl +++ b/examples/finite_temperature/metts.jl @@ -52,7 +52,7 @@ function main(; N = 10, cutoff = 1.0e-8, δτ = 0.1, beta = 2.0, NMETTS = 3000, Ry_gates = ops([("Ry", n, (θ = π / 2,)) for n in 1:N], s) # Arbitrary initial Z-product state - init_state = rand(["Z+","Z-"],N) + init_state = rand(["Z+", "Z-"], N) psi = MPS(s, init_state) # Make H for measuring the energy @@ -110,7 +110,7 @@ function main(; N = 10, cutoff = 1.0e-8, δτ = 0.1, beta = 2.0, NMETTS = 3000, samp = sample!(psi) new_state = [samp[j] == 1 ? "Z+" : "Z-" for j in 1:N] end - @printf(" Next Product State = %s\n",new_state) + @printf(" Next Product State = %s\n", new_state) psi = MPS(s, new_state) end From c446842ae7c36c4d64792811a76d64bb199d4017 Mon Sep 17 00:00:00 2001 From: Miles Date: Sun, 9 Nov 2025 12:29:16 -0500 Subject: [PATCH 3/4] Bump version number --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 667edae..269fd25 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ITensorMPS" uuid = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2" authors = ["Matthew Fishman ", "Miles Stoudenmire "] -version = "0.3.23" +version = "0.3.24" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" From fb1f9c3922b3e369ad6aba708822d7e8877b9d27 Mon Sep 17 00:00:00 2001 From: Miles Date: Sun, 9 Nov 2025 22:34:31 -0500 Subject: [PATCH 4/4] Remove unneeded using statement --- examples/finite_temperature/metts.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/finite_temperature/metts.jl b/examples/finite_temperature/metts.jl index c0b7e5f..43ff74d 100644 --- a/examples/finite_temperature/metts.jl +++ b/examples/finite_temperature/metts.jl @@ -1,6 +1,5 @@ using ITensors, ITensorMPS using Printf -using Random: rand #=