qrunch.chemistry.orbital_optimizers.reduced_density_matrices_protocols

Module for reduced density matrix (RDM) calculators.

Classes

ReducedDensityMatrixCalculator

Protocol for implementing reduced density matrix calculators.

RestrictedReducedDensityMatrices

Dataclass for handling restricted reduced density matrices.

UnrestrictedReducedDensityMatrices

Dataclass for handling unrestricted reduced density matrices.

class ReducedDensityMatrixCalculator

Bases: Protocol

Protocol for implementing reduced density matrix calculators.

__init__(*args, **kwargs)
calculate(circuit: Circuit, shots: int | None = None) UnrestrictedReducedDensityMatrices | RestrictedReducedDensityMatrices

Calculate the 1- and 2-particle RDMs.

Parameters:
  • circuit (Circuit) – Circuit to use as the ansatz for estimating the RDMs.

  • shots (int | None) – The number of shots to use in the estimation. Defaults to None.

Return type:

UnrestrictedReducedDensityMatrices | RestrictedReducedDensityMatrices

class RestrictedReducedDensityMatrices

Bases: object

Dataclass for handling restricted reduced density matrices. This means there is only pure alpha components.

The restricted single excitation RMD consist of only alpha-alpha component. The restricted double excitation RDM consist of only alpha-alpha-alpha-alpha component.

Parameters:
  • dimension – Dimension of the RDMs.

  • single_excitations – The single excitation RDM

  • double_excitations – The double excitation RDM

__init__(dimension: int, single_excitations: ndarray[Any, dtype[float64]], double_excitations: ndarray[Any, dtype[float64]]) None
Parameters:
  • dimension (int)

  • single_excitations (ndarray[Any, dtype[float64]])

  • double_excitations (ndarray[Any, dtype[float64]])

Return type:

None

dimension: int
double_excitations: ndarray[Any, dtype[float64]]
single_excitations: ndarray[Any, dtype[float64]]
class UnrestrictedReducedDensityMatrices

Bases: object

Dataclass for handling unrestricted reduced density matrices.

The unrestricted single excitation RMD consist of both alpha-alpha and beta-beta components. The unrestricted double excitation RDM consist of alpha-alpha-alpha-alpha, beta-beta-beta-beta, and beta-alpha-beta-alpha component (physics ordering).

Parameters:
  • dimension – Dimension of the RDMs.

  • single_excitations – The single excitation RDM

  • double_excitations – The double excitation RDM

__init__(dimension: int, single_excitations: SingleExcitationsArray, double_excitations: DoubleExcitationsArray) None
Parameters:
Return type:

None

dimension: int
double_excitations: DoubleExcitationsArray
single_excitations: SingleExcitationsArray