|
|
|
@ -24,6 +24,7 @@ from hypothesis import given
|
|
|
|
|
from hypothesis import strategies as st
|
|
|
|
|
from numpy.testing import assert_allclose, assert_array_almost_equal
|
|
|
|
|
|
|
|
|
|
from grogupy.globals import TAU_0, TAU_X, TAU_Y, TAU_Z
|
|
|
|
|
from grogupy.utilities import (
|
|
|
|
|
RotM,
|
|
|
|
|
RotMa2b,
|
|
|
|
@ -33,11 +34,7 @@ from grogupy.utilities import (
|
|
|
|
|
make_contour,
|
|
|
|
|
make_kset,
|
|
|
|
|
read_siesta_emin,
|
|
|
|
|
tau_0,
|
|
|
|
|
tau_u,
|
|
|
|
|
tau_x,
|
|
|
|
|
tau_y,
|
|
|
|
|
tau_z,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -45,19 +42,19 @@ from grogupy.utilities import (
|
|
|
|
|
def test_pauli_matrices_properties():
|
|
|
|
|
"""Test fundamental properties of Pauli matrices"""
|
|
|
|
|
# Test anticommutation relations
|
|
|
|
|
assert_array_almost_equal(tau_x @ tau_y + tau_y @ tau_x, np.zeros((2, 2)))
|
|
|
|
|
assert_array_almost_equal(tau_y @ tau_z + tau_z @ tau_y, np.zeros((2, 2)))
|
|
|
|
|
assert_array_almost_equal(tau_z @ tau_x + tau_x @ tau_z, np.zeros((2, 2)))
|
|
|
|
|
assert_array_almost_equal(TAU_X @ TAU_Y + TAU_Y @ TAU_X, np.zeros((2, 2)))
|
|
|
|
|
assert_array_almost_equal(TAU_Y @ TAU_Z + TAU_Z @ TAU_Y, np.zeros((2, 2)))
|
|
|
|
|
assert_array_almost_equal(TAU_Z @ TAU_X + TAU_X @ TAU_Z, np.zeros((2, 2)))
|
|
|
|
|
|
|
|
|
|
# Test square of Pauli matrices equals identity
|
|
|
|
|
assert_array_almost_equal(tau_x @ tau_x, tau_0)
|
|
|
|
|
assert_array_almost_equal(tau_y @ tau_y, tau_0)
|
|
|
|
|
assert_array_almost_equal(tau_z @ tau_z, tau_0)
|
|
|
|
|
assert_array_almost_equal(TAU_X @ TAU_X, TAU_0)
|
|
|
|
|
assert_array_almost_equal(TAU_Y @ TAU_Y, TAU_0)
|
|
|
|
|
assert_array_almost_equal(TAU_Z @ TAU_Z, TAU_0)
|
|
|
|
|
|
|
|
|
|
# Test Hermiticity
|
|
|
|
|
assert_array_almost_equal(tau_x, tau_x.conj().T)
|
|
|
|
|
assert_array_almost_equal(tau_y, tau_y.conj().T)
|
|
|
|
|
assert_array_almost_equal(tau_z, tau_z.conj().T)
|
|
|
|
|
assert_array_almost_equal(TAU_X, TAU_X.conj().T)
|
|
|
|
|
assert_array_almost_equal(TAU_Y, TAU_Y.conj().T)
|
|
|
|
|
assert_array_almost_equal(TAU_Z, TAU_Z.conj().T)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Test hsk function
|
|
|
|
|