This project benchmarks various solvers for the Lindblad master equation, which models the dynamics of open quantum systems. The solvers compared include implementations using QuTiP, SciPy, Runge-Kutta, and Backward Euler methods. Parallelism has not been taken into account.
The Lindblad master equation is a key mathematical model for describing the evolution of quantum systems interacting with their environment. This project provides an efficient benchmarking framework to compare different numerical solvers for the equation. While parallelism is required for modelling the evolution of large quantum systems, still choosing an optimal algorithm for scaling up for concurrent operation is necessary. This benchmark aims exactly at this problem. By benchmarking the algorithms, we can choose the more optimal approach for parallel implementation. Note the coupling and decay rate of the target system does impact the solvers' performance as well.
- Pairwise interaction between the atoms has been considered in the model.
- Spontanous emission has been included in the model.
- Multiple solvers for the Lindblad equation:
- QuTiP-based solver
- SciPy-based solver
- Runge-Kutta solver
- Backward Euler solver
- Sparse Matrix-based solver
- Scalability tests for systems with up to N atoms.
- Visualization of runtime and memory usage.
- Logging for detailed performance insights.
- Clone the repository:
git clone <repository_url>
- Navigate to the project directory:
cd <project_directory>
- Install required dependencies:
pip install -r requirements.txt
- Run the main script to perform scalability benchmarks:
python main.py
- Results will be logged to
benchmark-lindblad-solver.log
and visualized as plots.
The following solvers are implemented in solvers.py
:
- QuTiP Solver: Uses QuTiP's
mesolve
function for solving the Lindblad equation. - SciPy Solver: Implements a custom solver based on
solve_ivp
from SciPy. - Runge-Kutta Solver: A manual implementation of the Runge-Kutta integration method (4th degree).
- Backward Euler Solver: A backward Euler method tailored for the Lindblad equation.
- Sparse Matrix Solver: A solver using Scipy's sparse matrix modules.
The Benchmark
class in benchmark.py
:
- Scalability Testing: Evaluates solvers across varying the number of atoms in the system and measures runtime and memory usage.
- Visualization: Generates comparative plots for runtime and memory usage, saved as
benchmark-plots-<timestamp>.png
.
- Runtime Plot: Shows how solver runtimes scale with the number of atoms.
- Memory Usage Plot: Displays memory consumption trends across solvers.
Unit tests are provided to validate the functionality of the solvers and benchmarking framework. To run the tests:
-
Ensure all dependencies are installed:
pip install -r requirements.txt
-
Use
pytest
to run all tests:pytest
-
Test files are located in the
tests/
directory and cover the following:- Solvers: Tests for individual solver implementations.
- Benchmarking: Tests for the benchmarking framework.
Example command to run a specific test:
pytest tests/test_solvers.py
Test results will indicate whether all components of the project are functioning correctly.
We welcome contributions to improve the project. To contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m "Add your message here"
- Push the branch:
git push origin feature/your-feature-name
- Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.