# qml.qchem.obs._spin2_matrix_elements¶

_spin2_matrix_elements(sz)[source]

Builds the table of matrix elements $$\langle \bm{\alpha}, \bm{\beta} \vert \hat{s}_1 \cdot \hat{s}_2 \vert \bm{\gamma}, \bm{\delta} \rangle$$ of the two-particle spin operator $$\hat{s}_1 \cdot \hat{s}_2$$.

The matrix elements are evaluated using the expression

$\begin{split}\langle ~ (\alpha, s_{z_\alpha});~ (\beta, s_{z_\beta}) ~ \vert \hat{s}_1 && \cdot \hat{s}_2 \vert ~ (\gamma, s_{z_\gamma}); ~ (\delta, s_{z_\gamma}) ~ \rangle = \delta_{\alpha,\delta} \delta_{\beta,\gamma} \\ && \times \left( \frac{1}{2} \delta_{s_{z_\alpha}, s_{z_\delta}+1} \delta_{s_{z_\beta}, s_{z_\gamma}-1} + \frac{1}{2} \delta_{s_{z_\alpha}, s_{z_\delta}-1} \delta_{s_{z_\beta}, s_{z_\gamma}+1} + s_{z_\alpha} s_{z_\beta} \delta_{s_{z_\alpha}, s_{z_\delta}} \delta_{s_{z_\beta}, s_{z_\gamma}} \right),\end{split}$

where $$\alpha$$ and $$s_{z_\alpha}$$ refer to the quantum numbers of the spatial function and the spin projection, respectively, of the single-particle state $$\vert \bm{\alpha} \rangle \equiv \vert \alpha, s_{z_\alpha} \rangle$$.

Parameters

sz (array[float]) – spin-projection of the single-particle states

Returns

NumPy array with the table of matrix elements. The first four columns contain the indices $$\bm{\alpha}$$, $$\bm{\beta}$$, $$\bm{\gamma}$$, $$\bm{\delta}$$ and the fifth column stores the computed matrix element.

Return type

array

Example

>>> sz = np.array([0.5, -0.5])
>>> print(_spin2_matrix_elements(sz))
[[ 0.    0.    0.    0.    0.25]
[ 0.    1.    1.    0.   -0.25]
[ 1.    0.    0.    1.   -0.25]
[ 1.    1.    1.    1.    0.25]
[ 0.    1.    0.    1.    0.5 ]
[ 1.    0.    1.    0.    0.5 ]]