Skip to main content

quantumHams

CI PyPI Python

quantumHams is an extensible Python library for constructing and simulating Hamiltonians from different quantum-computing technologies. The first models cover:

  • rubidium Rydberg neutral-atom arrays;
  • ytterbium trapped-ion effective Ising/Mølmer–Sørensen systems.

The core implementation runs with NumPy/SciPy on CPU. When CUDA-Q is installed, quantumHams performs native GPU-accelerated time evolution through the CUDA-Q Dynamics target; otherwise it automatically falls back to SciPy.

Installation

The Python import is quantumhams.

pip install quantumhams

Optional CUDA-Q integration on a supported Linux x86-64 environment:

pip install "quantumhams[cudaq]"

For development:

git clone https://github.com/venturusbr/quantumHams.git
cd quantumHams
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev,docs]"
pre-commit install
pytest

Examples

Neutral-atom Bell state

import numpy as np

from quantumhams import NeutralAtomRegister, RubidiumRydbergHamiltonian

omega = 2.0 * np.pi
register = NeutralAtomRegister.linear(n_atoms=2, spacing=1.0)
model = RubidiumRydbergHamiltonian(
    atom_register=register,
    rabi_frequency=omega,
    detuning=0.0,
    c6=100.0 * omega,
)

times = np.linspace(0.0, np.pi / (np.sqrt(2.0) * omega), 101)
result = model.evolve(initial_state="00", times=times)

# Under Rydberg blockade, the final state approaches
# (|01> + |10>) / sqrt(2).
print(result.states[-1])
print(result.probabilities[-1])

Trapped-ion Bell state

import numpy as np

from quantumhams import YtterbiumIonChain, YtterbiumMolmerSorensenHamiltonian

coupling = 2.0 * np.pi
chain = YtterbiumIonChain.linear(n_ions=2, spacing=1.0)
model = YtterbiumMolmerSorensenHamiltonian.power_law(
    chain=chain,
    coupling=coupling,
    exponent=0.0,
    transverse_field=0.0,
)

times = np.linspace(0.0, np.pi / (4.0 * coupling), 101)
result = model.evolve(initial_state="00", times=times)

# The final state approaches (|00> - i|11>) / sqrt(2).
print(result.states[-1])
print(result.probabilities[-1])

The complete example supports both technologies and explicit CPU, GPU, or automatic backend selection:

python examples/bell_state.py --technology neutral-atom --compute cpu
python examples/bell_state.py --technology trapped-ion --compute auto

Backend selection

from quantumhams.backends import backend_status, get_backend

print(backend_status())
backend = get_backend("auto")  # CUDA-Q when available, otherwise SciPy

With backend="auto" (the default), quantumHams first attempts native CUDA-Q Dynamics evolution and falls back to SciPy with a warning if CUDA-Q or a compatible GPU runtime is unavailable. Use backend="cudaq" to require CUDA-Q or backend="scipy" to force CPU execution.

Extending quantumHams

Add a model by implementing HamiltonianModel and returning a PauliHamiltonian from pauli_hamiltonian(). This separates physics models from execution backends, making new technologies and accelerators independently pluggable.

See docs/extending.md and CONTRIBUTING.md.

Governance and attribution

Author: Daniel de Haro Moraes
Company: Venturus

Licensed under Apache License 2.0.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantumhams-0.2.0.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quantumhams-0.2.0-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file quantumhams-0.2.0.tar.gz.

File metadata

  • Download URL: quantumhams-0.2.0.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for quantumhams-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7cfbf564b2438aaf49e099c4dca654082b7f850457dbef6c33ccce60e3a5cc76
MD5 1d496d68ac2d1323e09bfca9fa0c6393
BLAKE2b-256 164b407fe07076fb777b21d8794213860535932828956dee52a14d88f2aa3a75

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantumhams-0.2.0.tar.gz:

Publisher: release.yml on venturusbr/quantumHams

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantumhams-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: quantumhams-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for quantumhams-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab4a15362d91cb291bc2c5b2bc4601bde5c4b203ebd2dffe92742d09684c0acc
MD5 aae4aacf82d08e801cd9b488473e3ba1
BLAKE2b-256 de10609317117b0f0b80deea78f69e4fa054838e3252f0ab37a89eb7bed73dd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantumhams-0.2.0-py3-none-any.whl:

Publisher: release.yml on venturusbr/quantumHams

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page