@@ -3,14 +3,16 @@ using Random
33using TensorKit
44using PEPSKit
55
6+ Nr, Nc = 2 , 2
7+ H = real (heisenberg_XYZ (ComplexF64, Trivial, InfiniteSquare (Nr, Nc); Jx = 1 , Jy = 1 , Jz = 1 ))
8+ Pspace, Vspace = ℂ^ 2 , ℂ^ 4
9+ ψ0 = InfinitePEPS (rand, Float64, Pspace, Vspace; unitcell = (Nr, Nc))
10+ dt, nstep = 0.1 , 20
11+ trunc = truncerror (; atol = 1.0e-10 ) & truncrank (4 )
12+
613@testset " SimpleUpdate timestep" begin
7- Nr, Nc = 2 , 2
8- H = real (heisenberg_XYZ (ComplexF64, Trivial, InfiniteSquare (Nr, Nc); Jx = 1 , Jy = 1 , Jz = 1 ))
9- Pspace, Vspace = ℂ^ 2 , ℂ^ 4
10- ψ0 = InfinitePEPS (rand, Float64, Pspace, Vspace; unitcell = (Nr, Nc))
14+ alg = SimpleUpdate (; trunc)
1115 env0 = SUWeight (ψ0)
12- alg = SimpleUpdate (; trunc = truncerror (; atol = 1.0e-10 ) & truncrank (4 ))
13- dt, nstep = 1.0e-2 , 50
1416 # manual timestep
1517 evolver = TimeEvolver (ψ0, H, dt, nstep, alg, env0)
1618 ψ1, env1, info1 = deepcopy (ψ0), deepcopy (env0), nothing
@@ -31,3 +33,25 @@ using PEPSKit
3133 @test env1 == env2 == env3
3234 @test info1 == info2 == info3
3335end
36+
37+ @testset " NeighbourUpdate timestep" begin
38+ alg = NeighbourUpdate (; opt_alg = ALSTruncation (; trunc))
39+ # manual timestep
40+ evolver = TimeEvolver (ψ0, H, dt, nstep, alg)
41+ ψ1, info1 = deepcopy (ψ0), nothing
42+ for iter in 0 : (nstep - 1 )
43+ ψ1, info1 = timestep (evolver, ψ1)
44+ end
45+ # time_evolve
46+ ψ2, info2 = time_evolve (ψ0, H, dt, nstep, alg)
47+ # for-loop syntax
48+ # # manually reset internal state of evolver
49+ evolver. state = PEPSKit. NTUState (0 , 0.0 , ψ0)
50+ ψ3, info3 = nothing , nothing , nothing
51+ for state in evolver
52+ ψ3, info3 = state
53+ end
54+ # results should be *exactly* the same
55+ @test ψ1 == ψ2 == ψ3
56+ @test info1 == info2 == info3
57+ end
0 commit comments