openqemist.quantum_solvers package

Submodules

openqemist.quantum_solvers.initial_parameters module

Prepare the initial amplitudes for quantum simulation.

The electronic structure calculation employing the second-order Møller–Plesset perturbation theory (MP2) to prepare the initial T2 amplitudes is done here.

openqemist.quantum_solvers.initial_parameters.mp2_initial_amplitudes(molecule, mean_field)[source]

Computes and prepares the MP2 inital amplitudes.

Compute the inital amplitudes with PySCF MP2 calculation, and then reorders the elements into the QEMIST convention.

MP2 only has doubles (T2) amplitudes, thus the single (T1) amplitudes are set to a small non-zero value and added.

The ordering for QEMIST is single, double (diagonal), double (non-diagonal).

Parameters
  • molecule (pyscf.gto.Mole) – The molecule to simulate.

  • mean_field (pyscf.scf.RHF) – The mean field of the molecule.

Returns

The initial amplitudes (float64).

Return type

list

openqemist.quantum_solvers.parametric_quantum_solver module

class openqemist.quantum_solvers.parametric_quantum_solver.ParametricQuantumSolver(molecule, anstatz, mean_field=None)[source]

Bases: abc.ABC

Performs energy estimations for a molecule with a parametric circuit.

Performs energy estimations for a given molecule and a choice of ansatz circuit that is supported by the hardware. A concrete class will contain a nested Enum class that exposes the supported ansatze to the users. The state of the class is created in the costructor so that the simulate function can just accept an amplitude array and return an energy.

amplitude_dimension

The size of the amplitudes list that should be provided to the solver.

Type

int

initial_wavefunction

The initial wavefuntion for the simulations.

Type

numpy.array

n_qubits

The number of qubits in the circuit.

Type

int

abstract get_rdm()[source]

Returns the RDM from the simulation.

This is intended to be called after the simulation loop of the calling code has converged to be passed on to problem decompositions. In a concrete implementation, the simulate function would set the necessary internal state for the class so that this function can return the reduced density matrix.

Returns

The one- and two-element RDMs (float64).

Return type

(numpy.array, numpy.array)

Raises

RuntimeError – If no simulation has been run.

abstract simulate(amplitudes)[source]

Performs an energy simulation for the given amplitudes.

Parameters

amplitudes (list) – The amplitudes to use in the simulation.

Returns

The energy from the simulation.

Return type

float

Raises

ValueError – If len(amplitudes) doesn’t equal amplitude_dimension.

Module contents