quantumHams
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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cfbf564b2438aaf49e099c4dca654082b7f850457dbef6c33ccce60e3a5cc76
|
|
| MD5 |
1d496d68ac2d1323e09bfca9fa0c6393
|
|
| BLAKE2b-256 |
164b407fe07076fb777b21d8794213860535932828956dee52a14d88f2aa3a75
|
Provenance
The following attestation bundles were made for quantumhams-0.2.0.tar.gz:
Publisher:
release.yml on venturusbr/quantumHams
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quantumhams-0.2.0.tar.gz -
Subject digest:
7cfbf564b2438aaf49e099c4dca654082b7f850457dbef6c33ccce60e3a5cc76 - Sigstore transparency entry: 2473937676
- Sigstore integration time:
-
Permalink:
venturusbr/quantumHams@a9a3ae7991ef51463f2c0c7fd728d0f9bec960cd -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/venturusbr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a9a3ae7991ef51463f2c0c7fd728d0f9bec960cd -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab4a15362d91cb291bc2c5b2bc4601bde5c4b203ebd2dffe92742d09684c0acc
|
|
| MD5 |
aae4aacf82d08e801cd9b488473e3ba1
|
|
| BLAKE2b-256 |
de10609317117b0f0b80deea78f69e4fa054838e3252f0ab37a89eb7bed73dd5
|
Provenance
The following attestation bundles were made for quantumhams-0.2.0-py3-none-any.whl:
Publisher:
release.yml on venturusbr/quantumHams
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quantumhams-0.2.0-py3-none-any.whl -
Subject digest:
ab4a15362d91cb291bc2c5b2bc4601bde5c4b203ebd2dffe92742d09684c0acc - Sigstore transparency entry: 2473937740
- Sigstore integration time:
-
Permalink:
venturusbr/quantumHams@a9a3ae7991ef51463f2c0c7fd728d0f9bec960cd -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/venturusbr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a9a3ae7991ef51463f2c0c7fd728d0f9bec960cd -
Trigger Event:
release
-
Statement type: