Skip to content

Commit 612cc94

Browse files
committed
Use new features on PEPO expectation value
1 parent 408813c commit 612cc94

File tree

1 file changed

+17
-26
lines changed

1 file changed

+17
-26
lines changed

test/examples/tf_ising_finiteT.jl

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ using LinearAlgebra
44
using TensorKit
55
import MPSKitModels: σˣ, σᶻ
66
using PEPSKit
7-
using PEPSKit: infinite_temperature_density_matrix, _fuse_ids
87

98
Random.seed!(10235876)
10-
σx = σˣ(Float64, Trivial)
11-
σz = σᶻ(Float64, Trivial)
129

1310
# Benchmark data of [σx, σz] from HOTRG
1411
# Physical Review B 86, 045139 (2012) Fig. 15-16
@@ -35,21 +32,18 @@ function converge_env(state, χ::Int)
3532
return env
3633
end
3734

38-
function measure_mag(pepo::InfinitePEPO, pf::InfinitePartitionFunction, env::CTMRGEnv)
35+
function measure_mag(pepo::InfinitePEPO, env::CTMRGEnv; purified::Bool = false)
3936
r, c = 1, 1
40-
@tensor M[w s; n e] := σx[p2; p1] * (pepo.A[r, c, 1])[p1 p2; n e s w]
41-
magx = expectation_value(pf, (r, c) => M, env)
42-
@tensor M[w s; n e] := σz[p2; p1] * (pepo.A[r, c, 1])[p1 p2; n e s w]
43-
magz = expectation_value(pf, (r, c) => M, env)
44-
return [magx, magz]
45-
end
46-
47-
function measure_mag(peps::InfinitePEPS, env::CTMRGEnv)
48-
lattice = collect(space(t, 1) for t in peps.A)
49-
O = LocalOperator(lattice, ((1, 1),) => _fuse_ids(σx))
50-
magx = expectation_value(peps, O, env)
51-
O = LocalOperator(lattice, ((1, 1),) => _fuse_ids(σz))
52-
magz = expectation_value(peps, O, env)
37+
lattice = physicalspace(pepo)
38+
Mx = LocalOperator(lattice, ((r, c),) => σˣ(Float64, Trivial))
39+
Mz = LocalOperator(lattice, ((r, c),) => σᶻ(Float64, Trivial))
40+
if purified
41+
magx = expectation_value(pepo, Mx, pepo, env)
42+
magz = expectation_value(pepo, Mz, pepo, env)
43+
else
44+
magx = expectation_value(pepo, Mx, env)
45+
magz = expectation_value(pepo, Mz, env)
46+
end
5347
return [magx, magz]
5448
end
5549

@@ -69,24 +63,21 @@ alg = SimpleUpdate(dt, 0.0, maxiter, trscheme_pepo)
6963
# PEPO approach
7064
## results at β, or T = 2.5
7165
pepo, wts, = simpleupdate(pepo0, ham, alg, wts0; gate_bothsides = true)
72-
pf = InfinitePartitionFunction(pepo)
73-
env = converge_env(pf, 16)
74-
result_β = measure_mag(pepo, pf, env)
66+
env = converge_env(InfinitePartitionFunction(pepo), 16)
67+
result_β = measure_mag(pepo, env)
7568
@info "Magnetization at T = $(1 / β)" result_β
7669
@test isapprox(abs.(result_β), bm_β, rtol = 1.0e-2)
7770

7871
## results at 2β, or T = 1.25
7972
pepo, wts, = simpleupdate(pepo, ham, alg, wts; gate_bothsides = true)
80-
pf = InfinitePartitionFunction(pepo)
81-
env = converge_env(pf, 16)
82-
result_2β = measure_mag(pepo, pf, env)
73+
env = converge_env(InfinitePartitionFunction(pepo), 16)
74+
result_2β = measure_mag(pepo, env)
8375
@info "Magnetization at T = $(1 / (2β))" result_2β
8476
@test isapprox(abs.(result_2β), bm_2β, rtol = 1.0e-4)
8577

8678
# purification approach (should match 2β result)
8779
pepo, = simpleupdate(pepo0, ham, alg, wts0; gate_bothsides = false)
88-
peps = InfinitePEPS(pepo)
89-
env = converge_env(peps, 8)
90-
result_2β′ = measure_mag(peps, env)
80+
env = converge_env(InfinitePEPS(pepo), 8)
81+
result_2β′ = measure_mag(pepo, env; purified = true)
9182
@info "Magnetization at T = $(1 / (2β)) (purification approach)" result_2β′
9283
@test isapprox(abs.(result_2β′), bm_2β, rtol = 1.0e-2)

0 commit comments

Comments
 (0)