Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
63d0570
Add AB SR utilitites
gcalin Mar 14, 2026
5b73a98
Draft implementation of SR agnostic BCs
gcalin Mar 16, 2026
38ece45
Add support for specular reflection in ABQLBM
gcalin Mar 27, 2026
6d4481a
Delegate agnostic BCs and multigeometry logic in ABQLBM
gcalin Mar 27, 2026
6375d68
Add specular reflection zone agnostic BCs for ABQLBM
gcalin Mar 27, 2026
eab7ea8
Add zone agnostic BC supporting logic
gcalin Mar 27, 2026
7c8f015
Add ABQLBM specular reflection tests
gcalin Mar 27, 2026
d6657a7
Update documentation website layout
gcalin Mar 27, 2026
a47d571
Update workflows and caching
gcalin Mar 27, 2026
ff01157
Update documentation
gcalin Mar 27, 2026
a69a715
Run tests on dev branch in CI
gcalin Mar 27, 2026
0ca770e
Update lattice tests with new register logic
gcalin Mar 28, 2026
78db27b
Add AB reflection tests
gcalin Mar 28, 2026
cb430c7
Add equivalence tests between segment-wise and zone-agnostic BCs
gcalin Mar 28, 2026
34ec904
Add ABQLBM parallel segment-wise BC tests
gcalin Mar 28, 2026
bbf611a
Update documentation and package API
gcalin Mar 28, 2026
30e74fc
Fix bug in D1Q3 ABQLBM velocity ordering and rendering
gcalin Apr 2, 2026
17ab2c1
Add support for square grid YMonomials
gcalin Apr 15, 2026
0c9592f
Update ABQLBM simulation demos
gcalin Apr 15, 2026
a8a85fe
Remove debugging statements
gcalin Apr 15, 2026
6913bf1
Update YMonomial mismatch test and add square grid tests
gcalin Apr 15, 2026
d6f4414
Fix bug in Zone Agnostic SR check
gcalin Apr 15, 2026
f31112d
Fix typo in output dir name in AB YMonomial demo
gcalin Apr 15, 2026
345e307
Fix bug in ABQLBM parallel BC demo
gcalin May 12, 2026
263453b
Fix docstring import ambiguity and character escape
gcalin May 12, 2026
dca1827
Fix parameter mismatch in CQLBM to ABQLBM delegation
gcalin May 12, 2026
25c76d4
Fix type mismatch in AB SR tests
gcalin May 12, 2026
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
16 changes: 13 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.12.5


- name: Cache pip packages
uses: actions/cache@v4
with:
path: |
~/.cache/pip
${{ env.pythonLocation }}
key: pip-docs-3.12.5-${{ hashFiles('pyproject.toml') }}
restore-keys: |
pip-docs-3.12.5-

- name: Install dependencies
run: |
sudo apt-get install -y -qq pandoc libglfw3-dev libgles2-mesa-dev
Expand All @@ -37,8 +47,8 @@ jobs:
run: |
make -C docs doctest

- name: Build docs
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
- name: Build Docs
if: ${{ github.ref == 'refs/heads/main' }}
run: |
sphinx-build docs/source _build

Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ jobs:
with:
python-version: 3.12.5
architecture: x64
cache: "pip" # caching pip dependencies
- name: Cache pip packages
uses: actions/cache@v4
with:
path: |
~/.cache/pip
${{ env.pythonLocation }}
key: pip-format-3.12.5-${{ hashFiles('pyproject.toml') }}
restore-keys: |
pip-format-3.12.5-
- name: Install Ruff
run: |
pip install --upgrade pip
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test using pytest

on:
push:
branches: [main]
branches: [main, dev]
pull_request:
branches: [main]

Expand All @@ -20,15 +20,29 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip" # caching pip dependencies
- name: Cache pip packages
uses: actions/cache@v4
with:
path: |
~/.cache/pip
${{ env.pythonLocation }}
key: pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
pip-${{ matrix.python-version }}-
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y -qq libboost-all-dev cmake
- name: Install qlbm
run: |
pip install --upgrade pip
pip install --upgrade pip
pip install -e .[cpu,dev]
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Run unit tests
run: pytest test/unit --doctest-modules --junitxml=junit/test-results.xml --cov=qlbm --cov-report=xml --cov-report=html
- name: Run tests
run: pytest test --doctest-modules --junitxml=junit/test-results.xml --cov=qlbm --cov-report=xml --cov-report=html
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report-${{ matrix.python-version }}
path: htmlcov/
10 changes: 9 additions & 1 deletion .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ jobs:
with:
python-version: 3.12.5
architecture: x64
cache: "pip" # caching pip dependencies
- name: Cache pip packages
uses: actions/cache@v4
with:
path: |
~/.cache/pip
${{ env.pythonLocation }}
key: pip-typecheck-3.12.5-${{ hashFiles('pyproject.toml') }}
restore-keys: |
pip-typecheck-3.12.5-
- name: Install mypy
run: |
pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion demos/simulation/ab_simulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
")\n",
"\n",
"\n",
"output_dir = \"qlbm-output/ab-d2q9-64x32-1-obstacle-qiskit\"\n",
"output_dir = \"qlbm-output/ab-d2q9-64x32-1-obstacle-cuboid-qiskit\"\n",
"create_directory_and_parents(output_dir)"
]
},
Expand Down
24 changes: 16 additions & 8 deletions demos/simulation/ab_simulation_parallel_bcs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
"from qiskit_aer import AerSimulator\n",
"\n",
"from qlbm.components import (\n",
" CQLBM,\n",
" ABDiscreteUniformInitialConditions,\n",
" ABGridMeasurement,\n",
" EmptyPrimitive,\n",
")\n",
Expand All @@ -42,7 +40,7 @@
" }\n",
")\n",
"\n",
"output_dir = \"qlbm-output/ab-pbc-d2q9-16x16-1-obstacle-qiskit\"\n",
"output_dir = \"qlbm-output/ab-pbc-d2q9-16x16-qiskit\"\n",
"create_directory_and_parents(output_dir)"
]
},
Expand All @@ -54,16 +52,15 @@
"outputs": [],
"source": [
"# Geometry of marker |0>: two \"stacked\" \"wide\" rectangles\n",
"# Geometry of the marker |1>: one \"tall\" rectangle under the first two\n",
"# Geometry of the marker |1>: only the \"top\" rectangle is present\n",
"# These geometries will act fully in parallel, and we will observe the average behavior\n",
"lattice.set_geometries(\n",
" [\n",
" [\n",
" {\"shape\": \"cuboid\", \"x\": [6, 12], \"y\": [12, 14], \"boundary\": \"bounceback\"},\n",
" {\"shape\": \"cuboid\", \"x\": [6, 12], \"y\": [8, 10], \"boundary\": \"bounceback\"},\n",
" # {\"shape\": \"cuboid\", \"x\": [6, 8], \"y\": [0, 6], \"boundary\": \"bounceback\"},\n",
" ],\n",
" [{\"shape\": \"cuboid\", \"x\": [6, 8], \"y\": [0, 6], \"boundary\": \"bounceback\"}],\n",
" [{\"shape\": \"cuboid\", \"x\": [6, 12], \"y\": [12, 14], \"boundary\": \"bounceback\"},],\n",
" ]\n",
")"
]
Expand All @@ -85,15 +82,16 @@
"metadata": {},
"outputs": [],
"source": [
"from qlbm.components.ab.ab import ABQLBM\n",
"from qlbm.components.ab.initial import ABParallelDiscreteUniformInitialConditions\n",
"\n",
"cfg = SimulationConfig(\n",
" initial_conditions=ABParallelDiscreteUniformInitialConditions(\n",
" lattice,\n",
" [[1], [1]],\n",
" [[5], [5]],\n",
" [([0, 1], [0, 1, 2, 3]), ([0, 1], [0, 1, 2, 3])],\n",
" ),\n",
" algorithm=CQLBM(lattice),\n",
" algorithm=ABQLBM(lattice, use_agnostic_bcs=False),\n",
" postprocessing=EmptyPrimitive(lattice),\n",
" measurement=ABGridMeasurement(lattice),\n",
" target_platform=\"QISKIT\",\n",
Expand Down Expand Up @@ -158,6 +156,16 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "395acbf2",
"metadata": {},
"outputs": [],
"source": [
" "
]
}
],
"metadata": {
Expand Down
126 changes: 126 additions & 0 deletions demos/simulation/ab_simulation_y_monomial.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "cc98e730",
"metadata": {},
"source": [
"# Simulating the ABQLBM with a `YMonomial` object"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6c6d0765",
"metadata": {},
"outputs": [],
"source": [
"from qiskit_aer import AerSimulator\n",
"\n",
"from qlbm.components import (\n",
" EmptyPrimitive,\n",
")\n",
"from qlbm.components.ab.ab import ABQLBM\n",
"from qlbm.components.ab.initial import ABDiscreteUniformInitialConditions\n",
"from qlbm.components.ab.measurement import ABGridMeasurement\n",
"from qlbm.infra import QiskitRunner, SimulationConfig\n",
"from qlbm.lattice import ABLattice\n",
"from qlbm.tools.utils import create_directory_and_parents\n",
"\n",
"lattice = ABLattice(\n",
" {\n",
" \"lattice\": {\"dim\": {\"x\": 8, \"y\": 16}, \"velocities\": \"D2Q9\"},\n",
" \"geometry\": [\n",
" {\n",
" \"shape\": \"ymonomial\",\n",
" \"exponent\": 2,\n",
" \"comparator\": \"<\",\n",
" \"boundary\": \"bounceback\",\n",
" }\n",
" ],\n",
" }\n",
")\n",
"\n",
"output_dir = \"qlbm-output/ab-d2q9-8x16-1-obstacle-ymonomial-qiskit\"\n",
"create_directory_and_parents(output_dir)\n",
"\n",
"cfg = SimulationConfig(\n",
" initial_conditions=ABDiscreteUniformInitialConditions(\n",
" lattice,\n",
" [1, 5, 8],\n",
" ([], list(range(lattice.num_gridpoints[1].bit_length()))),\n",
" ),\n",
" algorithm=ABQLBM(lattice, True),\n",
" postprocessing=EmptyPrimitive(lattice),\n",
" measurement=ABGridMeasurement(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",
")\n",
"\n",
"cfg.prepare_for_simulation()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "12b8f1f8",
"metadata": {},
"outputs": [],
"source": [
"# Number of shots to simulate for each timestep when running the circuit\n",
"NUM_SHOTS = 2**12\n",
"\n",
"\n",
"# Number of timesteps to simulate\n",
"NUM_STEPS = 20\n",
"\n",
"runner = QiskitRunner(\n",
" cfg,\n",
" lattice,\n",
")\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": "33c4b96d",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "qlbm-cpu-venv",
"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.13.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
28 changes: 26 additions & 2 deletions docs/source/_static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,40 @@
}

.bd-page-width {
max-width: 80%; /* default is 88rem */
max-width: 92%;
}

.sphinxsidebarwrapper { overflow-y: scroll; }

.bd-sidebar-primary {
max-width: 230px
max-width: 190px;
}

html {
--pst-sidebar-secondary: 13rem;
}

@media (min-width: 960px) {
.bd-sidebar-primary {
width: 18%;
min-width: 160px;
max-width: 190px;
}
}

@media (min-width: 1200px) {
.bd-sidebar-secondary {
width: var(--pst-sidebar-secondary);
}
}

table.center-align-col {
margin-left: auto;
margin-right: auto;
}

table.center-align-col th,
table.center-align-col td {
text-align: center;
vertical-align: middle;
}
11 changes: 11 additions & 0 deletions docs/source/code/comps_cqlbm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,19 @@ Reflection

.. autoclass:: qlbm.components.ms.primitives.EdgeComparator


.. note::
The amplitude-based QLBM supports two kinds of reflection operators: segment-wise (or standard) and zone-agnostic.
The two methods are physically equivalent, but their implementation differs algorithmically.
For multi-geometry cases, only the segment-wise implementation is currently supported.


.. autoclass:: qlbm.components.ab.reflection.ABReflectionOperator

.. autoclass:: qlbm.components.ab.reflection.ABBounceBackReflectionOperator

.. autoclass:: qlbm.components.ab.reflection.ABSpecularReflectionOperator

.. autoclass:: qlbm.components.ab.reflection.ABZoneAgnosticReflectionOperator

.. autoclass:: qlbm.components.ab.reflection.ABZoneAgnosticReflectionOracle
Expand Down
Loading
Loading