vqd

Computes the lowest k eigenvalues of a qubit operator using variational deflation with Qiskit primitives.

18|3|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/unitarylab/quantum-practices --skill vqd-unitarylab
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vqd
Source: https://github.com/unitarylab/quantum-practices/tree/main/algorithms/eigensolvers/vqd
Command: npx skills add https://github.com/unitarylab/quantum-practices --skill vqd-unitarylab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires qiskit, qiskit_algorithms, numpy, scipy, and includes scripts (resource) components.

What problem does it solve? Computing excited-state energies of a quantum Hamiltonian requires more than a ground-state solver; VQD finds the lowest k eigenvalues by sequentially optimizing variational states with overlap penalties that enforce orthogonality against previously found states. ## Core Features & Use Cases - Stepwise Deflation Workflow: Solves one eigenstate at a time, adding fidelity-based overlap penalties so each new state is orthogonal to all prior states. - Qiskit Primitives Integration: Uses StatevectorEstimator for energy expectation and ComputeUncompute fidelity for overlap computation, with pluggable optimizers like SLSQP or COBYLA. - Reference Implementations: Includes a Qiskit-based verification script and a manual NumPy/SciPy implementation with known test cases for validation and debugging. - Use Case: Given a 3-qubit SparsePauliOp Hamiltonian, configure VQD with k=3 and custom beta weights to obtain the three lowest eigenvalues and compare them against exact diagonalization results. ## Quick Start Ask the assistant to run the VQD eigensolver on a small SparsePauliOp Hamiltonian with k=2 using the RealAmplitudes ansatz and print the resulting eigenvalues.

Frequently Asked Questions about vqd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compute excited state energies with VQD in Qiskit?

Create a VQD solver with an estimator primitive, a ComputeUncompute fidelity primitive, a parameterized ansatz like RealAmplitudes, and an optimizer such as SLSQP. Set k to the number of eigenvalues and call compute_eigenvalues with your SparsePauliOp operator.

What is the difference between VQE and VQD?

VQE finds only the ground-state energy of a Hamiltonian, while VQD finds the lowest k eigenvalues including excited states. VQD runs VQE-style optimizations sequentially, adding overlap penalty terms that force each new state to be orthogonal to previously found states.

How do I choose beta penalty weights in VQD?

Betas control the strength of orthogonality enforcement between states. If excited-state energies collapse toward the ground state, increase betas starting around 1.0; if optimization fails to converge, reduce betas so the penalty does not dominate the energy term.

Why does VQD raise AlgorithmError with a convergence threshold?

When convergence_threshold is set, VQD monitors the average weighted fidelity with prior states and raises AlgorithmError if overlap remains too high after optimization. Increase optimizer maxiter, adjust betas, or relax the threshold to resolve it.

What are the limitations of VQD for large k values?

The fidelity overhead grows with each additional state because every step computes overlaps against all prior states, making large k expensive. Ansatz expressibility and optimizer quality also limit accuracy, so exact diagonalization may be preferable for small systems.