# openfermion.hamiltonians.RichardsonGaudin

Richardson Gaudin model.

Inherits From: DOCIHamiltonian, PolynomialTensor

Class for storing and constructing Richardson Gaudin hamiltonians combining an equi-distant potential ladder like potential per qubit with a uniform coupling between any pair of qubits with coupling strength g, which can be either attractive (g<0) or repulsive (g>0).

The operators represented by this class has the form:

.. math::

H = \sum_{p=0} (p + 1) N_p + g/2 \sum_{p < q} P_p^\dagger P_q,


where

.. math::

\begin{align}
N_p &= (1 - \sigma^Z_p)/2, \\
P_p &= a_{p,\beta} a_{p,\alpha} = S^{-} = \sigma^X + i \sigma^Y, \\
g &= constant coupling term
\end{align}


Note; The diagonal of the Hamiltonian is composed of the values in range((n_qubits+1)*n_qubits//2+1).

g (float): Coupling strength n_qubits (int): Number of qubits

constant

hc

hr1 The value of hr1.
hr2 The value of hr2.
identity_part Returns identity term of this operator (i.e. trace-ful term) in QubitOperator form.
n_body_tensors

n_qubits

qubit_operator Return the QubitOperator representation of this DOCI Hamiltonian
xx_part Returns the XX part of the QubitOperator representation of this DOCIHamiltonian
xy_part Returns the XX+YY part of the QubitOperator representation of this DOCIHamiltonian
yy_part Returns the YY part of the QubitOperator representation of this DOCIHamiltonian
z_part Return the Z and ZZ part of the QubitOperator representation of this DOCI Hamiltonian
zz_part Returns the ZZ part of the QubitOperator representation of this DOCIHamiltonian

## Methods

View source

### get_antisymmetrized_tensors

View source

Antisymmetrized Tensors Directly returns antisymmetrized tensors, which, when used to construct an FermionOperator via an InteractionOperator produce a FermionOperator that acts like this RichardsonGaudin Hamiltonian on the paired (seniority zero) subspace. Compared to the FermionOperator that can be obtained via the n_body_tensors property from the DOCIHamiltonian class the FermionOperator from the tensors returned by this function do not contain same spin coupling terms. These terms act trivially on the paired subspace and this the two Hamiltonian agree on any senioirty zero state. Returns: tuple: Tuple of one and two body tensors.

### get_projected_integrals

View source

Creates the one and two body integrals that would correspond to a hypothetic electronic structure Hamiltonian, which would satisfy the given set of hc, hr1 and hr2.

This is technically not well-defined, as hr2 is not generated in a one-to-one fashion. This implies that calling

get_doci_from_integrals( *get_projected_integrals_from_doci( hc, hr1, hr2 ) )

should return the same hc, hr1, and hr2, but there is no such guarantee for

get_projected_integrals_from_doci( *get_doci_from_integrals( one_body_integrals, two_body_integrals ) )

but this method attemps to create integrals that conform to the same symmetries as a physical electronic structure Hamiltonian would, with inevitable loss of information due to the ambiguity above.

Args
hc [numpy array]: The single-particle DOCI terms in matrix form hr1 [numpy array]: The off-diagonal DOCI Hamiltonian terms in matrix form hr2 [numpy array]: The diagonal DOCI Hamiltonian terms in matrix form

Returns
projected_onebody_integrals [numpy array]: The corresponding one-body integrals for the electronic structure Hamiltonian projected_twobody_integrals [numpy array]: The corresponding two body integrals for the electronic structure Hamiltonian

### projected_n_body_tensors

View source

Keep only selected elements.

Args
selection (Union[int, Iterable[int]): If int, keeps terms with at most (exactly, if exact is True) that many unique indices. If iterable, keeps only terms containing (all of, if exact is True) the specified indices. exact (bool): Whether or not the selection is strict.

### rotate_basis

View source

Rotate the orbital basis of the PolynomialTensor.

Args
rotation_matrix A square numpy array or matrix having dimensions of n_qubits by n_qubits. Assumed to be real and invertible.

View source

### xx_term

View source

Returns the XX term on a single pair of qubits as a QubitOperator

Arguments
p, q [int] -- qubit indices

Returns
[QubitOperator] -- XX term on the chosen qubits.

### yy_term

View source

Returns the YY term on a single pair of qubits as a QubitOperator

Arguments
p, q [int] -- qubit indices

Returns
[QubitOperator] -- YY term on the chosen qubits.

### z_term

View source

Returns the Z term on a single qubit as a QubitOperator

Arguments
p [int] -- qubit index

Returns
[QubitOperator] -- Z term on the chosen qubit.

View source

### zz_term

View source

Returns the ZZ term on a single pair of qubits as a QubitOperator

Arguments
p, q [int] -- qubit indices

Returns
[QubitOperator] -- ZZ term on the chosen qubits.

View source

### __eq__

View source

Return self==value.

### __getitem__

View source

Look up matrix element.

Args
args Tuples indicating which coefficient to get. For instance, my_tensor[(6, 1), (8, 1), (2, 0)] returns my_tensor.n_body_tensors[1, 1, 0][6, 8, 2]

### __iter__

View source

Iterate over non-zero elements of PolynomialTensor.

View source

View source

### __ne__

View source

Return self!=value.

View source

View source

View source

View source

View source

### __truediv__

View source

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]