Sweeping through the MPS
At a lower level of abstraction, TenNetLib.jl allows to control each fullsweep (left-to-right and right-to-left) manually to update StateEnvs.
Skip this part if you want to avoid lower-level abstraction.
SweepData
TenNetLib.jl defines a struct, called SweepData, to store essential data after each fullsweep.
TenNetLib.SweepData — Typemutable struct SweepData
sweepcount::Int
maxchi::Vector{Int}
energy::Vector{Union{Float64, ComplexF64}}
entropy::Vector{Float64}
maxtruncerr::Vector{Float64}
lasteigs::Vector{Vector{Float64}}
endHolds historical data after each (full)sweep. Requires for convergence check etc.
sweepcount::Int: Number of fullsweeps performed.maxchi::Vector{Int}: Maximum MPS bond/link dimensions after every sweep.energy::Vector{Union{Float64, ComplexF64}}: Energies after every sweep.entropy::Vector{Float64}: Mid-chain entropies after every sweep.maxtrucerr::Vector{Float64}: Maximum truncation error after every sweep.lasteigs::Vector{Vector{Float64}}: Spectrum of eigenvalues at each bond after previous halfsweep.
Default constructor:
SweepData(): Initialize an emptySweepDataobject.
Base.copy — MethodBase.copy(swdata::SweepData)Shallow copy of SweepData.
Perform a fullsweep
TenNetLib.fullsweep! — Methodfunction fullsweep!(sysenv::StateEnvs, solver, nsite::Int, swdata::SweepData;
kwargs...)Perform a fullsweep (left-to-right and right-to-left) by solver.
Arguments:
sysenv::StateEnvs.solver: Solver for update. Available ones:eig_solverandexp_solver.nsite::Intof the environment. Either1or2for one-site or two-site update respectively.swdata::SweepData.
Named arguments and their default values:
time_step::Union{Float64, ComplexF64, Nothing} = nothing: Time step for TDVP.normalize::Bool = true: Whether to normalize after update.maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.mindim::Int = 1: Minimum bond dimension after SVD truncation.cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.svd_alg::String = "divide_and_conquer".noise::Float64 = 0.0.reverse_step::Bool = falseiftime_step = nothing,trueotherwise.outputlevel::Int = 1. If0prints no information, for1outputs after every fullsweep, if2prints at every update step.
Named arguments for solver and their default values:
See the documentation of KrylovKit.jl.
ishermitian::Bool = true.solver_tol::Float64 = 1E-14ifeig_solver,1E-12ifexp_solver.solver_krylovdim::Int = 5ifeig_solver,30ifexp_solver.solver_maxiter::Int = 2ifeig_solver,100ifexp_solver.solver_outputlevel::Int = 0: Seeverbosityin KrylovKit.jl.solver_eager::Bool = falseifeig_solver,trueifexp_solver.solver_check_convergence::Bool = falseifeig_solver,trueifexp_solver.
Return values:
::Union{Float64, ComplexF64}: Change in Energy ΔE. It is complex ifishermitian == false.::Float64: Change in Entropy ΔS
swdata::SweepData gets updated.
Perform a dynamical fullsweep
TenNetLib.jl defines the following function to dynamically decide whether to perform single- or two-site update at each bond, depending on the entropy growth at the previous halfsweep.
TenNetLib.dynamic_fullsweep! — Methodfunction dynamic_fullsweep!(sysenv::StateEnvs, solver, swdata::SweepData;
kwargs...)Perform a dynamic fullsweep (left-to-right and right-to-left) by solver. The very first sweep, as dictated by swdata.sweepcount=0, Global Subspace Expansion (see below) is performed followed by a pure one-site sweep if typeof(sysenv) == StateEnvs{ProjMPO}, else performs a full two-site sweep. At each bond, if the lowest eigenvalue is below eigthreshold or the bond dimension at that bond has reached maxdim at a particular halfsweep, performs single-site update across that bond in the subsequent halfsweep, otherwise performs two-site update.
Arguments:
sysenv::StateEnvs.solver: Solver for update. Available ones:eig_solverandexp_solver.swdata::SweepData.
Named arguments and their default values:
time_step::Union{Float64, ComplexF64, Nothing} = nothing: Time step for TDVP.normalize::Bool = true: Whether to normalize after update.maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.mindim::Int = 1: Minimum bond dimension after SVD truncation.cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.svd_alg::String = "divide_and_conquer".noise::Float64 = 0.0.reverse_step::Bool = falseiftime_step = nothing,trueotherwise.outputlevel::Int = 1. If0prints no information, for1outputs after every fullsweep, if2prints at every update step.eigthreshold::Float64 = 1E-12.extendat::Union{Nothing, Int} = nothing: If specified, at everyextendatth sweep, Global Subspace Expansion is performed followed by a pure one-site sweep iftypeof(sysenv) == StateEnvs{ProjMPO}, else performs a full two-site sweep.
Named arguments for solver and their default values:
See the documentation of KrylovKit.jl.
ishermitian::Bool = true.solver_tol::Float64 = 1E-14ifeig_solver,1E-12ifexp_solver.solver_krylovdim::Int = 3ifeig_solver,30ifexp_solver.solver_maxiter::Int = 1ifeig_solver,100ifexp_solver.solver_outputlevel::Int = 0: Seeverbosityin KrylovKit.jl.solver_eager::Bool = falseifeig_solver,trueifexp_solver.solver_check_convergence::Bool = falseifeig_solver,trueifexp_solver.
Arguments for Global Subspace Expansion and their default values:
extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.extension_applyH_cutoff::Float64 = 0.0: Cutoff for the application of the MPO to the MPS.extension_applyH_maxdim::Int = maxlinkdim(psi) + 1: Maximum bond/link dimension for the application of the MPO to the MPS.extension_cutoff::Float64 = 1E-10: Cutoff for the basis extension step in GSE.
Return values:
::Union{Float64, ComplexF64}: Change in Energy ΔE. It is complex ifishermitian == false.::Float64: Change in Entropy ΔS
swdata::SweepData gets updated.
Global Subspace Expansion
Following Phys. Rev. B 102, 094315 (2020), a Global Subspace Expansion can be performed using Krylov subspace if the environments are created by a single MPO.
TenNetLib.krylov_extend! — Methodfunction krylov_extend!(psi::MPS, H::MPO; kwargs...)Performs Global Subspace Expansion.
Named arguments and their default values:
extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.extension_applyH_cutoff::Float64 = Float64_threshold(): Cutoff for the application the MPO to the MPS.extension_applyH_maxdim::Int = maxlinkdim(psi) + 2: Maximum bond/link dimension of the resulting MPS after the application of the MPO to the MPS.extension_cutoff::Float64 = 1E-7: Cutoff for the basis extension step in GSE.
TenNetLib.krylov_extend! — Methodfunction krylov_extend!(sysenv::StateEnvs{ProjMPO}; kwargs...)Performs Global Subspace Expansion. The StateEnvs must be created by a single MPO.
Named arguments and their default values:
extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.extension_applyH_cutoff::Float64 = Float64_threshold(): Cutoff for the application the MPO to the MPS.extension_applyH_maxdim::Int = maxlinkdim(psi) + 2: Maximum bond/link dimension of the resulting MPS after the application of the MPO to the MPS.extension_cutoff::Float64 = 1E-7: Cutoff for the basis extension step in GSE.