Perform quantum simulation based on VQE algorithm.
The electronic structure calculation employing the quantum/classical hybrid variational quantum eigensolver (VQE) algorithm is done here. The quantum eigensolver runs inside the classical optimizer.
There are options for which hardware backend can be used.
Estimates energy wih a variational quantum eigensolver algorithm.
Uses the VQE algorithm to solve the electronic structure problem. By default an optimizer from scipy is used, but users can set any function whose first argument is the simulate function of the hardware backend and the second is the amplitudes to optimize over and returns a energy. See the implementation of _default_optimizer for a concrete example. Users should provide a hardware backend type that conforms to the interface of openqemist.quantum_solver.ParametricQuantumSolver that the VQESolver will construct and use. Users should also provide an ansatze type that is supported by the backend. Users can also provide a function that takes a pyscf.gto.Mole as its first argument and pyscf.scf.RHF as is second and returns the inital amplitudes for the variational optimization. The user is responsible for ensuring that the dimension of the amplitudes vector is correct for the given molecule and andsatz choice.
A type for the backend instance that is automatically constructed.
subclass of ParametricQuantumSolver
Type of ansatz that is supported by the backend.
subclass of Enum
Function that is called to optimize.
Initial values of the variational parameters used in the classical optimization process
Controls the verbosity of the default optimizer.
Extra parameters that can be forwarded to the parametric quantum solver.
Initial variational parameters can be specified through the initial_var_params argument. If this is not specified, then the default_initial_var_parameters function provided by the hardware backend is used.
Returns the RDM from the hardware backend.
Returns the reduced density matrices from the hardware backend. Does not catch and exceptions that the hardware backend raises if it is not in a state to return the RDM.
One & two-particle RDMs (float64).
- Return type
RuntimeError – If no simulation has been run.
Perform the simulation for the molecule.
If the mean field is not provided it is automatically calculated.
molecule (pyscf.gto.Mole) – The molecule to simulate.
mean_field (pyscf.scf.RHF) – The mean field of the molecule.