Loading [MathJax]/jax/output/HTML-CSS/jax.js

qml.qchem.particle_number

particle_number(orbitals)[source]

Compute the particle number observable ˆN=αˆnα in the Pauli basis.

The particle number operator is given by

ˆN=αˆcαˆcα,

where the index α runs over the basis of single-particle states |α, and the operators ˆc and ˆc are the particle creation and annihilation operators, respectively.

Parameters

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

Returns

the particle number observable

Return type

pennylane.Hamiltonian

Raises

ValueError – If orbitals is less than or equal to 0

Example

>>> orbitals = 4
>>> print(particle_number(orbitals))
(
    2.0 * I(0)
  + -0.5 * Z(0)
  + -0.5 * Z(1)
  + -0.5 * Z(2)
  + -0.5 * Z(3)
)