Lightweight Quantum Simulation Suite with VQE and QPE modules (PennyLane-based)
Project description
Quantum Simulation Suite — VQE + QPE (PennyLane)
A modern, modular, and fully reproducible quantum-chemistry simulation suite built on
PennyLane, featuring:
- Variational Quantum Eigensolver (VQE)
- State-Specific VQE (SSVQE)
- Quantum Phase Estimation (QPE)
- Unified molecule registry, geometry generators, and plotting tools
- Consistent caching and reproducibility across all solvers
This project refactors all previous notebooks into a clean Python package with
a shared vqe_qpe_common/ layer for Hamiltonians, molecules, geometry, and plotting.
How to get started
- For the full background on VQE and QPE: see THEORY.md
- For CLI usage and automation: see USAGE.md
- For example notebooks: see notebooks/README_notebooks.md
These documents complement this 'README.md' and provide the theoretical foundation and hands-on execution details of the VQE/QPE suite.
Project Structure
Variational_Quantum_Eigensolver/
├── README.md
├── THEORY.md
├── USAGE.md
├── LICENSE
├── requirements.txt
├── pyproject.toml
│
├── vqe/ # VQE package
│ ├── __main__.py # CLI: python -m vqe
│ ├── core.py # VQE orchestration (runs, scans, sweeps)
│ ├── engine.py # Devices, noise, ansatz/optimizer plumbing
│ ├── ansatz.py # UCCSD, RY-CZ, HEA, minimal ansätze
│ ├── optimizer.py # Adam, GD, Momentum, SPSA, etc.
│ ├── hamiltonian.py # VQE-specific wrapper → uses vqe_qpe_common.hamiltonian
│ ├── io_utils.py # JSON caching, run signatures
│ ├── visualize.py # Convergence, scans, noise plots
│ └── ssvqe.py # Subspace-search VQE (excited states)
│
├── qpe/ # QPE package
│ ├── __main__.py # CLI: python -m qpe
│ ├── core.py # Controlled-U, trotterized dynamics, iQFT
│ ├── hamiltonian.py # QPE-specific wrapper → uses vqe_qpe_common.hamiltonian
│ ├── io_utils.py # JSON caching, run signatures
│ ├── noise.py # Depolarizing + amplitude damping channels
│ └── visualize.py # Phase histograms + sweep plots
│
├── vqe_qpe_common/ # Shared logic for VQE + QPE
│ ├── geometry.py # Bond/angle geometry generators
│ ├── hamiltonian.py # Unified Hamiltonian builder (PennyLane/OpenFermion)
│ ├── molecules.py # Unified molecule registry
│ ├── molecule_viz.py # Draw molecules
│ └── plotting.py # Shared plotting + filename builders
│
├── images/ # Saved png files
│ ├── vqe/
│ └── qpe/
│
├── results/ # JSON outputs
│ ├── vqe/
│ └── qpe/
│
└── notebooks/
├── README_notebooks.md # Markdown for the example notebooks
├── getting_started/ # Intro notebook implementing VQE and QPE from scratch
├── vqe/ # Importing from the vqe/ package
└── qpe/ # Importing from the qpe/ package
This structure ensures:
- VQE and QPE share the same chemistry (
vqe_qpe_common/) - All results are cached consistently (
results/) - All plots use one naming system (
vqe_qpe_common/plotting.py) - CLI tools are production-ready (
python -m vqe,python -m qpe)
⚙️ Installation
Install from PyPI
pip install vqe-pennylane
Install from source (development mode)
git clone https://github.com/SidRichardsQuantum/Variational_Quantum_Eigensolver.git
cd Variational_Quantum_Eigensolver
pip install -e .
Confirm installation
python -c "import vqe, qpe; print('VQE+QPE imported successfully!')"
Common Core (Shared by VQE & QPE)
The following modules ensure full consistency between solvers:
| Module | Purpose |
|---|---|
vqe_qpe_common/molecules.py |
Canonical molecule definitions |
vqe_qpe_common/geometry.py |
Bond/angle/coordinate generators |
vqe_qpe_common/hamiltonian.py |
Hamiltonian construction + OpenFermion fallback |
vqe_qpe_common/plotting.py |
Unified filename builder + PNG export |
🔹 VQE Package
Features:
- Ground-state VQE
- Excited-state SSVQE
- Geometry scans
- Noise sweeps
- Mapping comparisons
- Optimizer registry
- Result caching
Run example:
from vqe.core import run_vqe
result = run_vqe("H2", ansatz_name="UCCSD", optimizer_name="Adam", steps=50)
print(result["energy"])
🔹 QPE Package
Features:
- Noiseless & noisy QPE
- Trotterized exp(-iHt)
- Inverse QFT
- Noise channels
- Cached results
Example:
from vqe_qpe_common.hamiltonian import build_hamiltonian
from qpe.core import run_qpe
symbols = ["H", "H"]
coords = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.7414]]
H, n_qubits, hf_state = build_hamiltonian(symbols, coords, charge=0, basis="STO-3G")
result = run_qpe(hamiltonian=H, hf_state=hf_state, n_ancilla=4)
CLI Usage
VQE
python -m vqe -m H2 -a UCCSD -o Adam --steps 50
QPE
python -m qpe --molecule H2 --ancillas 4 --shots 2000
🧪 Tests
pytest -v
📘 Author: Sid Richards (SidRichardsQuantum)
LinkedIn: https://www.linkedin.com/in/sid-richards-21374b30b/
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vqe_pennylane-0.2.4.tar.gz.
File metadata
- Download URL: vqe_pennylane-0.2.4.tar.gz
- Upload date:
- Size: 59.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
296ed388ee9aa855ff0141e3663b3cd1d901a282614dce559fb6b206555bbc32
|
|
| MD5 |
33465cafab3e29f5c4a2253391f15c4f
|
|
| BLAKE2b-256 |
b585524149a271e3f00e0ed27d276100cd62ac0800a7694a3fbd86cb1c85dbbd
|
File details
Details for the file vqe_pennylane-0.2.4-py3-none-any.whl.
File metadata
- Download URL: vqe_pennylane-0.2.4-py3-none-any.whl
- Upload date:
- Size: 52.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e71454d994b8274f3c88159e3c3709d6c2b24458929e4664b0c67bf31d08aa17
|
|
| MD5 |
353c717fcce91b54e35a5c78116bb0bd
|
|
| BLAKE2b-256 |
ba2c6a8405256adedc33e65dfc63dcf87fca35441f3fcb23ed13b68f078334c5
|