Skip to content

Commit 460ec96

Browse files
committed
Fix examples for sum of MPO representation
1 parent 428cb38 commit 460ec96

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

examples/vumps/vumps_heisenberg.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ function expect_two_site(ψ::InfiniteCanonicalMPS, h::ITensor, n1n2)
5757
return (noprime* h) * dag(ϕ))[]
5858
end
5959

60+
function expect_two_site::InfiniteCanonicalMPS, h::MPO, n1n2)
61+
return expect_two_site(ψ, prod(h), n1n2)
62+
end
63+
6064
Sz = [expect(ψ, "Sz", n) for n in 1:N]
6165

6266
bs = [(1, 2), (2, 3)]

examples/vumps/vumps_hubbard_extended.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ function expect_two_site(ψ::InfiniteCanonicalMPS, h::ITensor, n1n2)
7575
return (noprime* h) * dag(ϕ))[]
7676
end
7777

78+
function expect_two_site::InfiniteCanonicalMPS, h::MPO, n1n2)
79+
return expect_two_site(ψ, prod(h), n1n2)
80+
end
81+
7882
function expect_two_site::MPS, h::ITensor, n1n2)
7983
n1, n2 = n1n2
8084
ψ = orthogonalize(ψ, n1)

examples/vumps/vumps_ising.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ energy_finite_total, ψ_finite = @time dmrg(H_finite, ψ_finite, sweeps)
8383

8484
function energy_local(ψ1, ψ2, h)
8585
ϕ = ψ1 * ψ2
86-
return (noprime* h) * dag(ϕ))[]
86+
return (noprime* prod(h)) * dag(ϕ))[]
8787
end
8888

8989
function ITensors.expect(ψ, o)

examples/vumps/vumps_ising_extended.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ for j in 1:outer_iters
4141
println("\nIncrease bond dimension")
4242
ψ_1 = subspace_expansion(ψ_0, H; subspace_expansion_kwargs...)
4343
println("Run VUMPS with new bond dimension")
44-
ψ_0 = vumps(H, ψ_1; vumps_kwargs...)
44+
global ψ_0 = vumps(H, ψ_1; vumps_kwargs...)
4545
end
4646

4747
Sz = [expect(ψ_0, "Sz", n) for n in 1:N]

examples/vumps/vumps_ising_noncontiguous.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ for j in 1:outer_iters
4848
println("\nIncrease bond dimension")
4949
ψ_1 = subspace_expansion(ψ_0, H; subspace_expansion_kwargs...)
5050
println("Run VUMPS with new bond dimension")
51-
ψ_0 = vumps(H, ψ_1; vumps_kwargs...)
51+
global ψ_0 = vumps(H, ψ_1; vumps_kwargs...)
5252
end
5353

5454
Sz = [expect(ψ_0, "Sz", n) for n in 1:N]

examples/vumps/vumps_localham_qns.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ randn!.(ψ)
5656

5757
function energy(ψ1, ψ2, h)
5858
ϕ = ψ1 * ψ2
59-
return (noprime* h) * dag(ϕ))[]
59+
return (noprime* prod(h)) * dag(ϕ))[]
6060
end
6161

6262
function expect(ψ, o)

0 commit comments

Comments
 (0)