Skip to content

Commit b94c4bc

Browse files
Change METTS example to use product initial state and print product states (#165)
1 parent c01cba6 commit b94c4bc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ITensorMPS"
22
uuid = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2"
33
authors = ["Matthew Fishman <[email protected]>", "Miles Stoudenmire <[email protected]>"]
4-
version = "0.3.23"
4+
version = "0.3.24"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

examples/finite_temperature/metts.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ function main(; N = 10, cutoff = 1.0e-8, δτ = 0.1, beta = 2.0, NMETTS = 3000,
5050
# Make y-rotation gates to use in METTS collapses
5151
Ry_gates = ops([("Ry", n, (θ = π / 2,)) for n in 1:N], s)
5252

53-
# Arbitrary initial state
54-
psi = random_mps(s)
53+
# Arbitrary initial Z-product state
54+
init_state = rand(["Z+", "Z-"], N)
55+
psi = MPS(s, init_state)
5556

5657
# Make H for measuring the energy
5758
terms = OpSum()
@@ -108,6 +109,7 @@ function main(; N = 10, cutoff = 1.0e-8, δτ = 0.1, beta = 2.0, NMETTS = 3000,
108109
samp = sample!(psi)
109110
new_state = [samp[j] == 1 ? "Z+" : "Z-" for j in 1:N]
110111
end
112+
@printf(" Next Product State = %s\n", new_state)
111113
psi = MPS(s, new_state)
112114
end
113115

0 commit comments

Comments
 (0)