Week 10: Code Refactoring and Fermionic Baths Implementation

GSoC 2026
Week 10
QuTiP
HEOM
PETSc
Fermionic Baths
Refactoring
Author

Chinmay Tangal

Published

August 3, 2026

This week, the primary focus was on code refactoring based on feedback from my mentor on the draft Pull Request, and expanding the PETSc backend to support Fermionic baths.

1. Code Refactoring and PR Review

Following the submission of the draft Pull Request, I received valuable feedback and suggestions from my mentor. I dedicated a significant portion of the week to addressing these comments. The refactoring effort mainly targeted: - Improving the overall structure, maintainability, and readability of the code in backend_petsc.py and bofin_solvers.py. - Enhancing integration with the petsc_integrator.py. - Ensuring that the codebase adheres closely to QuTiP’s coding standards and design philosophies. - Cleaning up the test suite to ensure robust and maintainable tests for the new backend.

2. Fermionic Baths Integration

In addition to the refactoring, I worked on getting the PETSc backend to seamlessly handle Fermionic baths. Up to this point, our testing and benchmarking predominantly focused on Bosonic environments.

I ran a small-scale benchmark comparing the traditional CSR backend with the PETSc backend distributed across 4 MPI ranks.

Analysis and Insights

  1. Correctness Verified: The final density matrix state computed by the PETSc backend matched the traditional CSR solver exactly. This confirms that the internal mapping, hierarchy construction, and linear algebra translations for Fermionic ADOs are functioning correctly.
  2. Performance Overhead on Small Systems: As observed in earlier weeks with Bosonic baths, the PETSc backend exhibits some overhead (both in assembly and evolution) for relatively small systems (only 848 ADOs). The communication overhead across 4 MPI ranks outweighs the computational benefits at this scale.
  3. Future Scaling: The primary advantage of the PETSc backend shines at massive depths (tens of thousands of ADOs). Now that the Fermionic implementation is verified to be accurate, we are in a strong position to scale Fermionic bath simulations to depths and system sizes that would typically cause the traditional solver to run out of memory.

Conclusion

Week 10 successfully cleared up the codebase through essential refactoring and demonstrated that our PETSc backend implementation is robust enough to handle Fermionic bath dynamics correctly. We are now well-prepared for final optimizations and the culmination of the GSoC project.