ffsim.SingleFactorizedHamiltonian¶
- class ffsim.SingleFactorizedHamiltonian(one_body_tensor, one_body_squares, constant=0.0)[source]¶
Bases:
SupportsLinearOperatorA 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
The constant.
The number of spatial orbitals.
The one-body tensor \(\kappa\).
The one-body tensors \(M^{(t)}\) whose squares are summed in the Hamiltonian.
- norb¶
The number of spatial orbitals.
-
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.
- 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_vecsparameter 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 overridestol.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:
- 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:
- Return type:
- Returns:
The reduced matrix.