Skip to content

Commit

Permalink
Fix formatting, fix convention of Ising model
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrehmer committed Jul 15, 2024
1 parent 4713c11 commit df4fa10
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/operators/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ function square_lattice_tf_ising(
lattice = fill(physical_space, 1, 1)
σx = TensorMap(T[0 1; 1 0], physical_space, physical_space)
σz = TensorMap(T[1 0; 0 -1], physical_space, physical_space)
hzz = nearest_neighbour_hamiltonian(lattice, -J / 4 * σz σz)
hzz = nearest_neighbour_hamiltonian(lattice, -J * σz σz)
return repeat(
LocalOperator(lattice, hzz.terms..., (CartesianIndex(1, 1),) => -J * h / 2 * σx),
LocalOperator(lattice, hzz.terms..., (CartesianIndex(1, 1),) => -J * h * σx),
unitcell...,
)
end
Expand Down
28 changes: 17 additions & 11 deletions test/tf_ising.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,25 @@ using OptimKit
# J. Jordan, R. Orús, G. Vidal, F. Verstraete, and J. I. Cirac
# Phys. Rev. Lett. 101, 250602 – Published 18 December 2008
# (values estimated from plots)
# (factor of 2 in the energy and magnetisation due to convention differences)
h = 0.5
e = -0.525
mᶻ = 0.98
# (factor of 2 in the energy due to convention differences)
h = 3.1
e = -1.6417 * 2
= 0.91

# initialize parameters
χbond = 2
χenv = 16
ctm_alg = CTMRG(; trscheme=truncdim(χenv), tol=1e-10, miniter=4, maxiter=100, verbosity=2)
ctm_alg = CTMRG(;
tol=1e-10,
miniter=4,
maxiter=100,
verbosity=2,
svd_alg=SVDAdjoint(; fwd_alg=TensorKit.SVD(), rrule_alg=GMRES(; tol=1e-10)),
)
opt_alg = PEPSOptimize(;
boundary_alg=ctm_alg,
optimizer=LBFGS(4; maxiter=100, gradtol=1e-3, verbosity=2),
gradient_alg=LinSolver(; solver=GMRES(; tol=1e-6, maxiter=100))
optimizer=LBFGS(4; maxiter=100, gradtol=1e-4, verbosity=2),
gradient_alg=LinSolver(; solver=GMRES(; tol=1e-6, maxiter=100)),
reuse_env=true,
)

Expand All @@ -36,10 +42,10 @@ env_init = leading_boundary(CTMRGEnv(psi_init, ComplexSpace(χenv)), psi_init, c
result = fixedpoint(psi_init, H, opt_alg, env_init)

# compute magnetization
σz = TensorMap(scalartype(psi_init)[1 0; 0 -1], ℂ^2, ℂ^2)
M = LocalOperator(H.lattice, (CartesianIndex(1, 1),) => σz)
σx = TensorMap(scalartype(psi_init)[0 1; 1 0], ℂ^2, ℂ^2)
M = LocalOperator(H.lattice, (CartesianIndex(1, 1),) => σx)
magn = expectation_value(result.peps, M, result.env)

@test result.E e atol = 5e-2
@test result.E e atol = 1e-3
@test imag(magn) 0 atol = 1e-6
@test abs(magn) mᶻ atol = 5e-2
@test abs(magn) atol = 5e-2

0 comments on commit df4fa10

Please sign in to comment.