Skip to content

Exact Solution

Currently, quantum algorithms for chemistry investigate relatively small molecules. For many of these molecules, the exact ground state can be calculated using full Hamiltonian diagonalization. This can serve as the ground truth for evaluating the results obtained by quantum methods.

The method solve_exact of the class GroundStateSolver returns the exact ground state of the molecule.

In the following example we show how get the exact ground state of a hydrogen molecule.

from classiq.interface.chemistry.molecule import Molecule
from classiq.interface.chemistry.ground_state_problem import MoleculeProblem
from classiq.interface.chemistry.ground_state_solver import GroundStateSolver

molecule = Molecule(
    atoms=[
        ("H", (0.0, 0.0, 0.0)),
        ("H", (0.0, 0.0, 0.735)),
    ],
)
gs_problem = MoleculeProblem(
    molecule=molecule,
    mapping="jordan_wigner",
)

gs_solver = GroundStateSolver(
    ground_state_problem=gs_problem,
)
exact_result = gs_solver.solve_exact()