Learn/VQE
Advanced15 min read

VQE: Variational Quantum Eigensolver

Simulate molecular ground states - the key to drug discovery and materials science.

Why VQE Matters

Classical computers can't efficiently simulate quantum systems. A molecule with 50 electrons would require more memory than atoms in the universe. VQE runs on near-term quantum hardware.

MoleculeClassicalQuantum (VQE)
Caffeine (24 atoms)DaysHours
Penicillin (41 atoms)YearsDays
Insulin (787 atoms)ImpossibleFeasible

The Code

vqe.ql
# VQE - H2 Molecule Simulation
QUBIT q0, q1
c0 = 0
c1 = 0
 
# Ansatz Layer 1
RY(q0, 0.5)
RY(q1, 0.8)
 
# Entangling layer
CNOT(q0, q1)
 
# Ansatz Layer 2
RY(q0, 1.2)
RY(q1, 0.3)
 
# Measure
MEASURE q0 -> c0
MEASURE q1 -> c1

How VQE Works

┌─────────────────────────────────────────────┐
│              VQE Loop                       │
│                                             │
│  Quantum Circuit ──► Measure ──► Classical  │
│    (Ansatz)          Energy      Optimizer  │
│       ▲                              │      │
│       └──── Update angles ───────────┘      │
│                                             │
│      Repeat until energy converges          │
└─────────────────────────────────────────────┘

The Ansatz

Parameterized rotations (RY) and entangling gates (CNOT) create trial wavefunctions. A classical optimizer adjusts the angles to minimize energy.

Applications

  • Drug Discovery - Simulate protein-drug interactions
  • Battery Technology - Design better lithium-ion cells
  • Fertilizer Production - Optimize nitrogen fixation
  • Catalyst Design - Find efficient chemical catalysts

Try It Yourself

python qubitlang_cli.py run vqe.ql --shots 10000Request Files