Esempio n. 1
0
def test_magnetization_vector_FM_state_z_down(num_sites):
    state = numpy.array([[0.0, 0.0, -1.0]] * num_sites)
    assert numpy.allclose(magnetization.magnetization_vector(state), [0.0, 0.0, -1.0])
Esempio n. 2
0
def test_magnetization_vector_AFM_state_z(num_sites):
    state = numpy.array([[0.0, 0.0, 1.0], [0.0, 0.0, -1.0]] * (num_sites // 2))
    assert numpy.allclose(magnetization.magnetization_vector(state), [0.0, 0.0, 0.0])
Esempio n. 3
0
def test_magnetization_vector_random_state(num_sites, random_state):
    assert numpy.allclose(
        magnetization.magnetization_vector(random_state),
        numpy.sum(random_state, axis=0) / num_sites,
    )