quspin.tools.misc.mean_level_spacing

quspin.tools.misc.mean_level_spacing(E, verbose=True)[source]

Calculates the mean-level spacing of an energy spectrum.

See mean level spacing, \(\langle\tilde r_\mathrm{W}\rangle\), in arXiv:1212.5611 for more details.

For Wigner-Dyson statistics, we have \(\langle\tilde r_\mathrm{W}\rangle\approx 0.53\), while for Poisson statistics: \(\langle\tilde r_\mathrm{W}\rangle\approx 0.38\).

Parameters:
Enumpy.ndarray

Ordered list of ascending, NONdegenerate energies. If E contains a repeating value, the function returns nan.

verbosebool, optional

Toggles warning message about degeneracies of the spectrum E.

Returns:
float

mean-level spacing.

nan

if spectrum E has degeneracies.

Examples

The following example shows how to calculate the mean level spacing \(\langle\tilde r_\mathrm{W}\rangle\) for the spectrum of the ergodic Hamiltonian \(H_1=\sum_jJ S^z_{j+1}S^z + hS^x_j + g S^z_j\).

 1from quspin.basis import spin_basis_1d  # Hilbert space spin basis
 2from quspin.tools.measurements import mean_level_spacing
 3import numpy as np  # generic math functions
 4
 5#
 6L = 12  # syste size
 7# coupling strenghts
 8J = 1.0  # spin-spin coupling
 9h = 0.8945  # x-field strength
10g = 0.945  # z-field strength
11# create site-coupling lists
12J_zz = [[J, i, (i + 1) % L] for i in range(L)]  # PBC
13x_field = [[h, i] for i in range(L)]
14z_field = [[g, i] for i in range(L)]
15# create static and dynamic lists
16static_2 = [["zz", J_zz], ["x", x_field], ["z", z_field]]
17dynamic = []
18# create spin-1/2 basis
19basis = spin_basis_1d(L, kblock=0, pblock=1)
20# set up Hamiltonian
21H2 = hamiltonian(static_2, dynamic, basis=basis, dtype=np.float64)
22# compute eigensystem of H2
23E2 = H2.eigvalsh()
24# calculate mean level spacing of spectrum E2
25r = mean_level_spacing(E2)
26print("mean level spacing is", r)