ffsim.MolecularHamiltonian

class ffsim.MolecularHamiltonian(one_body_tensor, two_body_tensor, constant=0.0)[source]

Bases: SupportsApproximateEquality, SupportsDiagonal, SupportsFermionOperator, SupportsLinearOperator

A molecular Hamiltonian.

A Hamiltonian of the form

\[\begin{split}H = \sum_{\substack{pq \\ \sigma}} h_{pq} a^\dagger_{p\sigma} a_{q\sigma} + \frac12 \sum_{\substack{pqrs \\ \sigma \tau}} h_{pqrs} a^\dagger_{p\sigma} a^\dagger_{r\tau} a_{s\tau} a_{q\sigma} + \text{constant}.\end{split}\]

Here \(h_{pq}\) is called the one-body tensor and \(h_{pqrs}\) is called the two-body tensor.

Attributes

constant

The constant.

norb

The number of spatial orbitals.

one_body_tensor_spinless

The one-body tensor in spinless format.

two_body_tensor_spinless

The two-body tensor in spinless format.

one_body_tensor

The one-body tensor.

two_body_tensor

The two-body tensor.

constant: float = 0.0

The constant.

norb

The number of spatial orbitals.

one_body_tensor_spinless[source]

The one-body tensor in spinless format.

two_body_tensor_spinless[source]

The two-body tensor in spinless format.

one_body_tensor: ndarray

The one-body tensor.

two_body_tensor: ndarray

The two-body tensor.

Methods

from_fermion_operator(op)

Initialize a MolecularHamiltonian from a FermionOperator.

rotated(orbital_rotation)

Return the Hamiltonian in a rotated orbital basis.

static from_fermion_operator(op)[source]

Initialize a MolecularHamiltonian from a FermionOperator.

The input operator must contain only terms of the following form:

  • A real-valued constant

  • \(a^\dagger_{p\sigma} a_{q\sigma}\)

  • \(a^\dagger_{p\sigma}a^\dagger_{r\tau}a_{s\tau}a_{q\sigma}\)

Any other terms will cause an error to be raised. No attempt will be made to normal-order terms.

Parameters:

op (FermionOperator) – The FermionOperator from which to initialize the MolecularHamiltonian.

Return type:

MolecularHamiltonian

Returns:

The MolecularHamiltonian represented by the input FermionOperator.

rotated(orbital_rotation)[source]

Return the Hamiltonian in a rotated orbital basis.

Given an orbital rotation \(\mathcal{U}\), returns the operator

\[\mathcal{U} H \mathcal{U}^\dagger\]

where \(H\) is the original Hamiltonian.

Parameters:

orbital_rotation (ndarray) – The orbital rotation.

Return type:

MolecularHamiltonian

Returns:

The rotated Hamiltonian.