ffsim.random.random_fermion_operator

ffsim.random.random_fermion_operator(norb, n_terms=None, max_term_length=None, num_and_spin_conserving=False, seed=None)[source]

Sample a random fermion operator.

Parameters:
  • norb (int) – The number of spatial orbitals.

  • n_terms (int | None) – The number of terms to include in the operator. If not specified, norb is used.

  • max_term_length (int | None) – The maximum length of a term. If not specified, 2 * norb is used.

  • num_and_spin_conserving (bool) – Whether to sample an operator that conserves particle number and the z component of spin.

  • seed – A seed to initialize the pseudorandom number generator. Should be a valid input to np.random.default_rng.

Return type:

FermionOperator

Returns:

The sampled fermion operator.