Time evolution

Schwinger.jl supports time-evolving states using all three backends:

The evolve function evolves a state forwards in time, and monitors any given observables. It returns a final state along with a DataFrame of the observables. For example, here is a simulation of flux unwinding.

using Schwinger, Plots

lat = Lattice(10; F = 1, L = 2, periodic = true)
gs = groundstate(Hamiltonian(lat; backend=:ED))

_, df = evolve(WilsonLoop(lat; backend=:ED) * gs, 15;
    nsteps = 30,
    observable = (ψ, t) -> sum(electricfields(ψ))/10
)

scatter(df.time, df.observable, xlabel = "gt", ylabel = "Average electric field", label = "Schwinger.jl")
plot!(0:.1:15, [cos(t/√(π)) for t in 0:.1:15], label = "Exact")
Example block output
Schwinger.evolveFunction
evolve(state::EDState, t::Real; nsteps::Int = 1, tol = 1E-12, observable = nothing, kwargs...)

Evolve an exact diagonalization state by time t using matrix exponentiation.

Arguments

  • state::EDState: The state to evolve.
  • t::Real: The time to evolve by.
  • nsteps::Int = 1: Number of time steps to divide the evolution into.
  • tol = 1E-12: Tolerance for the matrix exponentiation.
  • observable::Union{Nothing,Function,Dict} = nothing: Observable(s) to monitor during evolution. Can be a single function (state, t) -> value or a dictionary of name => function pairs.

Returns

  • EDState: The evolved state.
  • obs: Observer object containing the history of observables and metadata.

Examples

evolved_state, obs = evolve(state, 1.0; nsteps=10, observable=s->energy(s))
source
evolve(state::ITensorState, t::Real; nsteps::Int = 1, observable = nothing, kwargs...)

Evolve an ITensor MPS state by imaginary time t using TDVP.

Arguments

  • state::ITensorState: The state to evolve.
  • t::Real: The time to evolve by (will be multiplied by -im for imaginary time evolution).
  • nsteps::Int = 1: Number of time steps for the TDVP algorithm.
  • maxlinkdim::Union{Nothing,Int} = nothing: Maximum bond dimension to keep during the evolution (forwarded to ITensorMPS tdvp as maxdim).
  • observable::Union{Nothing,Function,Dict} = nothing: Observable(s) to monitor during evolution. Can be a single function (state, t) -> value or a dictionary of name => function pairs.
  • kwargs...: Additional keyword arguments passed to the TDVP algorithm.

Returns

  • ITensorState: The evolved state.
  • obs: Observer object containing the history of observables and metadata.

Notes

  • Uses ITensors.jl TDVP algorithm.
  • Time is tracked as real values (divided by -im) in the observer.
source
evolve(state::MPSKitState, t::Real; nsteps::Int = 1, two_site = false,
       maxlinkdim = nothing, trscheme = nothing, observable = nothing, kwargs...)

Evolve an MPSKit MPS state by real time t using MPSKit's TDVP algorithm.

Arguments

  • state::MPSKitState: The state to evolve.
  • t::Real: The time to evolve by.
  • nsteps::Int = 1: Number of time steps to divide the evolution into.
  • two_site::Bool = false: Use the two-site integrator (TDVP2) instead of the single-site TDVP. Two-site updates let the bond dimension grow and be truncated during the evolution (needed e.g. when the initial state has a small bond dimension or when entanglement grows); single-site TDVP preserves the bond dimension of the input state exactly.
  • maxlinkdim::Union{Nothing,Int} = nothing: Maximum bond dimension to keep at each two-site truncation. Only used when two_site = true. If both maxlinkdim and trscheme are nothing, no truncation is applied.
  • trscheme = nothing: A full TensorKit truncation scheme (e.g. trunctol(; rtol = 1e-10)), taking precedence over maxlinkdim. Only used when two_site = true.
  • observable::Union{Nothing,Function,Dict} = nothing: Observable(s) to monitor. A single function (state, t) -> value, or a dictionary of name => function.
  • checkpoint::Union{Nothing,Function} = nothing: if given, called as checkpoint(state, current_time, step, observer) every checkpoint_every steps. The observer carries the full history accumulated so far, so a single (overwritten) file can hold both the latest wavefunction and the whole trajectory for resuming/inspection.
  • checkpoint_every::Int = 1: how often (in steps) to invoke checkpoint.
  • kwargs...: Additional keyword arguments forwarded to MPSKit.timestep.

Returns

  • MPSKitState: The evolved state.
  • obs: Observer object containing the history of observables and metadata.
source