ffsim.contract.two_body_linop¶
- ffsim.contract.two_body_linop(two_body_tensor, norb, nelec, one_body_tensor=None, constant=0)[source]¶
Convert a two-body tensor to a linear operator.
A two-body tensor has the form
\[\begin{split}\frac12 \sum_{\substack{pqrs \\ \sigma \tau}} h_{pqrs} a^\dagger_{p\sigma} a^\dagger_{r\tau} a_{s\tau} a_{q\sigma}\end{split}\]where \(h_{pqrs}\) is a tensor of complex coefficients.
The two-body tensor is assumed to be symmetric under exchange of its index pairs, \(h_{pqrs} = h_{rspq}\). If the tensors are real, they are further assumed to have the symmetries of integrals over real orbitals: the one-body tensor is symmetric, \(h_{pq} = h_{qp}\), and the two-body tensor is symmetric within each of its index pairs, \(h_{pqrs} = h_{qprs} = h_{pqsr}\). These assumptions are not checked, and the result is incorrect if they don’t hold. Symmetrizing the two-body tensor under exchange of its index pairs, as in
0.5 * (h + h.transpose(2, 3, 0, 1)), does not change the operator it represents. Real tensors that lack the other symmetries can be converted to a complex data type.- Parameters:
two_body_tensor (
ndarray) – The two-body tensor.norb (
int) – The number of spatial orbitals.nelec (
tuple[int,int]) – The number of alpha and beta electrons.one_body_tensor (
ndarray|None) – Optional one-body tensor to absorb into the two-body operator. Seeone_body_linop().constant (
float) – Optional constant to add to the operator.
- Return type:
- Returns:
A LinearOperator that implements the action of the two-body tensor.