ffsim.MolecularHamiltonian¶
- class ffsim.MolecularHamiltonian(one_body_tensor, two_body_tensor, constant=0.0)[source]¶
Bases:
SupportsApproximateEquality,SupportsDiagonal,SupportsFermionOperator,SupportsLinearOperatorA 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
The constant.
The number of spatial orbitals.
The one-body tensor in spinless format.
The two-body tensor in spinless format.
The one-body tensor.
The two-body tensor.
- norb¶
The number of spatial orbitals.
Methods
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:
- 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:
- Returns:
The rotated Hamiltonian.