Solvers

ITensorNetworks.jl provides sweep-based solvers for variational problems on tree tensor networks. All solvers follow the same high-level pattern:

  1. Start from an initial ITensorNetwork guess.
  2. Sweep over the network, solving a small local problem at each site or pair of sites.
  3. After each local solve, truncate the updated bond to control bond dimension growth.
  4. Repeat for nsweeps sweeps.

Eigenvalue Problems — eigsolve / dmrg

eigsolve finds the lowest eigenvalue and corresponding eigenvector of an operator (e.g. a Hamiltonian) using a DMRG-like variational sweep algorithm. dmrg is an alias for eigsolve.

using ITensorNetworks: dmrg, dst, edges, normalize, random_ttn, siteinds, src, ttn
using ITensors: OpSum
using NamedGraphs.NamedGraphGenerators: named_comb_tree

# Build a Heisenberg Hamiltonian on a comb tree
g = named_comb_tree((3, 2))
s = siteinds("S=1/2", g)
H = let h = OpSum()
    for e in edges(g)
        h += 0.5, "S+", src(e), "S-", dst(e)
        h += 0.5, "S-", src(e), "S+", dst(e)
        h += "Sz", src(e), "Sz", dst(e)
    end
    ttn(h, s)
end

# Random initial state (normalise first!)
psi0 = normalize(random_ttn(s; link_space = 2))

# Run DMRG
energy, psi = dmrg(H, psi0;
    nsweeps = 2,
    nsites = 2,
    factorize_kwargs = (; cutoff = 1e-10, maxdim = 10),
    outputlevel = 1,
)
(-2.4747448713867213, ITensorNetworks.TreeTensorNetwork{Tuple{Int64, Int64}} with 6 vertices:
6-element NamedGraphs.OrderedDictionaries.OrderedIndices{Tuple{Int64, Int64}}:
 (1, 1)
 (2, 1)
 (3, 1)
 (1, 2)
 (2, 2)
 (3, 2)

and 5 edge(s):
(1, 1) => (2, 1)
(1, 1) => (1, 2)
(2, 1) => (3, 1)
(2, 1) => (2, 2)
(3, 1) => (3, 2)

with vertex data:
6-element Dictionaries.Dictionary{Tuple{Int64, Int64}, Any}:
 (1, 1) │ ((dim=2|id=365|"S=1/2,Site,n=1×1"), (dim=4|id=908|"1×1,2×1"), (dim=2|…
 (2, 1) │ ((dim=4|id=273|"2×1,3×1"), (dim=2|id=516|"2×1,2×2"), (dim=2|id=883|"S…
 (3, 1) │ ((dim=2|id=761|"S=1/2,Site,n=3×1"), (dim=2|id=893|"3×1,3×2"), (dim=4|…
 (1, 2) │ ((dim=2|id=791|"1×1,1×2"), (dim=2|id=584|"S=1/2,Site,n=1×2"))
 (2, 2) │ ((dim=2|id=4|"S=1/2,Site,n=2×2"), (dim=2|id=516|"2×1,2×2"))
 (3, 2) │ ((dim=2|id=118|"S=1/2,Site,n=3×2"), (dim=2|id=893|"3×1,3×2")))
ITensorNetworks.eigsolveFunction
eigsolve(operator, init_state; nsweeps, nsites=1, factorize_kwargs, sweep_kwargs...) -> (eigenvalue, state)

Find the lowest eigenvalue and corresponding eigenvector of operator using a DMRG-like sweep algorithm on a TreeTensorNetwork.

Arguments

  • operator: The operator to diagonalize, typically a TreeTensorNetwork representing a Hamiltonian constructed from an OpSum (e.g. via ttn(opsum, sites)).
  • init_state: Initial guess for the eigenvector as a TreeTensorNetwork.
  • nsweeps: Number of sweeps over the network.
  • nsites=1: Number of sites optimized simultaneously per local update step (1 or 2).
  • factorize_kwargs: Keyword arguments controlling bond truncation after each local solve, e.g. (; cutoff=1e-10, maxdim=50).
  • outputlevel=0: Level of output to print (0 = no output, 1 = sweep level information, 2 = step details)

Returns

A tuple (eigenvalue, state) where eigenvalue is the converged lowest eigenvalue and state is the optimized TreeTensorNetwork eigenvector.

Example

energy, psi = eigsolve(H, psi0;
    nsweeps = 10,
    nsites = 2,
    factorize_kwargs = (; cutoff = 1e-10, maxdim = 50),
    outputlevel = 1
)

See also: dmrg, time_evolve.

source
ITensorNetworks.dmrgFunction
dmrg(operator, init_state; kwargs...) -> (eigenvalue, state)

Find the lowest eigenvalue and eigenvector of operator using the Density Matrix Renormalization Group (DMRG) algorithm. This is an alias for eigsolve.

See eigsolve for the full description of arguments and keyword arguments.

Example

energy, psi = dmrg(H, psi0;
    nsweeps = 10,
    nsites = 2,
    factorize_kwargs = (; cutoff = 1e-10, maxdim = 50)
)
source

Time Evolution — time_evolve

ITensorNetworks.time_evolveFunction
time_evolve(operator, time_points, init_state; sweep_kwargs...) -> state

Time-evolve init_state under operator using the Time-Dependent Variational Principle (TDVP) algorithm.

The state is evolved from t=0 through the successive time points in time_points. The operator should represent the Hamiltonian H; internally the evolution exp(-i H t) is applied via a "local solver".

Arguments

  • operator: The Hamiltonian as a tensor network operator (e.g. built from an OpSum).
  • time_points: A vector (or range) of time values. Can be real or complex.
  • init_state: The initial tensor network state.

Keyword Arguments

  • nsites=2: Number of sites optimized per local update (1 or 2).
  • order=4: Order of the TDVP sweep pattern and time step increments.
  • factorize_kwargs: Keyword arguments for bond truncation, e.g. (; cutoff=1e-10, maxdim=50).
  • outputlevel=0: Verbosity level (0=silent, 1=print after each time step).
  • solver_kwargs: Additional keyword arguments forwarded to the local solver (time stepping algorithm).

Returns

The evolved state at last(time_points).

Example

times = 0.1:0.1:1.0
psi_t = time_evolve(H, times, psi0;
    nsites = 2,
    order = 4,
    factorize_kwargs = (; cutoff = 1e-10, maxdim = 50),
    outputlevel = 1
)
source