quspin.operators.anti_commutator

quspin.operators.anti_commutator(H1, H2)[source]

Calculates the anticommutator of two Hamiltonians \(H_1\) and \(H_2\).

\[\{H_1,H_2\}_+ = H_1 H_2 + H_2 H_1\]
Parameters:
H1obj

numpy.ndarray or hamiltonian class object to define the Hamiltonian operator as a matrix.

H2obj

numpy.ndarray or hamiltonian class object to define the Hamiltonian operator as a matrix.

Returns:
obj

Anticommutator: \(\{H_1,H_2\}_+ = H_1 H_2 + H_2 H_1\)

Examples

The following script shows how to compute the anticommutator of two hamiltonian objects.

 1    hamiltonian,
 2    commutator,
 3    anti_commutator,
 4)  # Hamiltonians and operators
 5from quspin.basis import spin_basis_1d  # Hilbert space spin basis
 6from quspin.tools.measurements import diag_ensemble
 7import numpy as np  # generic math functions
 8
 9#
10L = 12  # syste size
11# coupling strenghts
12J = 1.0  # spin-spin coupling
13h = 0.8945  # x-field strength
14g = 0.945  # z-field strength
15# create site-coupling lists
16J_zz = [[J, i, (i + 1) % L] for i in range(L)]  # PBC
17x_field = [[h, i] for i in range(L)]
18z_field = [[g, i] for i in range(L)]
19# create static and dynamic lists
20static_1 = [["x", x_field], ["z", z_field]]
21static_2 = [["zz", J_zz], ["x", x_field], ["z", z_field]]
22dynamic = []
23# create spin-1/2 basis
24basis = spin_basis_1d(L, kblock=0, pblock=1)
25# set up Hamiltonian
26H1 = hamiltonian(static_1, dynamic, basis=basis, dtype=np.float64)
27H2 = hamiltonian(static_2, dynamic, basis=basis, dtype=np.float64)
28###### calculate anti-commutator
29anti_comm = anti_commutator(H1, H2)