ffsim.SingleFactorizedHamiltonian

class ffsim.SingleFactorizedHamiltonian(one_body_tensor, one_body_squares, constant=0.0)[source]

Bases: SupportsLinearOperator

A Hamiltonian in the single-factorized representation.

The single-factorized form of the molecular Hamiltonian is

\[\begin{split}H = \sum_{\substack{pq \\ \sigma}} \kappa_{pq} a^\dagger_{p\sigma} a_{q\sigma} + \frac12 \sum_{t=1}^L \left(\mathcal{M}^{(t)}\right)^2 + \text{constant}'.\end{split}\]

Here each \(\mathcal{M}^{(t)}\) is a one-body operator:

\[\begin{split}\mathcal{M}^{(t)} = \sum_{\substack{pq \\ \sigma}} M^{(t)}_{pq} a^\dagger_{p\sigma} a_{q\sigma}\end{split}\]

where each \(M^{(t)}\) is a Hermitian matrix.

Attributes

constant

The constant.

norb

The number of spatial orbitals.

one_body_tensor

The one-body tensor \(\kappa\).

one_body_squares

The one-body tensors \(M^{(t)}\) whose squares are summed in the Hamiltonian.

constant: float = 0.0

The constant.

norb

The number of spatial orbitals.

one_body_tensor: ndarray

The one-body tensor \(\kappa\).

one_body_squares: ndarray

The one-body tensors \(M^{(t)}\) whose squares are summed in the Hamiltonian.

Methods

expectation_product_state(vec, norb, nelec)

Return expectation value with respect to a product state.

from_molecular_hamiltonian(hamiltonian, *[, ...])

Initialize a SingleFactorizedHamiltonian from a MolecularHamiltonian.

reduced_matrix_product_states(vecs, norb, nelec)

Return reduced matrix within a subspace spanned by some product states.

expectation_product_state(vec, norb, nelec)[source]

Return expectation value with respect to a product state.

Parameters:
  • vec (tuple[ndarray, ndarray]) – The product state, as a pair (vec_a, vec_b) containing the alpha and beta components of the state.

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

  • nelec (tuple[int, int]) – The number of alpha and beta electrons.

Return type:

float

static from_molecular_hamiltonian(hamiltonian, *, tol=1e-08, max_vecs=None, cholesky=True)[source]

Initialize a SingleFactorizedHamiltonian from a MolecularHamiltonian.

The number of terms in the decomposition depends on the allowed error threshold. A larger error threshold leads to a smaller number of terms. Furthermore, the max_vecs parameter specifies an optional upper bound on the number of terms.

Note: Currently, only real-valued two-body tensors are supported.

Parameters:
  • hamiltonian (MolecularHamiltonian) – The Hamiltonian whose single-factorized representation to compute.

  • tol (float) – Tolerance for error in the decomposition. The error is defined as the maximum absolute difference between an element of the original tensor and the corresponding element of the reconstructed tensor.

  • max_vecs (int | None) – An optional limit on the number of terms to keep in the decomposition of the two-body tensor. This argument overrides tol.

  • cholesky (bool) – Whether to perform the factorization using a modified Cholesky decomposition. If False, a full eigenvalue decomposition is used instead, which can be much more expensive.

Return type:

SingleFactorizedHamiltonian

Returns:

The single-factorized Hamiltonian.

reduced_matrix_product_states(vecs, norb, nelec)[source]

Return reduced matrix within a subspace spanned by some product states.

Given a list of product states \(\{\lvert \alpha_i, \beta_i \rangle\}\), returns the matrix M where \(M_{ij} = \langle \alpha_i, \beta_i \rvert H \lvert \alpha_j, \beta_j \rangle\).

Parameters:
  • vecs (Sequence[tuple[ndarray, ndarray]]) – The product states, as a list of pairs (vec_a, vec_b) containing the alpha and beta components of each state.

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

  • nelec (tuple[int, int]) – The number of alpha and beta electrons.

Return type:

ndarray

Returns:

The reduced matrix.