ffsim.random.random_fermion_hamiltonian

ffsim.random.random_fermion_hamiltonian(norb, *, n_terms=None, seed=None)[source]

Sample a random fermion Hamiltonian.

A fermion Hamiltonian is hermitian and conserves particle number and spin \(z\).

The operator is sampled by drawing a random particle-number and spin-\(z\) conserving operator (see random_fermion_operator()) and adding its adjoint.

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.

  • 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 Hamiltonian.