Skip to content

Add breaks_TRS term predicate and guard compute_dynmat#1316

Open
antoine-levitt wants to merge 3 commits into
masterfrom
breaks-trs
Open

Add breaks_TRS term predicate and guard compute_dynmat#1316
antoine-levitt wants to merge 3 commits into
masterfrom
breaks-trs

Conversation

@antoine-levitt
Copy link
Copy Markdown
Member

Summary

  • Adds a breaks_TRS dispatch on term builders, mirroring the existing breaks_symmetries. Default is false; Magnetic and Anyonic are marked as breaking TRS.
  • compute_dynmat now 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.
  • Documents the derivation of the dropped `δψ̄·ψ` term in `compute_δρ` from scratch (without going through χ₀): tracks the four Fourier components of `δρ`, picks out the +q part, and uses TRS (`ψ_{−k} = ψ_k*`) to identify the second +q contribution with the first, justifying the factor 2.

Test plan

  • Pkg.test("DFTK"; test_args=["minimal"]) passes
  • Existing phonon tests still pass (no Magnetic / Anyonic terms in those models)
  • Confirm the assertion fires on a phonon-style call with a Magnetic term in the model

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.
Comment thread src/densities.jl Outdated
Comment thread src/terms/terms.jl Outdated
Comment thread src/postprocess/phonon.jl Outdated
@antoine-levitt
Copy link
Copy Markdown
Member Author

Ended up rewriting the whole comment, AI is not great for this type of non-trivial explanation. Ready to review now.

@antoine-levitt antoine-levitt marked this pull request as ready for review May 7, 2026 18:42
Copy link
Copy Markdown
Collaborator

@Technici4n Technici4n left a comment

Choose a reason for hiding this comment

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

I like this, thanks

Comment thread src/terms/terms.jl Outdated
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.

2 participants