paddle_quantum.qchem.algorithm

The solver in the qchem.

class paddle_quantum.qchem.algorithm.VQESolver(optimizer, num_iterations, tol=1e-08, save_every=1)

Bases: object

VQE solver class.

Parameters:
  • optimizer (Optimizer) – paddle optimizer.

  • num_iterations (int) – number of iterations during the optimization.

  • tol (float) – convergence criteria, if :math`|L1-L0|<tol` , optimization will stop.

  • save_every (int) – save loss value after save_every iterations.

solve()
class paddle_quantum.qchem.algorithm.GroundStateSolver(optimizer, num_iterations, tol=1e-08, save_every=1)

Bases: VQESolver

The ground state solver class.

Parameters:
  • optimizer (Optimizer) – paddle optimizer.

  • num_iterations (int) – number of iterations during the optimization.

  • tol (float) – convergence criteria, if \(|L1-L0|<tol\) , optimization will stop.

  • save_every (int) – save loss value after save_every iterations.

solve(ansatz, mol=None, ham=None, init_state=None, **optimizer_kwargs)

Run VQE to calculate the ground state energy for a given molecule.

Parameters:
  • ansatz (Circuit) – the quantum circuit represents the wfn transformation.

  • mol (Molecule) – default is None, the molecule object.

  • ham (Hamiltonian) – default is None, the Hamiltonian on which to calculate the ground state energy.

  • init_state (State) – default is None, the initial state passed to the ansatz.

  • optimizer_kwargs.

Returns:

The estimated ground state energy and the ground state wave function.

Return type:

Tuple[float, Tensor]