qml.qchem.obs.spin_z

spin_z(orbitals, mapping='jordan_wigner', wires=None)[source]

Computes the total spin projection operator \(\hat{S}_z\) in the Pauli basis.

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.

  • mapping (str) – Specifies the transformation to map the fermionic operator to the Pauli basis. Input values can be 'jordan_wigner' or 'bravyi_kitaev'.

  • wires (Wires, list, tuple, dict) – Custom wire mapping used to convert the qubit operator to an observable measurable in a PennyLane ansatz. For types Wires/list/tuple, each item in the iterable represents a wire label corresponding to the qubit number equal to its index. For type dict, only int-keyed dict (for qubit-to-wire conversion) is accepted. If None, will use identity map (e.g. 0->0, 1->1, …).

Returns

the total spin projection observable \(\hat{S}_z\)

Return type

pennylane.Hamiltonian

Example

>>> orbitals = 4
>>> Sz = spin_z(orbitals, mapping="jordan_wigner")
>>> print(Sz)
(-0.25) [Z0]
+ (0.25) [Z1]
+ (-0.25) [Z2]
+ (0.25) [Z3]