Skip to main content
KetQat

Appearance

VQE ground-state energy (statevector)

Minimise the energy of a Pauli Hamiltonian with a hardware-efficient ansatz and compare with the exact ground energy.

Officially provided by KetQat — method by Peruzzo et al. (2014), McClean et al. (2016) and others. KetQat prepares, verifies and maintains this product; it does not claim to have invented the method. Read the origin statement.

What it does and who it is for

Runs the variational quantum eigensolver as a statevector simulation on your machine. The Hamiltonian is the SDK's approximate two-qubit H2 testbed, a transverse-field Ising chain built from its definition, or your own list of Pauli terms. The ansatz is layers of Ry rotations on every qubit, each followed by a CNOT ladder (or no entangling gates, if you choose a product ansatz). Angles are optimised by coordinate descent from seeded random restarts, and the energy is reported against the exact ground energy from diagonalising the Hamiltonian.

The gap to the exact energy is attributed honestly: when a product ansatz faces an entangled ground state the result says the ansatz cannot represent the state, so the gap is a limit of the hypothesis class rather than of the optimiser.

The H2 coefficients are a testbed for the algorithm, not a chemistry result: the result carries a provenance block stating that they land about 6 mHa from the literature total, roughly four times chemical accuracy.

Use cases

  • See VQE converge to the exact ground energy of a small Hamiltonian and read the optimised angles
  • Show that a product ansatz cannot reach an entangled ground state, and that more iterations do not help
  • Run VQE on your own Pauli Hamiltonian of up to 6 qubits with a reproducible seed

Use it on your computer

This page never runs anything. Copy the commands into your own terminal; the product runs locally with no account and no telemetry.
  1. Install

    Installs the KetQat SDK from commit 2cedabbd814f, the exact version whose product definition this page shows. The SDK is not on PyPI yet, so pip install ketqat alone will not work.

    Terminal
    pip install "ketqat[algorithms] @ git+https://github.com/ketqat/ketqat-sdk@2cedabbd814fd199b1989c8ceb1e9efa1744c2c0#subdirectory=python"
  2. Run the example

    Save it as example.py and run python example.py. Or use the CLI: ketqat catalog run [email protected].

    Python
    import json
    from ketqat_runner import catalog
    
    record = catalog.run("[email protected]", seed=7, hamiltonian="h2-approximate", qubits=2, layers=2)
    result = record.result
    print(json.dumps({
        "status": record.status,
        "energy": round(result["energy"], 6),
        "exact_ground_energy": round(result["exact_ground_energy"], 6),
        "converged": result["gap"] < 1e-8,
        "variational_principle_holds": result["variational_principle_holds"],
    }))
    
    Expected output (fields the example must print)
    {
      "energy": -1.851199,
      "status": "succeeded",
      "converged": true,
      "exact_ground_energy": -1.851199,
      "variational_principle_holds": true
    }

    Verified with

    SDK
    0.3.0
    Python
    3.12.12
    Platform
    macOS-27.0.1-arm64 Python 3.12.12 (maintainer run in a clean virtualenv, test_catalog_examples.py)
    Date
    1 Nov 2026
  3. Optional: tell us it ran

    ketqat report RUN_ID sends an opt-in usage report: product, version, succeeded/failed, time and SDK version only. It shows you the exact payload first and needs an API token from Settings. Nothing is sent unless you run it.

Inputs and outputs

Inputs

Inputs of VQE ground-state energy (statevector)
NameTypeDefaultAllowed valuesDescription
hamiltonianstringh2-approximateenum: h2-approximate, transverse-ising, customh2-approximate (the SDK's 2-qubit H2/STO-3G-shaped testbed), transverse-ising (H = -J sum Z_i Z_{i+1} - h sum X_i on an open chain), or custom (give terms).
qubitsinteger2maximum: 6; minimum: 1Number of qubits. Must be 2 for h2-approximate; the chain length for transverse-ising; the Pauli string length for custom.
termsobject[]nullminItems: 1For hamiltonian=custom: objects {"coefficient": number, "pauli": string of I/X/Y/Z of length qubits}. null otherwise.
ising_couplingnumbernullmaximum: 100; minimum: -100J for transverse-ising. null means 1.0. Not accepted with other Hamiltonians.
ising_fieldnumbernullmaximum: 100; minimum: -100h for transverse-ising. null means 1.0. Not accepted with other Hamiltonians.
layersinteger2maximum: 4; minimum: 1Ansatz layers; the parameter count is layers x qubits.
entanglingbooleantrue—true adds a CNOT ladder after each Ry layer; false keeps a product-state ansatz.
restartsinteger12maximum: 50; minimum: 1Seeded random restarts of the coordinate descent; the best is reported.
iterationsinteger400maximum: 2000; minimum: 1Maximum coordinate-descent sweeps per restart (it stops early once the step falls below 1e-9). Requests estimated above 30 s are refused with the estimate.

Outputs

Outputs of VQE ground-state energy (statevector)
NameTypeDescription
energynumberLowest energy found, <psi(theta)|H|psi(theta)> from the state vector.
exact_ground_energynumberE_0 from dense diagonalisation of H, the reference the energy is measured against.
gapnumberenergy - exact_ground_energy, never negative for a correct implementation (variational principle).
ansatz_can_represent_ground_statebooleanfalse when a product ansatz faces an entangled ground state; then the gap is a representational limit, as explanation says.
parametersnumber[]Optimised Ry angles, layer by layer, qubit by qubit.
h2_provenanceobjectFor h2-approximate: the testbed's discrepancy from the literature energy and the statement that it is not a chemistry result.

Sample result

Approximate H2 testbed, 2 layers with CNOT ladder, 12 restarts: VQE reaches -1.851199124 Ha, the exact ground energy from diagonalisation (gap 0 to 12 decimals); the provenance block records that the coefficients land 6.1 mHa from the literature total and are not a chemistry result.

Generated with

Product version
1.0.0
Seed
7
Parameters
{"terms":null,"layers":2,"qubits":2,"restarts":12,"entangling":true,"iterations":400,"hamiltonian":"h2-approximate","ising_field":null,"ising_coupling":null}
SDK
0.3.0
Python
3.12.12
Platform
macOS-27.0.1-arm64-arm-64bit
Result data (JSON)
{
  "gap": 0,
  "ansatz": {
    "form": "layers of Ry(theta) on every qubit, each followed by a CNOT ladder",
    "layers": 2,
    "entangling": true,
    "parameter_count": 4
  },
  "energy": -1.851199124124,
  "execution": "exact statevector energies; ground energy by dense diagonalisation",
  "optimizer": {
    "method": "coordinate descent with step halving",
    "restarts": 12,
    "iterations": 400
  },
  "parameters": [
    1.048224798212,
    4.712388920822,
    0.818481047682,
    4.71238900306
  ],
  "explanation": "Converged to the exact ground energy.",
  "hamiltonian": {
    "kind": "h2-approximate",
    "terms": [
      {
        "pauli": "II",
        "coefficient": -0.4804
      },
      {
        "pauli": "ZI",
        "coefficient": 0.3435
      },
      {
        "pauli": "IZ",
        "coefficient": -0.4347
      },
      {
        "pauli": "ZZ",
        "coefficient": 0.5716
      },
      {
        "pauli": "XX",
        "coefficient": 0.091
      },
      {
        "pauli": "YY",
        "coefficient": 0.091
      }
    ],
    "qubits": 2
  },
  "h2_provenance": {
    "note": "Approximate coefficients. The total lands about 6 mHa from the literature value, roughly four times chemical accuracy (0.0016 Ha). Suitable for testing the algorithm; not suitable for reporting a chemistry result. A published energy curve needs coefficients from a verified electronic-structure calculation.",
    "validated": false,
    "discrepancy_hartree": 0.006069870302,
    "total_energy_hartree": -1.131230129698,
    "literature_total_hartree": -1.1373,
    "within_chemical_accuracy": false,
    "nuclear_repulsion_hartree": 0.719968994426
  },
  "exact_ground_energy": -1.851199124124,
  "ground_state_entangled": true,
  "variational_principle_holds": true,
  "ansatz_can_represent_ground_state": true
}

Assumptions, scope and limitations

Assumptions

  • Ideal, noiseless gates and exact expectation values: the energy is computed from the state vector, not estimated from shots.
  • Ry(theta)|0> = cos(theta/2)|0> + sin(theta/2)|1>; the CNOT ladder couples qubit i to i+1 in order.
  • Coordinate descent with step halving from uniform random starting angles; no gradient estimates enter the result.

Scope

  • Hamiltonians on 1 to 6 qubits given as Pauli strings, up to 4 ansatz layers, up to 50 restarts and 2000 sweeps each.
  • Energy against the exact ground energy, the variational-principle check, and the representability verdict for product ansaetze.

Limitations

  • The H2 coefficients are approximate (about 6 mHa from the literature total) and are not a validated molecular Hamiltonian; use them to exercise the algorithm, not to report chemistry.
  • A non-convex landscape: the optimiser can stop above the ground energy even when the ansatz could represent it. The result says so, and more restarts may help.
  • Exact statevector energies, so the sampling noise and measurement cost of a real VQE are not modelled.
  • Dense diagonalisation and Python-loop CNOTs cap the product at 6 qubits.
  • Tested on macOS and Linux only; Windows is untested.

Environment and resources

Runs
Locally, on your computer
Type
Simulation
Python
>=3.10
Operating systems
Linux, macOS
Resources
2 qubits with the defaults (2 layers, 12 restarts, 400 sweeps): ~0.3 s; 3 qubits: ~1.5 s; 4 qubits: ~13 s on a 2024 laptop. Memory under 50 MB. Time grows as restarts x iterations x layers^2 x qubits x 2^qubits; requests estimated above 30 s are refused.
SDK extras
algorithms
Minimum SDK
0.3.0

Validation

Verified: the example was executed by CI, validation tests exist and limitations are recorded.

Versions and changelog

  1. 1.0.01 Nov 2026currentShown on this page

    • First catalog release, wrapping the SDK's existing VQE with three Hamiltonian sources and a resource ceiling.

    Needs SDK 0.3.0 or later with extras: algorithms.

All product changelogs

Origin, license and credits

KetQat implementation of published methods

The variational quantum eigensolver was introduced by Peruzzo et al. (2014) and given its general hybrid framework by McClean, Romero, Babbush and Aspuru-Guzik (2016); the hardware-efficient Ry + CNOT-ladder ansatz follows Kandala et al. (2017). KetQat wrote this NumPy statevector implementation (vqe.py), its coordinate-descent optimiser, the Hamiltonian builders, the validation tests and this catalog entry. KetQat did not invent the method.

Upstream software

License of what you receive

Apache-2.0 — see Licensing.

Contributors

People credited for this product. KetQat publishes and maintains it; contributors are credited for their work and are not sellers.

  • dorakingx · KetQat maintainer: implementation, validation and catalog entry

How to contribute

References

  1. Alberto Peruzzo, Jarrod McClean, Peter Shadbolt, Man-Hong Yung, Xiao-Qi Zhou, Peter J. Love, Alan Aspuru-Guzik, Jeremy L. O'Brien (2014). A variational eigenvalue solver on a photonic quantum processor. Nature Communications 5, 4213.DOI 10.1038/ncomms5213arXiv:1304.3061
  2. Jarrod R. McClean, Jonathan Romero, Ryan Babbush, Alan Aspuru-Guzik (2016). The theory of variational hybrid quantum-classical algorithms. New Journal of Physics 18, 023023.DOI 10.1088/1367-2630/18/2/023023arXiv:1509.04279
  3. Abhinav Kandala, Antonio Mezzacapo, Kristan Temme, Maika Takita, Markus Brink, Jerry M. Chow, Jay M. Gambetta (2017). Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets. Nature 549, 242-246.DOI 10.1038/nature23879arXiv:1704.05018

Usage

No usage reports yet

Distinct signed-in accounts that chose to send at least one usage report (ketqat report) for this product in the last 90 days. KetQat staff, test and bot accounts are excluded. Reports are opt-in, so this is not a count of all users.

Computed 10 Nov 2026, 17:34 UTC.

Reviews

Not yet rated

Be the first to rate this product after you run it.

Mean of visible reviews. Hidden reviews and reviews by KetQat staff, test and bot accounts are excluded. Pro status gives no extra weight.

Sign in to review this product. One review per person; you can edit it later.

No reviews yet.