@@ -184,28 +184,30 @@ function right_environment(hᴿ, ψ; tol=1e-15)
184184 return Hᴿ
185185end
186186
187- function vumps_iteration (args... ; multisite_update_alg= " sequential" , kwargs... )
187+ function tdvp_iteration (args... ; multisite_update_alg= " sequential" , kwargs... )
188188 if multisite_update_alg == " sequential"
189- return vumps_iteration_sequential (args... ; kwargs... )
189+ return tdvp_iteration_sequential (args... ; kwargs... )
190190 elseif multisite_update_alg == " parallel"
191- return vumps_iteration_parallel (args... ; kwargs... )
191+ return tdvp_iteration_parallel (args... ; kwargs... )
192192 else
193193 error (
194194 " Multisite update algorithm multisite_update_alg = $multisite_update_alg not supported, use \" parallel\" or \" sequential\" " ,
195195 )
196196 end
197197end
198198
199- function vumps_iteration_sequential (
199+ function tdvp_iteration_sequential (
200+ solver:: Function ,
200201 ∑h:: InfiniteITensorSum ,
201202 ψ:: InfiniteCanonicalMPS ;
202203 (ϵᴸ!)= fill (1e-15 , nsites (ψ)),
203204 (ϵᴿ!)= fill (1e-15 , nsites (ψ)),
204- eigsolve_tol= (x -> x / 100 ),
205+ time_step,
206+ solver_tol= (x -> x / 100 ),
205207)
206208 Nsites = nsites (ψ)
207209 ϵᵖʳᵉˢ = max (maximum (ϵᴸ!), maximum (ϵᴿ!))
208- krylov_tol = eigsolve_tol (ϵᵖʳᵉˢ)
210+ _solver_tol = solver_tol (ϵᵖʳᵉˢ)
209211 ψᴴ = dag (ψ)
210212 ψ′ = ψᴴ'
211213 # XXX : make this prime the center sites
@@ -267,24 +269,23 @@ function vumps_iteration_sequential(
267269 for k in 1 : Nsites
268270 𝕙ᴸ[k] = left_environment_cell (ψ, ψ̃, hᴸ, k)
269271 end
270- Hᴸ = left_environment (hᴸ, 𝕙ᴸ, ψ; tol= krylov_tol )
272+ Hᴸ = left_environment (hᴸ, 𝕙ᴸ, ψ; tol= _solver_tol )
271273 for k in 2 : Nsites
272274 hᴿ[k] = hᴿ[k + 1 ] * ψ. AR[k + 1 ] * ψ̃. AR[k + 1 ] + hᴿ[k]
273275 end
274- Hᴿ = right_environment (hᴿ, ψ; tol= krylov_tol )
276+ Hᴿ = right_environment (hᴿ, ψ; tol= _solver_tol )
275277
276- Cvalsₙ₋₁, Cvecsₙ₋₁, Cinfoₙ₋₁ = eigsolve (
277- Hᶜ (∑h, Hᴸ, Hᴿ, ψ, n - 1 ), ψ. C[n - 1 ], 1 , :SR ; ishermitian = true , tol = krylov_tol
278+ Cvalsₙ₋₁, Cvecsₙ₋₁, Cinfoₙ₋₁ = solver (
279+ Hᶜ (∑h, Hᴸ, Hᴿ, ψ, n - 1 ), time_step, ψ. C[n - 1 ], _solver_tol
278280 )
279- Cvalsₙ, Cvecsₙ, Cinfoₙ = eigsolve (
280- Hᶜ (∑h, Hᴸ, Hᴿ, ψ, n), ψ. C[n], 1 , :SR ; ishermitian= true , tol= krylov_tol
281+ Cvalsₙ, Cvecsₙ, Cinfoₙ = solver (Hᶜ (∑h, Hᴸ, Hᴿ, ψ, n), time_step, ψ. C[n], _solver_tol)
282+ Avalsₙ, Avecsₙ, Ainfoₙ = solver (
283+ Hᴬᶜ (∑h, Hᴸ, Hᴿ, ψ, n), time_step, ψ. AL[n] * ψ. C[n], _solver_tol
281284 )
282- Avalsₙ, Avecsₙ, Ainfoₙ = eigsolve (
283- Hᴬᶜ (∑h, Hᴸ, Hᴿ, ψ, n), ψ. AL[n] * ψ. C[n], 1 , :SR ; ishermitian= true , tol= krylov_tol
284- )
285- C̃[n - 1 ] = Cvecsₙ₋₁[1 ]
286- C̃[n] = Cvecsₙ[1 ]
287- Ãᶜ[n] = Avecsₙ[1 ]
285+
286+ C̃[n - 1 ] = Cvecsₙ₋₁
287+ C̃[n] = Cvecsₙ
288+ Ãᶜ[n] = Avecsₙ
288289
289290 function ortho_overlap (AC, C)
290291 AL, _ = polar (AC * dag (C), uniqueinds (AC, C))
@@ -324,16 +325,17 @@ function vumps_iteration_sequential(
324325 return ψ, (eᴸ, eᴿ)
325326end
326327
327- function vumps_iteration_parallel (
328+ function tdvp_iteration_parallel (
329+ solver:: Function ,
328330 ∑h:: InfiniteITensorSum ,
329331 ψ:: InfiniteCanonicalMPS ;
330332 (ϵᴸ!)= fill (1e-15 , nsites (ψ)),
331333 (ϵᴿ!)= fill (1e-15 , nsites (ψ)),
332- eigsolve_tol = (x -> x / 100 ),
334+ solver_tol = (x -> x / 100 ),
333335)
334336 Nsites = nsites (ψ)
335337 ϵᵖʳᵉˢ = max (maximum (ϵᴸ!), maximum (ϵᴿ!))
336- krylov_tol = ϵᵖʳᵉˢ / 100
338+ _solver_tol = solver_tol ( ϵᵖʳᵉˢ)
337339 ψᴴ = dag (ψ)
338340 ψ′ = ψᴴ'
339341 # XXX : make this prime the center sites
@@ -381,22 +383,21 @@ function vumps_iteration_parallel(
381383 for n in 2 : Nsites
382384 hᴸ[n] = hᴸ[n - 1 ] * ψ. AL[n] * ψ̃. AL[n] + hᴸ[n]
383385 end
384- Hᴸ = left_environment (hᴸ, ψ; tol= krylov_tol )
386+ Hᴸ = left_environment (hᴸ, ψ; tol= _solver_tol )
385387
386388 for n in 2 : Nsites
387389 hᴿ[n] = hᴿ[n + 1 ] * ψ. AR[n + 1 ] * ψ̃. AR[n + 1 ] + hᴿ[n]
388390 end
389- Hᴿ = right_environment (hᴿ, ψ; tol= krylov_tol )
391+ Hᴿ = right_environment (hᴿ, ψ; tol= _solver_tol )
390392
391393 C̃ = InfiniteMPS (Vector {ITensor} (undef, Nsites))
392394 Ãᶜ = InfiniteMPS (Vector {ITensor} (undef, Nsites))
393395 for n in 1 : Nsites
394- Cvalsₙ, Cvecsₙ, Cinfoₙ = eigsolve (
395- Hᶜ (∑h, Hᴸ, Hᴿ, ψ, n), ψ. C[n], 1 , :SR ; ishermitian= true , tol= krylov_tol
396- )
397- Avalsₙ, Avecsₙ, Ainfoₙ = eigsolve (
398- Hᴬᶜ (∑h, Hᴸ, Hᴿ, ψ, n), ψ. AL[n] * ψ. C[n], 1 , :SR ; ishermitian= true , tol= krylov_tol
396+ Cvalsₙ, Cvecsₙ, Cinfoₙ = solver (Hᶜ (∑h, Hᴸ, Hᴿ, ψ, n), time_step, ψ. C[n], _solver_tol)
397+ Avalsₙ, Avecsₙ, Ainfoₙ = solver (
398+ Hᴬᶜ (∑h, Hᴸ, Hᴿ, ψ, n), time_step, ψ. AL[n] * ψ. C[n], _solver_tol
399399 )
400+
400401 C̃[n] = Cvecsₙ[1 ]
401402 Ãᶜ[n] = Avecsₙ[1 ]
402403 end
@@ -421,28 +422,32 @@ function vumps_iteration_parallel(
421422 return InfiniteCanonicalMPS (Ãᴸ, C̃, Ãᴿ), (eᴸ, eᴿ)
422423end
423424
424- function vumps (
425+ function tdvp (
426+ solver:: Function ,
425427 ∑h,
426428 ψ;
427429 maxiter= 10 ,
428430 tol= 1e-8 ,
429431 outputlevel= 1 ,
430432 multisite_update_alg= " sequential" ,
431- eigsolve_tol= (x -> x / 100 ),
433+ solver_tol= (x -> x / 100 ),
434+ time_step,
432435)
433436 N = nsites (ψ)
434437 (ϵᴸ!) = fill (tol, nsites (ψ))
435438 (ϵᴿ!) = fill (tol, nsites (ψ))
436439 outputlevel > 0 &&
437440 println (" Running VUMPS with multisite_update_alg = $multisite_update_alg " )
438441 for iter in 1 : maxiter
439- ψ, (eᴸ, eᴿ) = vumps_iteration (
442+ ψ, (eᴸ, eᴿ) = tdvp_iteration (
443+ solver,
440444 ∑h,
441445 ψ;
442446 (ϵᴸ!)= (ϵᴸ!),
443447 (ϵᴿ!)= (ϵᴿ!),
444448 multisite_update_alg= multisite_update_alg,
445- eigsolve_tol= eigsolve_tol,
449+ solver_tol= solver_tol,
450+ time_step= time_step,
446451 )
447452 ϵᵖʳᵉˢ = max (maximum (ϵᴸ!), maximum (ϵᴿ!))
448453 maxdimψ = maxlinkdim (ψ[0 : (N + 1 )])
@@ -459,6 +464,38 @@ function vumps(
459464 return ψ
460465end
461466
467+ function vumps_solver (M, time_step, v₀, solver_tol)
468+ λ⃗, v⃗, info = eigsolve (M, v₀, 1 , :SR ; ishermitian= true , tol= solver_tol)
469+ return λ⃗[1 ], v⃗[1 ], info
470+ end
471+
472+ return function tdvp_solver (M, time_step, v₀, solver_tol)
473+ v, info = exponentiate (M, time_step, v₀; ishermitian= true , tol= solver_tol)
474+ return nothing , v, info
475+ end
476+
477+ function vumps (
478+ args... ; time_step= - Inf , eigsolve_tol= (x -> x / 100 ), solver_tol= eigsolve_tol, kwargs...
479+ )
480+ @assert isinf (time_step) && time_step < 0
481+ println (" Using VUMPS solver with time step $time_step " )
482+ return tdvp (vumps_solver, args... ; time_step= time_step, solver_tol= solver_tol, kwargs... )
483+ end
484+
485+ function tdvp (args... ; time_step, solver_tol= (x -> x / 100 ), kwargs... )
486+ solver = if ! isinf (time_step)
487+ println (" Using TDVP solver with time step $time_step " )
488+ tdvp_solver
489+ elseif time_step < 0
490+ # Call VUMPS instead
491+ println (" Using VUMPS solver with time step $time_step " )
492+ vumps_solver
493+ else
494+ error (" Time step $time_step not supported." )
495+ end
496+ return tdvp (solver, args... ; time_step= time_step, solver_tol= solver_tol, kwargs... )
497+ end
498+
462499# #################################################################
463500# Old functionality, only used for testing
464501
0 commit comments