quspin.tools.evolution.ED_state_vs_time

quspin.tools.evolution.ED_state_vs_time(psi, E, V, times, iterate=False)[source]

Calculates the time evolution of initial state using a complete eigenbasis.

The time evolution is carried out under the Hamiltonian \(H\) with eigenenergies E and eigenstates V.

Parameters:
psinumpy.ndarray

Initial state.

Vnumpy.ndarray

Unitary matrix containing all eigenstates of the Hamiltonian \(H\) in its columns.

Enumpy.ndarray

Eigenvalues of the Hamiltonian \(H\), listed in the order which corresponds to the columns of V.

timesnumpy.ndarray

Vector of time to evaluate the time evolved state at.

iteratebool, optional

If set to True, the function returns the generator of the time evolved state.

Returns:
obj
Either of the following:
  • numpy.ndarray with the time evolved states as rows.

  • generator which generates time-dependent states one by one.

Examples

The following example shows how to time-evolve a state \(\psi\) using the entire eigensystem \((E_1,V_1)\) of a Hamiltonian \(H_1=\sum_j hS^x_j + g S^z_j\).

 1from quspin.basis import spin_basis_1d  # Hilbert space spin basis
 2from quspin.tools.measurements import ED_state_vs_time
 3import numpy as np  # generic math functions
 4
 5#
 6L = 12  # syste size
 7# coupling strenghts
 8h = 0.8945  # x-field strength
 9g = 0.945  # z-field strength
10# create site-coupling lists
11x_field = [[h, i] for i in range(L)]
12z_field = [[g, i] for i in range(L)]
13# create static and dynamic lists
14static_1 = [["x", x_field], ["z", z_field]]
15dynamic = []
16# create spin-1/2 basis
17basis = spin_basis_1d(L, kblock=0, pblock=1)
18# set up Hamiltonian
19H1 = hamiltonian(static_1, dynamic, basis=basis, dtype=np.float64)
20# compute eigensystem of H1
21E1, V1 = H1.eigh()
22psi1 = V1[:, 14]  # pick any state as initial state
23# time-evolve state by decomposing it in an eigensystem (E1,V1)
24times = np.linspace(0.0, 5.0, 10)
25psi1_time = ED_state_vs_time(psi1, E1, V1, times, iterate=False)
26print(type(psi1_time))
27# same as above but using a generator
28psi1_t = ED_state_vs_time(psi1, E1, V1, times, iterate=True)
29print(type(psi1_t))
30for i, psi1_n in enumerate(psi1_t):
31    print("psi1_n is now the evolved state at time[%i]" % (i))