Performing DMRG
Functions to perfom (and control) DMRG runs.
DMRGParams
TenNetLib.jl defines a struct, called DMRGParams
, to control DMRG simulations.
TenNetLib.DMRGParams
— Typemutable struct DMRGParams
maxdim::Vector{Int}
nsweeps::Vector{Int}
cutoff::Vector{Float64}
noise::Vector{Float64}
noisedecay::Vector{Float64}
disable_noise_after::Vector{Int}
end
Holds parameters to control DMRG sweeps.
maxdim::Vector{Int}
: Maximum allowed MPS bond/link dimensions at each stages of DMRG.nsweeps::Vector{Int}
: Number of sweeps to be performed at each statges of DMRG.cutoff::Vector{Float64}
: Cutoff for SVD truncation at each stages of DMRG.noise::Vector{Float64}
: Noise level at each stages of DMRG.noisedecay::Vector{Float64}
: Decay of noise level at each states of DMRG. Noise is divided bynoisedecay
after each sweep.disable_noise_after::Vector{Int}
: Switch of noise after this many sweeps at each
states of DMRG.
All these Vector
s must have same dimension.
TenNetLib.DMRGParams
— Methodfunction DMRGParams(;maxdim::Vector{Int}, nsweeps::Vector{Int},
cutoff::Union{Vector{Float64}, Float64, Int} = _Float64_Threshold,
noise::Union{Vector{Float64}, Float64, Int} = 0.0,
noisedecay::Union{Vector{Float64}, Float64, Int} = 1.0,
disable_noise_after::Union{Vector{Int}, Int} = typemax(Int))
Constructor for DMRGParams
. Takes only named arguments.
maxdim::Vector{Int}
: Maximum allowed MPS bond/link dimensions at each stages of DMRG.nsweeps::Vector{Int}
: Number of sweeps to be performed at each statges of DMRG.cutoff::Union{Int, Float64, Vector{Float64}} = Float64_threshold()
: Cutoff for SVD truncation at each stages of DMRG. IfFloat64
,cutoff
remains same throughout the DMRG simulation.noise::Union{Float64, Int, Vector{Float64}} = 0.0
: Noise level at each stages of DMRG. IfFloat64
orInt
, initialnoise
remains same throughout the DMRG simulation.noisedecay::Union{Float64, Int, Vector{Float64}} = 1.0
: Decay of noise level at each states of DMRG. Noise is divided bynoisedecay
after each sweep. IfFloat64
orInt
,noisedecay
remains same throughout the DMRG simulation.disable_noise_after::Union{Int, Vector{Int}} = typemax(Int)
: Switch of noise after this many sweeps at each states of DMRG. IfInt
,disable_noise_after
remains same throughout the DMRG simulation.
Base.copy
— MethodBase.copy(params::DMRGParams)
Shallow copy DMRGParams.
A lower level DMRG function
Following function modifies StateEnvs
in-place. Skip this function if you want to avoid lower-level abstraction.
TenNetLib.dmrg!
— Methodfunction dmrg!(sysenv::StateEnvs, params::DMRGParams, nsite::Int; kwargs...)
Performs DMRG.
Arguments:
sysenv::StateEnvs
.params::DMRGParams
.nsite::Int
of the environment. Either1
or2
for one-site or two-site update respectively.
Named arguments and their default values:
normalize::Bool = true
: Whether to normalize after update.svd_alg::String = "divide_and_conquer"
.weight::Float64 = -1.0
: Weight for the excited state DMRG. Must be set to greater than0
for the excited state DMRG.outputlevel::Int = 1
. If0
prints no information, for1
outputs after every fullsweep, if2
prints at every update step.
Convergence criteria:
energyErrGoal
: DMRG (at a particluar stage) stops when energy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage.noise
must be belowFloat64_threshold()
to trigger this early stopping.entropyErrGoal
: DMRG (at a particluar stage) stops when mid-chain entropy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage.noise
must be belowFloat64_threshold()
to trigger this early stopping.
When both energyErrGoal
and entropyErrGoal
are given, both conditions must be satisfied to trigger this early stopping.
Named arguments for solver
and their default values:
See the documentation of KrylovKit.jl.
ishermitian::Bool = true
.solver_tol::Float64 = 1E-14
.solver_krylovdim::Int = 5
.solver_maxiter::Int = 2
.solver_outputlevel::Int = 0
.: Seeverbosity
in KrylovKit.jl.solver_eager::Bool = false
.solver_check_convergence::Bool = false
.
Return values:
SweepData
Higher level DMRG functions
Standard two- and single-site DMRG functions. Single-site DMRG can increase the bond-dimension if noise > Float64_threshold()
.
TenNetLib.dmrg2
— Methodfunction dmrg2(psi0::MPS, H::MPO, params::DMRGParams; kwargs...)
function dmrg2(psi0::MPS, H::CouplingModel, params::DMRGParams; kwargs...)
function dmrg2(psi0::MPS, Hs::Vector{MPO}, params::DMRGParams; kwargs...)
function dmrg2(psi0::MPS, H::MPO, Ms::Vector{MPS}, params::DMRGParams; kwargs...)
function dmrg2(psi0::MPS, Hs::Vector{MPO}, Ms::Vector{MPS}, params::DMRGParams; kwargs...)
function dmrg2(psi0::MPS, H::CouplingModel, Ms::Vector{MPS}, params::DMRGParams; kwargs...)
Performs two-site DMRG.
Arguments:
psi0::MPS
: Initial MPS.H::MPO
,H::CouplingModel
,Hs::Vector{MPO}
,Ms::Vector{MPS}
.params::DMRGParams
.
Named arguments and their default values:
normalize::Bool = true
: Whether to normalize after update.svd_alg::String = "divide_and_conquer"
.weight::Float64 = -1.0
: Weight for the excited state DMRG. Must be set to greater than0
for the excited state DMRG.outputlevel::Int = 1
. If0
prints no information, for1
outputs after every fullsweep, if2
prints at every update step.
Convergence criteria:
energyErrGoal
: DMRG (at a particluar stage) stops when energy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage.noise
must be belowFloat64_threshold()
to trigger this early stopping.entropyErrGoal
: DMRG (at a particluar stage) stops when mid-chain entropy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage.noise
must be belowFloat64_threshold()
to trigger this early stopping.
When both energyErrGoal
and entropyErrGoal
are given, both conditions must be satisfied to trigger this early stopping.
Named arguments for eig_solver
and their default values:
See the documentation of KrylovKit.jl.
ishermitian::Bool = true
.solver_tol::Float64 = 1E-14
.solver_krylovdim::Int = 5
.solver_maxiter::Int = 2
.solver_outputlevel::Int = 0
: Seeverbosity
in KrylovKit.jl.solver_eager::Bool = false
.solver_check_convergence::Bool = false
.
Return values:
::Float64
: Energy.::MPS
: The state psi.
TenNetLib.dmrg1
— Methodfunction dmrg1(psi0::MPS, H::MPO, params::DMRGParams; kwargs...)
function dmrg1(psi0::MPS, H::CouplingModel, params::DMRGParams; kwargs...)
function dmrg1(psi0::MPS, Hs::Vector{MPO}, params::DMRGParams; kwargs...)
function dmrg1(psi0::MPS, H::MPO, Ms::Vector{MPS}, params::DMRGParams; kwargs...)
function dmrg1(psi0::MPS, Hs::Vector{MPO}, Ms::Vector{MPS}, params::DMRGParams; kwargs...)
function dmrg1(psi0::MPS, H::CouplingModel, Ms::Vector{MPS}, params::DMRGParams; kwargs...)
Performs single-site DMRG. All other details are same as in dmrg2
.