Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
cd92ebe
Add accumulation register utilities to LQLGA lattice
gcalin Sep 8, 2025
8819e10
Add Hamming Weight adder primitive
gcalin Sep 8, 2025
dde6a91
Add Hamming Weight Adder primitive tests
gcalin Sep 8, 2025
67a93b4
Add Hamming Weight Adder primitive tests
gcalin Sep 8, 2025
4273cae
Improve support for accumulation and marker qubits in LQLGA lattice
gcalin Oct 27, 2025
67b73fe
Change error to exception in discrtetization properties
gcalin Oct 27, 2025
3f05552
Add ABE Lattice
gcalin Oct 27, 2025
65f31db
Add ABE Lattice tests
gcalin Oct 27, 2025
49fcd92
Add ABE streaming operator
gcalin Oct 29, 2025
bcec240
Add ABE grid measurement primitive
gcalin Oct 29, 2025
3e1ce08
Add ABE initial conditions
gcalin Oct 29, 2025
d40a3bb
Add ABE QLBM
gcalin Oct 29, 2025
b01b669
Fix gird measurement primitive str rerpesentation
gcalin Oct 29, 2025
37aee81
Extract truncated QFT primitive
gcalin Oct 29, 2025
58b2d4c
Refactor CBSE redistribution to use truncarted QFT
gcalin Oct 29, 2025
6db6fe4
Add ABE components module
gcalin Oct 29, 2025
4984ac5
Add average occupancy LQLGA initial conditions
gcalin Oct 29, 2025
877e588
Update CollisionlessResult to work with ABE Lattices
gcalin Oct 29, 2025
4d615a8
Update runner to supporte ABELattice
gcalin Oct 29, 2025
317ddc0
Add option to save statevector to all results
gcalin Nov 4, 2025
b31ac74
Add geometry data for DdQq discretizations in AB lattices
gcalin Nov 4, 2025
24b19a4
Add D2Q9 discretization
gcalin Nov 4, 2025
c4080ae
Fix bug in LQLGA averaged initial conditions
gcalin Nov 4, 2025
ad8c616
Add optional parameter to measure velocity qubits in AB grid measurement
gcalin Nov 4, 2025
31618aa
Add d2q9 streaming for AB lattice
gcalin Nov 4, 2025
700b309
Add d2q9 reflection for AB lattice
gcalin Nov 4, 2025
739b01a
Add d2q9 reflection to AB loop
gcalin Nov 4, 2025
7fa5d72
Fix bug in CQLBM geometry checking
gcalin Nov 4, 2025
87fc057
Add the option to save the statevector in qlbm runner
gcalin Nov 4, 2025
89f714f
Fix imports
gcalin Nov 4, 2025
659e1dd
Add base amplitude lattice
gcalin Nov 4, 2025
bc19167
Refactor ABELattice and CollisionlessLattice to share base AmpltiudeL…
gcalin Nov 4, 2025
eff4877
Change ABELattice to ABLattice
gcalin Nov 4, 2025
ff45d0b
Refactor algorithm names into MS and AB
gcalin Nov 4, 2025
f48f626
Make CQLBM common entrypoint for MSQLBM and ABQLBM
gcalin Nov 4, 2025
bcb9624
Update AB nomeclature and module imports
gcalin Nov 5, 2025
db5f413
Add AB component documentation
gcalin Nov 5, 2025
f4fb3b9
Update lattice documentation
gcalin Nov 5, 2025
174309d
Update CQLBM documentation
gcalin Nov 5, 2025
251826f
Update result documentation
gcalin Nov 5, 2025
597aa62
Update component documentation and modules
gcalin Nov 5, 2025
19f4ae0
Add documentation for MSQLBM components and lattice
gcalin Nov 13, 2025
8619a37
Update entry page to documentation website
gcalin Nov 13, 2025
0a007b2
Fix bug in CQLBM delegation
gcalin Nov 13, 2025
894fcae
Add support for different encodings under ABLattice
gcalin Nov 14, 2025
952c352
Add encodings enumerator for AB subtypes
gcalin Nov 14, 2025
d33cca8
Add OH lattice
gcalin Nov 14, 2025
c78591a
Adapt ABQLBM components to work with OH lattice
gcalin Nov 14, 2025
183d93a
Add MS encoding type to MSLattice
gcalin Nov 14, 2025
dccca3f
Add documentation to OHLattice and module
gcalin Nov 14, 2025
bf9dcaa
Fix test and import
gcalin Nov 14, 2025
28a552d
Fix documentation typo
gcalin Nov 14, 2025
a3dab11
Update documentation website structure
gcalin Nov 14, 2025
d9875ea
Fix type inference errors
gcalin Nov 14, 2025
bdbe308
Update LQLGA simulation notebook
gcalin Nov 24, 2025
764637e
Update simulation noteooks
gcalin Nov 24, 2025
a130bf7
Update visualization demo notebooks
gcalin Nov 24, 2025
e6c8513
Fix documentation typos
gcalin Nov 24, 2025
2967074
Update simulation demo notebooks
gcalin Nov 24, 2025
44d85ac
Fix bug in amplitude component visualization demo notebook
gcalin Nov 24, 2025
d73e27a
Update documentation website
gcalin Nov 24, 2025
e0da8b9
Merge branch 'main' into dev
gcalin Nov 24, 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
141 changes: 141 additions & 0 deletions demos/simulation/ab_simulation.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "348de144",
"metadata": {},
"source": [
"# Simulating the Amplitude-Based Collisionless QLBM"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "181af34e",
"metadata": {},
"outputs": [],
"source": [
"from qiskit_aer import AerSimulator\n",
"\n",
"from qlbm.components import (\n",
" CQLBM,\n",
" ABGridMeasurement,\n",
" ABInitialConditions,\n",
" EmptyPrimitive,\n",
")\n",
"from qlbm.infra import QiskitRunner, SimulationConfig\n",
"from qlbm.lattice import ABLattice\n",
"from qlbm.tools.utils import create_directory_and_parents\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "05e4915d",
"metadata": {},
"outputs": [],
"source": [
"lattice = ABLattice(\n",
" {\n",
" \"lattice\": {\"dim\": {\"x\": 64, \"y\": 32}, \"velocities\": \"d2q9\"},\n",
" \"geometry\": [\n",
" {\"shape\": \"cuboid\", \"x\": [10, 13], \"y\": [14, 17], \"boundary\": \"bounceback\"},\n",
" ],\n",
" }\n",
")\n",
"\n",
"\n",
"output_dir = \"qlbm-output/ab-d2q9-64x32-1-obstacle-qiskit\"\n",
"create_directory_and_parents(output_dir)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "deb472a0",
"metadata": {},
"outputs": [],
"source": [
"cfg = SimulationConfig(\n",
" initial_conditions=ABInitialConditions(lattice),\n",
" algorithm=CQLBM(lattice),\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"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "57240678",
"metadata": {},
"outputs": [],
"source": [
"cfg.prepare_for_simulation()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1da18eb8",
"metadata": {},
"outputs": [],
"source": [
"# Number of shots to simulate for each timestep when running the circuit\n",
"NUM_SHOTS = 2**12\n",
"\n",
"# Number of timesteps to simulate\n",
"NUM_STEPS = 20"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5c8c7d1e",
"metadata": {},
"outputs": [],
"source": [
"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",
")"
]
}
],
"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
}
51 changes: 37 additions & 14 deletions demos/simulation/lqlga_simulation.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "4c316e35",
"metadata": {},
"source": [
"# Simulating the Linear Encoding Quantum Lattice Gas Automata"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -10,12 +18,14 @@
"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.components.lqlga import (\n",
" LQLGA,\n",
" LQGLAInitialConditions,\n",
" LQLGAGridVelocityMeasurement,\n",
")\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"
"from qlbm.lattice import LQLGALattice\n",
"from qlbm.tools.utils import create_directory_and_parents"
]
},
{
Expand All @@ -25,9 +35,6 @@
"metadata": {},
"outputs": [],
"source": [
"from qlbm.components.lqlga import LQGLAInitialConditions\n",
"from qlbm.lattice import LQLGALattice\n",
"\n",
"lattice = LQLGALattice(\n",
" {\n",
" \"lattice\": {\n",
Expand Down Expand Up @@ -69,18 +76,34 @@
{
"cell_type": "code",
"execution_count": null,
"id": "4d54ef63",
"id": "65ec52e8",
"metadata": {},
"outputs": [],
"source": [
"cfg.prepare_for_simulation()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "11c5dbb7",
"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",
"# Number of timesteps to simulate\n",
"NUM_STEPS = 20\n",
"\n",
"NUM_STEPS = 20"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4d54ef63",
"metadata": {},
"outputs": [],
"source": [
"# Create a runner object to simulate the circuit\n",
"runner = QiskitRunner(\n",
" cfg,\n",
Expand Down Expand Up @@ -121,7 +144,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.7"
"version": "3.13.9"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,71 +1,69 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "328661be",
"metadata": {},
"source": [
"# Simulation the Multi-Speed Collisionless QLBM"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9b1814b3",
"id": "be6f3d11",
"metadata": {},
"outputs": [],
"source": [
"from qiskit_aer import AerSimulator\n",
"\n",
"from qlbm.components import (\n",
" CQLBM,\n",
" CollisionlessInitialConditions,\n",
" EmptyPrimitive,\n",
" GridMeasurement,\n",
" MSInitialConditions,\n",
")\n",
"from qlbm.infra import QiskitRunner, SimulationConfig\n",
"from qlbm.lattice import CollisionlessLattice\n",
"from qlbm.tools.utils import create_directory_and_parents"
"from qlbm.lattice import MSLattice\n",
"from qlbm.tools.utils import create_directory_and_parents\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e8e77d2f-a778-441c-b436-a61e1f3154cf",
"id": "e8d2b671",
"metadata": {},
"outputs": [],
"source": [
"# Load example with mixed boundary conditions and create output directory\n",
"lattice = CollisionlessLattice(\n",
"lattice = MSLattice(\n",
" {\n",
" \"lattice\": {\"dim\": {\"x\": 16, \"y\": 16}, \"velocities\": {\"x\": 4, \"y\": 4}},\n",
" \"lattice\": {\n",
" \"dim\": {\"x\": 64, \"y\": 32},\n",
" \"velocities\": {\n",
" \"x\": 4,\n",
" \"y\": 4,\n",
" },\n",
" },\n",
" \"geometry\": [\n",
" {\"shape\": \"cuboid\", \"x\": [9, 12], \"y\": [3, 6], \"boundary\": \"specular\"},\n",
" {\"shape\": \"cuboid\", \"x\": [9, 12], \"y\": [9, 12], \"boundary\": \"bounceback\"},\n",
" {\"shape\": \"cuboid\", \"x\": [10, 13], \"y\": [14, 17], \"boundary\": \"bounceback\"},\n",
" ],\n",
" }\n",
")\n",
"\n",
"\n",
"output_dir = \"qlbm-output/collisionless-2d-16x16-2-obstacle-mixed-qiskit\"\n",
"output_dir = \"qlbm-output/ms-d2q9-64x32-1-obstacle-qiskit\"\n",
"create_directory_and_parents(output_dir)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b4df878f",
"metadata": {},
"outputs": [],
"source": [
"# Number of shots to simulate for each timestep when running the circuit\n",
"NUM_SHOTS = 2**12\n",
"# Number of timesteps to simulate\n",
"NUM_STEPS = 20"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "26ce07ff-55f9-4828-a9b3-4e9c6dc6a856",
"id": "da32a65c",
"metadata": {},
"outputs": [],
"source": [
"# In the simulation configuration function the user can determine the specifications of the run\n",
"cfg = SimulationConfig(\n",
" initial_conditions=CollisionlessInitialConditions(lattice),\n",
" initial_conditions=MSInitialConditions(lattice),\n",
" algorithm=CQLBM(lattice),\n",
" postprocessing=EmptyPrimitive(lattice),\n",
" measurement=GridMeasurement(lattice),\n",
Expand All @@ -75,13 +73,13 @@
" statevector_sampling=True,\n",
" execution_backend=AerSimulator(method=\"statevector\"),\n",
" sampling_backend=AerSimulator(method=\"statevector\"),\n",
")"
")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b733d245-c344-46db-88bb-864e4cf07474",
"id": "92d4f9ab",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -91,16 +89,30 @@
{
"cell_type": "code",
"execution_count": null,
"id": "f1c02c70-8244-4a86-8357-9f8c80d2d632",
"id": "f2ba1f1f",
"metadata": {},
"outputs": [],
"source": [
"# Number of shots to simulate for each timestep when running the circuit\n",
"NUM_SHOTS = 2**12\n",
"\n",
"# Number of timesteps to simulate\n",
"NUM_STEPS = 20"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7f26c6d9",
"metadata": {},
"outputs": [],
"source": [
"# Create a runner object to simulate the circuit\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",
Expand All @@ -113,7 +125,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a4c15cbe-3766-4ea1-b3cb-f7caec41328c",
"id": "a1737979",
"metadata": {},
"outputs": [],
"source": []
Expand All @@ -135,7 +147,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.7"
"version": "3.13.9"
}
},
"nbformat": 4,
Expand Down
Loading