Skip to content

Commit 552d6ad

Browse files
Improve time evolution interface (#280)
* Improve time evolution interface * Update docstring * Move `force_3site` into `SimpleUpdate` * Define `Base.iterate` for SimpleUpdate * Update tests and some examples * Fix test * Minor fixes [skip ci] * Fix merge regressions * Restore accidentally commented tests * Undo unnecessary renames * Separate SU alg, state, iterator * Remove `H` from TimeEvolver * Add test for `timestep` * Add docstrings * Update SU examples * Update tests * Minor changes * Add verbosity for TimeEvolver * Store Hamiltonian in TimeEvolver * Move convergence check out of TimeEvolver * Restore docstrings * Fix `timestep` * Fix tests * Fix more tests * Finer parameters for SUState * Make timestep test look better * Allow complex Trotter time step * Reorder parameters of SUState * Docstring updates * Change `gate_bothsides` to `purified` * Remove `rand` from finite-T SU tests * Move `InfiniteState` * Remove functionality to reset `iter` from `timestep` * Docstring updates * Reduce unicode usage * Fix test
1 parent 7de7979 commit 552d6ad

File tree

18 files changed

+364
-230
lines changed

18 files changed

+364
-230
lines changed

examples/heisenberg_su/main.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,11 @@ fix a truncation error (if that can be reached by remaining below `Dbond`):
7070

7171
dts = [1.0e-2, 1.0e-3, 4.0e-4]
7272
tols = [1.0e-6, 1.0e-8, 1.0e-8]
73-
maxiter = 10000
73+
nstep = 10000
7474
trunc_peps = truncerror(; atol = 1.0e-10) & truncrank(Dbond)
75-
75+
alg = SimpleUpdate(; trunc = trunc_peps, bipartite = true)
7676
for (dt, tol) in zip(dts, tols)
77-
alg = SimpleUpdate(dt, tol, maxiter, trunc_peps)
78-
global peps, wts, = simpleupdate(peps, H, alg, wts; bipartite = true)
77+
global peps, wts, = time_evolve(peps, H, dt, nstep, alg, wts; tol, check_interval = 500)
7978
end
8079

8180
md"""

examples/hubbard_su/main.jl

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,24 @@ maxiter = 20000
6666

6767
for (dt, tol, Dbond) in zip(dts, tols, Ds)
6868
trunc = truncerror(; atol = 1.0e-10) & truncrank(Dbond)
69-
alg = SimpleUpdate(dt, tol, maxiter, trunc)
70-
global peps, wts, = simpleupdate(
71-
peps, H, alg, wts; bipartite = false, check_interval = 2000
72-
)
69+
alg = SimpleUpdate(; trunc, bipartite = false)
70+
global peps, wts, = time_evolve(peps, H, dt, maxiter, alg, wts; tol, check_interval = 2000)
7371
end
7472

7573
md"""
7674
## Computing the ground-state energy
7775
7876
In order to compute the energy expectation value with evolved PEPS, we need to converge a
79-
CTMRG environment on it. We first converge an environment with a small enviroment dimension
80-
and then use that to initialize another run with bigger environment dimension. We'll use
81-
`trunc=truncrank(χ)` for that such that the dimension is increased during the second CTMRG
82-
run:
77+
CTMRG environment on it. We first converge an environment with a small enviroment dimension,
78+
which is initialized using the simple update bond weights. Next we use it to initialize
79+
another run with bigger environment dimension. The dynamic adjustment of environment dimension
80+
is achieved by using `trunc=truncrank(χ)` with different `χ`s in the CTMRG runs:
8381
"""
8482

8583
χenv₀, χenv = 6, 16
8684
env_space = Vect[fℤ₂](0 => χenv₀ / 2, 1 => χenv₀ / 2)
8785
normalize!.(peps.A, Inf)
88-
env = CTMRGEnv(rand, Float64, peps, env_space)
86+
env = CTMRGEnv(wts, peps)
8987
for χ in [χenv₀, χenv]
9088
global env, = leading_boundary(
9189
env, peps; alg = :sequential, tol = 1.0e-8, maxiter = 50, trunc = truncrank(χ)

examples/j1j2_su/main.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,16 @@ Therefore, we shall gradually increase $J_2 / J_1$ from 0.1 to 0.5, each time in
4848
on the previously evolved PEPS:
4949
"""
5050

51-
dt, tol, maxiter = 1.0e-2, 1.0e-8, 30000
51+
dt, tol, nstep = 1.0e-2, 1.0e-8, 30000
5252
check_interval = 4000
5353
trunc_peps = truncerror(; atol = 1.0e-10) & truncrank(Dbond)
54-
alg = SimpleUpdate(dt, tol, maxiter, trunc_peps)
54+
alg = SimpleUpdate(; trunc = trunc_peps)
5555
for J2 in 0.1:0.1:0.5
56-
H = real( ## convert Hamiltonian `LocalOperator` to real floats
56+
## convert Hamiltonian `LocalOperator` to real floats
57+
H = real(
5758
j1_j2_model(ComplexF64, symm, InfiniteSquare(Nr, Nc); J1, J2, sublattice = false),
5859
)
59-
global peps, wts, = simpleupdate(peps, H, alg, wts; check_interval)
60+
global peps, wts, = time_evolve(peps, H, dt, nstep, alg, wts; tol, check_interval)
6061
end
6162

6263
md"""
@@ -69,8 +70,7 @@ tols = [1.0e-9, 1.0e-9]
6970
J2 = 0.5
7071
H = real(j1_j2_model(ComplexF64, symm, InfiniteSquare(Nr, Nc); J1, J2, sublattice = false))
7172
for (dt, tol) in zip(dts, tols)
72-
alg′ = SimpleUpdate(dt, tol, maxiter, trunc_peps)
73-
global peps, wts, = simpleupdate(peps, H, alg′, wts; check_interval)
73+
global peps, wts, = time_evolve(peps, H, dt, nstep, alg, wts; tol)
7474
end
7575

7676
md"""

src/PEPSKit.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ include("algorithms/truncation/fullenv_truncation.jl")
7474
include("algorithms/truncation/bond_truncation.jl")
7575

7676
include("algorithms/time_evolution/evoltools.jl")
77+
include("algorithms/time_evolution/time_evolve.jl")
7778
include("algorithms/time_evolution/simpleupdate.jl")
7879
include("algorithms/time_evolution/simpleupdate3site.jl")
7980

@@ -104,7 +105,8 @@ export fixedpoint
104105

105106
export absorb_weight
106107
export ALSTruncation, FullEnvTruncation
107-
export su_iter, su3site_iter, simpleupdate, SimpleUpdate
108+
export SimpleUpdate
109+
export TimeEvolver, timestep, time_evolve
108110

109111
export InfiniteSquareNetwork
110112
export InfinitePartitionFunction

src/algorithms/time_evolution/evoltools.jl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1-
const InfiniteState = Union{InfinitePEPS, InfinitePEPO}
1+
"""
2+
Process the Trotter time step `dt` according to the intended usage.
3+
"""
4+
function _get_dt(
5+
state::InfiniteState, dt::Number, imaginary_time::Bool
6+
)
7+
# PEPS update: exp(-H dt)|ψ⟩
8+
# PEPO update (purified): exp(-H dt/2)|ρ⟩
9+
# PEPO update (not purified): exp(-H dt/2) ρ exp(-H dt/2)
10+
dt′ = (state isa InfinitePEPS) ? dt : (dt / 2)
11+
if (state isa InfinitePEPO)
12+
@assert size(state)[3] == 1
13+
end
14+
if !imaginary_time
15+
@assert (state isa InfinitePEPS) "Real time evolution of InfinitePEPO (Heisenberg picture) is not implemented."
16+
dt′ = 1.0im * dt′
17+
end
18+
return dt′
19+
end
220

321
function MPSKit.infinite_temperature_density_matrix(H::LocalOperator)
422
T = scalartype(H)

0 commit comments

Comments
 (0)