# qml.qchem.spinz¶

spinz(orbitals)[source]

Computes the total spin projection observable $$\hat{S}_z$$.

The total spin projection operator $$\hat{S}_z$$ is given by

$\hat{S}_z = \sum_{\alpha, \beta} \langle \alpha \vert \hat{s}_z \vert \beta \rangle ~ \hat{c}_\alpha^\dagger \hat{c}_\beta, ~~ \langle \alpha \vert \hat{s}_z \vert \beta \rangle = s_{z_\alpha} \delta_{\alpha,\beta},$

where $$s_{z_\alpha} = \pm 1/2$$ is the spin-projection of the single-particle state $$\vert \alpha \rangle$$. The operators $$\hat{c}^\dagger$$ and $$\hat{c}$$ are the particle creation and annihilation operators, respectively.

Parameters

orbitals (str) – Number of spin orbitals. If an active space is defined, this is the number of active spin-orbitals.

Returns

the total spin projection observable $$\hat{S}_z$$

Return type

pennylane.Hamiltonian

Raises

ValueError – If orbitals is less than or equal to 0

Example

>>> orbitals = 4
>>> print(spinz(orbitals))
(-0.25) [Z0]
+ (0.25) [Z1]
+ (-0.25) [Z2]
+ (0.25) [Z3]


Using PennyLane

Development

API

Internals