Add breaks_TRS term predicate and guard compute_dynmat#1316
Open
antoine-levitt wants to merge 3 commits into
Open
Add breaks_TRS term predicate and guard compute_dynmat#1316antoine-levitt wants to merge 3 commits into
antoine-levitt wants to merge 3 commits into
Conversation
Mirror the existing breaks_symmetries dispatch with a breaks_TRS predicate on term builders. Mark Magnetic and Anyonic as breaking TRS, and assert in compute_dynmat that no term in the model breaks TRS — the phonon response solver folds the +q and -q Sternheimer equations into one using TRS, so it is currently invalid otherwise (see #1310, Dal Corso 2019). Also document the derivation of the "ψ̄·δψ with factor 2" form used in compute_δρ from scratch (no χ₀), tracking momenta term by term and showing how TRS identifies the missing δψ̄·ψ contribution with the computed one.
Technici4n
reviewed
May 7, 2026
Technici4n
reviewed
May 7, 2026
Technici4n
reviewed
May 7, 2026
Member
Author
|
Ended up rewriting the whole comment, AI is not great for this type of non-trivial explanation. Ready to review now. |
Technici4n
reviewed
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
breaks_TRSdispatch on term builders, mirroring the existingbreaks_symmetries. Default isfalse;MagneticandAnyonicare marked as breaking TRS.compute_dynmatnow asserts that no term in the model breaks TRS. The phonon response solver folds the +q and −q Sternheimer equations into a single one at +q (with a factor of 2), which is only valid under TRS — see Phonon +q instead of -q? #1310 and Dal Corso, https://arxiv.org/abs/1906.11673.Test plan
Pkg.test("DFTK"; test_args=["minimal"])passesMagneticterm in the model