supergrad.time_evolution.sesolve

Contents

supergrad.time_evolution.sesolve#

supergrad.time_evolution.sesolve(hamiltonian, psi0: Array, tlist: Array, args=None, options={}, solver='ode_expm')[source]#

Schrödinger equation evolution of a state vector or a set of state vectors for a given Hamiltonian.

Evolve the state vector (psi0) using a given Hamiltonian (H). Alternatively evolve a set of states use vmap transformation.

Time-dependence formats

There are two major formats for specifying a time-dependent scalar:

  • Python function

  • array

For function format, the function signature must be f(t: float, args: dict) -> complex, for example

def f1_t(t, args):
    return np.exp(-1j * t * args["w1"])

def f2_t(t, args):
    return np.cos(t * args["w2"])

H = _parse_sesolve([H0, [H1, f1_t], [H2, f2_t]], args={"w1":1., "w2":2.})

For numpy array format, the array must be an 1d of dtype jnp.float64 or jnp.complex128. A list of times (jnp.float64) at which the coeffients must be given as tlist. The coeffients array must have the same length as the tlist. The times of the tlist do not need to be equidistant, but must be sorted. By default, a linear interpolation will be used for the coefficient at time t. Examples of array-format usage are:

tlist = np.logspace(-5, 0, 100)
H = _parse_sesolve([H0, [H1, np.exp(-1j * tlist)], [H2, np.cos(2. * tlist)]],
            tlist=tlist)

Mixing time formats is allowed. It is not possible to parse a single hamiltonian that contains different tlist values.

Parameters:
  • hamiltonian (list, array) – System Hamiltonian as a ndarray , list of ndarray and coefficient. List format and options can be found in description.

  • psi0 (array) – Initial state vector (ket) or initial unitary operator psi0 = U. Alternatively evolve a set of states use vmap transformation.

  • tlist (list, array) – List of times for \(t\).

  • args (dict, optional) – Dictionary of scope parameters for time-dependent Hamiltonians.

  • options (dict, optional) – Options for the ODE solver. multi_device (bool): True for enable multi-device parallelism evolution support, if many states are evolved simultaneously, the compiler can automatically batch the states to different devices. diag_ops (bool): It is only for ode_expm, if True the Hermitian Hamiltonian will be convert to diagonal form before exponentiation.

  • solver (str, optional) – select differentiable ODE solver. odeint for using Dormand-Prince ODE integration, ode_expm for using the matrix exponentiation at each time step.

Returns: Values of the solution state vector at each time point in tlist,

represented as an array with the same shape/structure as psi0 except with a new leading axis of length len(t). if a set of states be evolved simultaneously, the returns with another new leading axis of length len(psi0).