DMRGObserver
A DMRGObserver is a type of observer which offers certain useful, general purpose capabilities for DMRG calculations such as measuring custom local observables at each step and stopping DMRG early if certain energy convergence conditions are met.
Sample Usage
In the following example, we have already made a Hamiltonian MPO H
and initial MPS psi0
for a system of spins whose sites have an associated "Sz" operator defined. We construct a DMRGObserver
which measures "Sz" on each site at each step of DMRG, and also stops the calculation early if the energy no longer changes to a relative precision of 1E-7.
Sz_observer = DMRGObserver(["Sz"],sites,energy_tol=1E-7)
energy, psi = dmrg(H,psi0,sweeps,observer=Sz_observer)
for (sw,Szs) in enumerate(measurements(Sz_observer)["Sz"])
println("Total Sz after sweep $sw = ", sum(Szs)/N)
end
Constructors
ITensorMPS.DMRGObserver
— MethodDMRGObserver(;energy_tol=0.0,
minsweeps=2,
energy_type=Float64)
Construct a DMRGObserver by providing the energy tolerance used for early stopping, and minimum number of sweeps that must be done.
Optional keyword arguments:
- energy_tol: if the energy from one sweep to the next no longer changes by more than this amount, stop after the current sweep
- minsweeps: do at least this many sweeps
- energy_type: type to use when storing energies at each step
ITensorMPS.DMRGObserver
— MethodDMRGObserver(ops::Vector{String},
sites::Vector{<:Index};
energy_tol=0.0,
minsweeps=2,
energy_type=Float64)
Construct a DMRGObserver, provide an array of ops
of operator names which are strings recognized by the op
function. Each of these operators will be measured on every site during every step of DMRG and the results recorded inside the DMRGOberver for later analysis. The array sites
is the basis of sites used to define the MPS and MPO for the DMRG calculation.
Optionally, one can provide an energy tolerance used for early stopping, and minimum number of sweeps that must be done.
Optional keyword arguments:
- energy_tol: if the energy from one sweep to the next no longer changes by more than this amount, stop after the current sweep
- minsweeps: do at least this many sweeps
- energy_type: type to use when storing energies at each step
Methods
ITensorMPS.measurements
— Methodmeasurements(o::DMRGObserver)
After using a DMRGObserver object o
within a DMRG calculation, retrieve a dictionary of measurement results, with the keys being operator names and values being DMRGMeasurement objects.
ITensorMPS.DMRGMeasurement
— TypeA DMRGMeasurement object is an alias for Vector{Vector{Float64}}
, in other words an array of arrays of real numbers.
Given a DMRGMeasurement M
,the result for the measurement on sweep n
and site i
as M[n][i]
.
ITensorMPS.energies
— Methodenergies(o::DMRGObserver)
After using a DMRGObserver object o
within a DMRG calculation, retrieve an array of the energy after each sweep.