Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
eb1a568
Update sigstore action version
gcalin Mar 24, 2025
cd6ec5b
Merge branch 'main' into dev
gcalin Mar 24, 2025
04e4169
Merge branch 'main' into dev
gcalin Jun 24, 2025
c24e0fa
Remove support for qiskit-qulacs
gcalin Jun 24, 2025
cdc4531
Update qiskit gate API usage
gcalin Jun 24, 2025
c451b98
Update tests to new qiskit API version
gcalin Jun 24, 2025
cf93599
Update dependency requirement to qiskit>=2.0
gcalin Jun 24, 2025
11eee6e
Make the decomposition of MCMX gates in PW ST initial conditions expl…
gcalin Jun 26, 2025
bd44cd5
Remove unused imports
gcalin Jun 26, 2025
2b5fadd
Ignore qiskit.syntehsis module in mypy
gcalin Jun 26, 2025
a7ac603
Refactor STQBM collision class into module, add equivalence class abs…
gcalin Jun 27, 2025
04bd4ca
Remove old STQBM collision operator
gcalin Jun 27, 2025
e7dd280
Add basic equivalence class tests
gcalin Jun 27, 2025
3193a45
Add documentation to equivalence class module
gcalin Jun 30, 2025
ddecc9a
Add equivalence class generator tests
gcalin Jun 30, 2025
f334231
Update website documentation
gcalin Jun 30, 2025
a4ac1bd
Update mypy dependency version
gcalin Jun 30, 2025
fcd8586
Add D3Q6 collision permutation step
gcalin Jul 2, 2025
3f05543
Add bitstring functionality to EQC generator
gcalin Jul 2, 2025
e1acf12
Add support for 3D STQBM lattice parsing
gcalin Jul 2, 2025
6c22a4d
Add generic PRP collision opeator
gcalin Jul 2, 2025
0b096d5
Add D3Q6 STQBM discretization
gcalin Jul 2, 2025
f5339f3
Update D2Q4 lattice tests
gcalin Jul 2, 2025
0d65a42
Add PRP collision property tests
gcalin Jul 2, 2025
ea65033
Add PRP collision redistribution step
gcalin Jul 2, 2025
032fbe1
Add missing str implementations
gcalin Jul 2, 2025
913257c
Update lattice documentation
gcalin Jul 7, 2025
c0d9c5a
Update base result documentation
gcalin Jul 7, 2025
498de70
Update STQBM components documentation
gcalin Jul 7, 2025
8f87fa1
Add LQLGA lattice
gcalin Jul 9, 2025
f19efba
Refactor eqc collision utilities for reuse
gcalin Jul 9, 2025
6db39c1
Add base LQLGA components
gcalin Jul 9, 2025
07e9f0b
Adjust STQBM names
gcalin Jul 9, 2025
3a8ab3b
Add LQLGA initialization, streaming, collision
gcalin Jul 9, 2025
233457c
Add CBSE collision module for STQBM, LQLGA
gcalin Jul 9, 2025
379638c
Update STQBM collision tests
gcalin Jul 9, 2025
8a75f24
Add lqlga tests
gcalin Jul 9, 2025
d88e813
Generalize CQLBM data for shapes
gcalin Jul 9, 2025
0b86826
Add warning for STQBM specular reflection BCs
gcalin Jul 9, 2025
a5fcea7
Add option for algorithm recompilation due to new qiskit transpiler
gcalin Jul 9, 2025
a3bb1af
Update STQBM simulation demo
gcalin Jul 9, 2025
bc5248c
Remove unused imports
gcalin Jul 9, 2025
63fea03
Add CBSE collision module info
gcalin Jul 9, 2025
5fbf1de
Include shape in web documentation
gcalin Jul 9, 2025
12807bc
Add lqlga collision operator
gcalin Jul 11, 2025
a24fe9b
Fix bug in LQLGA negative direction streaming
gcalin Jul 11, 2025
b009462
Fix typo
gcalin Jul 11, 2025
ef6f27d
Refactor former collisionless reinitializer to more general form
gcalin Jul 11, 2025
6dc7187
Add LQLGA result class
gcalin Jul 11, 2025
46a6b9d
Add support for LQLGA geometry parsing
gcalin Jul 11, 2025
9b29486
Add missing parameter in LQLGA streaming tests
gcalin Jul 11, 2025
22a65a6
Remove unused import
gcalin Jul 11, 2025
44ff086
Remove deprecated files
gcalin Jul 14, 2025
263a91f
Update component module header files
gcalin Jul 14, 2025
5176a7d
Update lattice module header files
gcalin Jul 14, 2025
eda0947
Update result documentation
gcalin Jul 14, 2025
c576fa5
Update LQLGA component documentation
gcalin Jul 14, 2025
b596eed
Update CBSE collision documentation
gcalin Jul 14, 2025
c1ba2fe
Update CQLBM component documentation
gcalin Jul 14, 2025
059e440
Update STQLBM component documentation
gcalin Jul 14, 2025
fa48206
Update lattice, geometry, eqc documentation
gcalin Jul 14, 2025
832b218
Update infrastructure documentation
gcalin Jul 14, 2025
13c293f
Update empty primitive circuit creation
gcalin Jul 14, 2025
8ec78da
Add missing parameter documentation in lattice base class
gcalin Jul 14, 2025
d6cca32
Update documentation landing page and references
gcalin Jul 14, 2025
e672b34
Add contribution guidelines
gcalin Jul 14, 2025
0bb407e
Update website internal documentation
gcalin Jul 14, 2025
aff293f
Update qlbm article citation
gcalin Jul 14, 2025
91cae3c
Update python version checking
gcalin Jul 14, 2025
04c8e0d
Update citation format
gcalin Jul 14, 2025
0b9ab01
Update citation format
gcalin Jul 14, 2025
735c15e
Update citation format
gcalin Jul 14, 2025
bfd467a
Update citation format
gcalin Jul 14, 2025
1a11c14
Update citation format
gcalin Jul 14, 2025
fa6cefb
Add d1q3 CBSE permutation
gcalin Jul 21, 2025
49bb646
Make CBSE redistribution adaptable for powers of 2
gcalin Jul 21, 2025
5e403d7
Add LQLGA D1Q3 reflection operator
gcalin Jul 21, 2025
630f483
Generalize EQC semantics to support arbitrarily heavy velocity channels
gcalin Jul 21, 2025
27f68ac
Make collision occur first in LQLGA loop
gcalin Jul 21, 2025
4058d13
Change lattice parsing to allow DdQq discretizations directly
gcalin Jul 21, 2025
dabbe0f
Add support for D1Q3 geometry
gcalin Jul 21, 2025
5189549
Normalize density in LQGLA result
gcalin Jul 21, 2025
15780aa
Update tests for new discretization parsing
gcalin Jul 21, 2025
00112f6
Fix linting
gcalin Jul 21, 2025
3f32468
Add discretization attribute to base lattice
gcalin Jul 21, 2025
882db5e
Improve LQLGA documentation and add examples
gcalin Aug 4, 2025
d47bbd3
Add BSE collision operator exmaple
gcalin Aug 4, 2025
0baae38
Update STQBM documentation examples to use the DdQq velocity notation
gcalin Aug 4, 2025
500e1f3
Update references and include new algorithm in README
gcalin Aug 4, 2025
06252e5
Update STQBM demos with new DdQq velocity notation
gcalin Aug 4, 2025
d8c1795
Add LQLGA simulation and visualization demos
gcalin Aug 4, 2025
b706459
Ignore capitialization in DdQq specification
gcalin Aug 4, 2025
97e520b
Add EQCCollision operator documentation to website
gcalin Aug 4, 2025
893e207
Update nblinks
gcalin Aug 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v2.1.1
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: |
./dist/*.tar.gz
Expand Down
6 changes: 0 additions & 6 deletions CITATION.bib

This file was deleted.

35 changes: 35 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Georgescu"
given-names: "Calin A."
orcid: "https://orcid.org/0000-0002-8102-6389"
- family-names: "Schalkers"
given-names: "Merel A."
orcid: "https://orcid.org/0000-0001-7751-9060"
- family-names: "Möller"
given-names: "Matthias"
orcid: "https://orcid.org/0000-0003-0802-945X"
title: "qlbm – A Qantum Lattice Boltzmann Software Framework"
version: 0.0.5
doi: "10.1016/j.cpc.2025.109699"
date-released: 2025-03-24
url: "https://doi.org/10.1016/j.cpc.2025.109699"
preferred-citation:
type: article
authors:
- family-names: "Georgescu"
given-names: "Calin A."
orcid: "https://orcid.org/0000-0002-8102-6389"
- family-names: "Schalkers"
given-names: "Merel A."
orcid: "https://orcid.org/0000-0001-7751-9060"
- family-names: "Möller"
given-names: "Matthias"
orcid: "https://orcid.org/0000-0003-0802-945X"
doi: "10.1016/j.cpc.2025.109699"
journal: "Computer Physics Communications"
title: "qlbm – A Qantum Lattice Boltzmann Software Framework"
volume: 315
year: 2025
issue: 109699
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contributing

Pull requests are welcome. To make a PR, first fork the repo, make your proposed changes on the main branch, and open a PR from your fork. If it passes tests and is accepted after review, it will be merged. For discussions about feature requests and contributions, please contact `c.a.georgescu@tudelft.nl`.

## Code style

### Formatting and Linting

All code should be formatted using `ruff` with default options. You should verify that your changes adhere to the `ruff` standards before submitting a PR. The exact version used in the CI pipeline can be found in the `pyproject.toml` file. Both the source code `ruff check qlbm` and the demos `ruff check demos` should adhere to these standards.

### Type annotation

`mypy` is used as a static type checker and all submissions must pass its checks. YYou should verify that your changes adhere to the `mypy` standards before submitting a PR. The exact version used in the CI pipeline can be found in the `pyproject.toml` file. There are some custom rules used for type checking: you can check whether your submission adheres to them by running `mypy qlbm test --config-file pyproject.toml`.
Linting


### Tests

We encourage each contribution to include unit tests for the added functionality. Tests reside in the `test` directory and can be executed using `pytest test/unit`.
Please sure all tests are passing before submitting a PR, and verify that simple flow simulations work as intended.
When fixing a bug, please add a test that demonstrates the fix.

### Documentation

We encourage all contributions to contain an adequate and thorough documentation of the changes. All contributed classes, methods, and attributes should be documented using the established style. Where appropriate, please include code-block examples and references to the scientific literature.

We use `sphinx` to automatically generate our documentation website. To make sure your contribution fits the standards of the code base, you can execute `make docs` in the root directory. To check the documentation website locally, you can first `cd docs` and then `make clean html` to build the website locally. You can view the updated web pages by opening `docs/build/html/index.html`.

### Easy verification

To verify that your changes comply with our checks, you can simply run `make check-ci` to run all checks.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ check-python-version:
@PYTHON_VERSION=$$($(PYTHON) --version 2>&1 | awk '{print $$2}'); \
MAJOR_VERSION=$$(echo $$PYTHON_VERSION | cut -d. -f1); \
MINOR_VERSION=$$(echo $$PYTHON_VERSION | cut -d. -f2); \
if [ "$$MAJOR_VERSION" -ne 3 ] || [ "$$MINOR_VERSION" -lt 8 ] || [ "$$MINOR_VERSION" -gt 13 ]; then \
echo "Python version must be between 3.8 and 3.13"; \
if [ "$$MAJOR_VERSION" -ne 3 ] || [ "$$MINOR_VERSION" -lt 12 ] || [ "$$MINOR_VERSION" -gt 13 ]; then \
echo "Python version must be between 3.12 and 3.13"; \
exit 1; \
fi

Expand Down
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ source qlbm-cpu-venv/bin/activate


Currently, `qlbm` supports two algorithms:
- The Collisionless QLBM described in [Efficient and fail-safe quantum algorithm for the transport equation](https://doi.org/10.1016/j.jcp.2024.112816) ([arXiv:2211.14269](https://arxiv.org/abs/2211.14269)) by M.A. Schalkers and M. Möller.
- The Space-Time QLBM described in [On the importance of data encoding in quantum Boltzmann methods](https://link.springer.com/article/10.1007/s11128-023-04216-6) by M.A. Schalkers and M. Möller.
- The Quantum Transport Method (Collisionless QLBM) described in [Efficient and fail-safe quantum algorithm for the transport equation](https://doi.org/10.1016/j.jcp.2024.112816) ([arXiv:2211.14269](https://arxiv.org/abs/2211.14269)) by M.A. Schalkers and M. Möller.
- The Space-Time QLBM/QLGA described in [On the importance of data encoding in quantum Boltzmann methods](https://link.springer.com/article/10.1007/s11128-023-04216-6) by M.A. Schalkers and M. Möller and expanded in [Fully Quantum Lattice Gas Automata Building Blocks for Computational Basis State Encodings](https://arxiv.org/abs/2506.12662).
- The Linear-encoding Quantum Lattice Gas Automata (LQLGA) described in [On quantum extensions of hydrodynamic lattice gas automata](https://www.mdpi.com/2410-3896/4/2/48) by P. Love and [Fully Quantum Lattice Gas Automata Building Blocks for Computational Basis State Encodings](https://arxiv.org/abs/2506.12662).

The `demos` directory contains several use cases for simulating and analyzing these algorithms. Each demo requires minimal setup once the virtual environment has been configured. Consult the `README.md` file in the `demos` directory for further details.

Expand Down Expand Up @@ -110,4 +111,18 @@ The `demos` directory contains several use cases for simulating and analyzing th

## Citation

A preprint describing `qlbm` in detail is currently available on [arXiv](https://arxiv.org/abs/2411.19439). If you use `qlbm`, you can cite it as per the [CITATION.bib file](CITATION.bib).
An open access peer-reviewed article describing `qlbm` is available [here](https://doi.org/10.1016/j.cpc.2025.109699). If you use `qlbm`, you can cite it as:

```
@article{georgescu2025qlbm,
title = {qlbm – A quantum lattice Boltzmann software framework},
journal = {Computer Physics Communications},
volume = {315},
pages = {109699},
year = {2025},
issn = {0010-4655},
doi = {https://doi.org/10.1016/j.cpc.2025.109699},
url = {https://www.sciencedirect.com/science/article/pii/S0010465525002012},
author = {C\u{{a}}lin A. Georgescu and Merel A. Schalkers and Matthias M\"{o}ller},
}
```
268 changes: 268 additions & 0 deletions demos/simulation/lqlga_simulation.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "70305ef3",
"metadata": {},
"outputs": [],
"source": [
"from qiskit_aer import AerSimulator\n",
"\n",
"from qlbm.components import EmptyPrimitive\n",
"from qlbm.components.lqlga.initial import LQGLAInitialConditions\n",
"from qlbm.components.lqlga.lqlga import LQLGA\n",
"from qlbm.components.lqlga.measurement import LQLGAGridVelocityMeasurement\n",
"from qlbm.infra import QiskitRunner, SimulationConfig\n",
"from qlbm.lattice.lattices.lqlga_lattice import LQLGALattice\n",
"from qlbm.tools.utils import create_directory_and_parents\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ec2f4062",
"metadata": {},
"outputs": [],
"source": [
"from qlbm.components.lqlga import LQGLAInitialConditions\n",
"from qlbm.lattice import LQLGALattice\n",
"\n",
"lattice = LQLGALattice(\n",
" {\n",
" \"lattice\": {\n",
" \"dim\": {\"x\": 7},\n",
" \"velocities\": \"D1Q3\",\n",
" },\n",
" \"geometry\": [{\"shape\": \"cuboid\", \"x\": [3, 5], \"boundary\": \"bounceback\"}],\n",
" },\n",
")\n",
"initial_conditions = LQGLAInitialConditions(lattice, [(tuple([2]), (True, True, True))])\n",
"initial_conditions.draw(\"mpl\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "05e422b4",
"metadata": {},
"outputs": [],
"source": [
"from qlbm.components.lqlga import LQLGAStreamingOperator\n",
"from qlbm.lattice import LQLGALattice\n",
"\n",
"lattice = LQLGALattice(\n",
" {\n",
" \"lattice\": {\n",
" \"dim\": {\"x\": 4},\n",
" \"velocities\": \"D1Q3\",\n",
" },\n",
" \"geometry\": [],\n",
" # \"geometry\": [{\"shape\": \"cuboid\", \"x\": [3, 5], \"boundary\": \"bounceback\"}],\n",
" },\n",
")\n",
"streaming_operator = LQLGAStreamingOperator(lattice)\n",
"streaming_operator.draw(\"mpl\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "020bb111",
"metadata": {},
"outputs": [],
"source": [
"from qlbm.components.lqlga import LQLGAReflectionOperator\n",
"from qlbm.lattice import LQLGALattice\n",
"\n",
"lattice = LQLGALattice(\n",
" {\n",
" \"lattice\": {\n",
" \"dim\": {\"x\": 7},\n",
" \"velocities\": \"D1Q3\",\n",
" },\n",
" \"geometry\": [{\"shape\": \"cuboid\", \"x\": [3, 5], \"boundary\": \"bounceback\"}],\n",
" },\n",
")\n",
"reflection_operator = LQLGAReflectionOperator(\n",
" lattice, shapes=lattice.shapes[\"bounceback\"]\n",
")\n",
"reflection_operator.draw(\"mpl\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "db7e5c99",
"metadata": {},
"outputs": [],
"source": [
"from qlbm.components.lqlga import LQLGA\n",
"from qlbm.lattice import LQLGALattice\n",
"\n",
"lattice = LQLGALattice(\n",
" {\n",
" \"lattice\": {\n",
" \"dim\": {\"x\": 7},\n",
" \"velocities\": \"D1Q3\",\n",
" },\n",
" \"geometry\": [{\"shape\": \"cuboid\", \"x\": [3, 5], \"boundary\": \"bounceback\"}],\n",
" },\n",
")\n",
"\n",
"LQLGA(lattice=lattice).draw(\"mpl\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bb1f01f6",
"metadata": {},
"outputs": [],
"source": [
"from qlbm.components.lqlga import LQLGAGridVelocityMeasurement\n",
"from qlbm.lattice import LQLGALattice\n",
"\n",
"lattice = LQLGALattice(\n",
" {\n",
" \"lattice\": {\n",
" \"dim\": {\"x\": 5},\n",
" \"velocities\": \"D1Q3\",\n",
" },\n",
" \"geometry\": [],\n",
" },\n",
")\n",
"\n",
"LQLGAGridVelocityMeasurement(lattice=lattice).draw(\"mpl\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "34715b68",
"metadata": {},
"outputs": [],
"source": [
"lattice = LQLGALattice(\n",
" {\n",
" \"lattice\": {\n",
" \"dim\": {\"x\": 4},\n",
" \"velocities\": \"D1Q3\",\n",
" },\n",
" \"geometry\": [],\n",
" # \"geometry\": [{\"shape\": \"cuboid\", \"x\": [3, 5], \"boundary\": \"bounceback\"}],\n",
" },\n",
")\n",
"\n",
"output_dir = f\"qlbm-output/lqlga-{lattice.logger_name()}-qiskit\"\n",
"create_directory_and_parents(output_dir)\n",
"\n",
"lattice.circuit.draw(\"mpl\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b084dda3",
"metadata": {},
"outputs": [],
"source": [
"LQLGA(lattice).circuit.draw(\"mpl\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "86ec87a5",
"metadata": {},
"outputs": [],
"source": [
"cfg = SimulationConfig(\n",
" initial_conditions=LQGLAInitialConditions(\n",
" lattice, [(tuple([2]), (True, True, True))]\n",
" ),\n",
" algorithm=LQLGA(lattice),\n",
" postprocessing=EmptyPrimitive(lattice),\n",
" measurement=LQLGAGridVelocityMeasurement(lattice),\n",
" target_platform=\"QISKIT\",\n",
" compiler_platform=\"QISKIT\",\n",
" optimization_level=0,\n",
" statevector_sampling=True,\n",
" execution_backend=AerSimulator(method=\"statevector\"),\n",
" sampling_backend=AerSimulator(method=\"statevector\"),\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4d54ef63",
"metadata": {},
"outputs": [],
"source": [
"cfg.prepare_for_simulation()\n",
"\n",
"# Number of shots to simulate for each timestep when running the circuit\n",
"# NUM_SHOTS = 2**10\n",
"\n",
"NUM_SHOTS = 2**10\n",
"\n",
"# Number of timesteps to simulate\n",
"NUM_STEPS = 100\n",
"\n",
"# Create a runner object to simulate the circuit\n",
"runner = QiskitRunner(\n",
" cfg,\n",
" lattice,\n",
")\n",
"\n",
"# Simulate the circuits using both snapshots\n",
"runner.run(\n",
" NUM_STEPS, # Number of time steps\n",
" NUM_SHOTS, # Number of shots per time step\n",
" output_dir,\n",
" statevector_snapshots=True,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "76799b9e",
"metadata": {},
"outputs": [],
"source": [
"cfg.initial_conditions.draw(\"mpl\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "244ed487",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading