Skip to content

Conversation

@ytdHuang
Copy link
Member

@ytdHuang ytdHuang commented Oct 28, 2025

Checklist

Thank you for contributing to QuantumToolbox.jl! Please make sure you have finished the following tasks before opening the PR.

  • Please read Contributing to Quantum Toolbox in Julia.
  • Any code changes were done in a way that does not break public API.
  • Appropriate tests were added and tested locally by running: make test.
  • Any code changes should be julia formatted by running: make format.
  • All documents (in docs/ folder) related to code changes were updated and able to build locally by running: make docs.
  • (If necessary) the CHANGELOG.md should be updated (regarding to the code changes) and built by running: make changelog.

Request for a review after you have completed all the tasks. If you have not finished them all, you can also open a Draft Pull Request to let the others know this on-going work.

Description

Start from QuTiP v5.2.1, they have generalize the definition of liouvillian as

$$\mathcal{L} [\cdot] =-i\left(\hat{H}[\cdot] - [\cdot]\hat{H}^\dagger\right)$$

see also the PR in qutip: qutip/qutip#2658

That is, we should at least allow users to disable the assumption that the Hamiltonian is Hermitian. This could be beneficial for people working on non-Hermitian physics.

@ytdHuang ytdHuang changed the title Generalize the definition of liouvillian Add keyword argument assume_hermitian to liouvillian Oct 29, 2025
@ytdHuang
Copy link
Member Author

ytdHuang commented Nov 8, 2025

I think we need to set compat SciMLOperators = "1.10", otherwise the dynamical solver will not work after this PR.

@albertomercurio
Copy link
Member

albertomercurio commented Nov 13, 2025

Ok, I made a PR in SciMLOperators.jl

SciML/SciMLOperators.jl#323

This fixes all the benchmark regressions. I don't understand if the Zygote and Enzyme autodiff are also fixed. We should see it once we re-trigger the benchmarks.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a keyword argument assume_hermitian to the liouvillian function, aligning with QuTiP v5.2.1's generalized Liouvillian definition. This allows users working with non-Hermitian physics to disable the Hermitian assumption for Hamiltonians.

  • Modified the liouvillian function to accept assume_hermitian parameter (default: Val(true))
  • Updated internal _liouvillian implementations to handle both Hermitian and non-Hermitian Hamiltonians
  • Upgraded SciMLOperators dependency from 1.4 to 1.11 to support updated operator representations

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/qobj/superoperators.jl Core implementation of assume_hermitian parameter for Liouvillian construction, including updated documentation and optimized tuple handling for collapse operators
src/time_evolution/mesolve.jl Updated to use QuantumObjectEvolution constructor for consistency
src/time_evolution/time_evolution_dynamical.jl Adapted to SciMLOperators 1.11 changes (MatrixOperator → ScaledOperator), updating field access from .A to .L
test/core-test/quantum_objects_evo.jl Added comprehensive tests for assume_hermitian parameter, including operator structure verification and type inference tests
test/core-test/time_evolution.jl Added integration tests for assume_hermitian = Val(false) with time-dependent Hamiltonians; updated operator type assertions for SciMLOperators 1.11
test/ext-test/cpu/autodiff/autodiff.jl Extended autodiff tests (Zygote and Enzyme) to verify compatibility with non-Hermitian Liouvillians
Project.toml Bumped SciMLOperators version requirement from 1.4 to 1.11
CHANGELOG.md Documented the new assume_hermitian feature
src/settings.jl Minor whitespace cleanup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@albertomercurio albertomercurio merged commit 402c27a into main Nov 14, 2025
16 of 20 checks passed
@ytdHuang ytdHuang deleted the liouvillian2 branch November 15, 2025 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants