Skip to content

Compute thermal displacements from thermal displacement matrices - #1131

Merged
atztogo merged 1 commit into
mainfrom
refactor-thermal-displacement
Nov 24, 2026
Merged

atztogo merged 1 commit into
mainfrom
refactor-thermal-displacement

Conversation

@atztogo

@atztogo atztogo commented Nov 24, 2026

Copy link
Copy Markdown
Member

ThermalDisplacements and ThermalDisplacementMatrices had separate
loops over the mesh and the modes, and the warning on the acoustic modes
at Gamma had a third. One loop in ThermalMotion now sums the thermal
displacement matrices, with the modes at a q-point computed together,
and the thermal displacements are their diagonal elements or their
projections along the given direction. Unused code
(_project_eigenvectors and its attributes) is removed.

IterMesh now diagonalizes the dynamical matrix at each q-point with
diagonalize_dynamical_matrices, as Mesh does, instead of
numpy.linalg.eigh. With with_eigenvectors=False, IterMesh raised
UnboundLocalError; this is fixed.

The results agree with those before the change within 4e-14 (relative)
for Si and SnO2 with and without the options. New tests check the
thermal displacements against the matrices and IterMesh without
eigenvectors.

This follows #1121 by @rpinho, which batched the modes in
ThermalDisplacements.

ThermalDisplacements and ThermalDisplacementMatrices had separate loops
over the mesh and the modes. One loop now sums the matrices, and the
thermal displacements are their diagonal elements or their projections.
Unused code is removed.

IterMesh diagonalizes dynamical matrices by
diagonalize_dynamical_matrices as Mesh does. This also fixes
UnboundLocalError with with_eigenvectors=False.
@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.40%. Comparing base (b77f8be) to head (568aae4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1131      +/-   ##
==========================================
+ Coverage   87.37%   87.40%   +0.02%     
==========================================
  Files         247      247              
  Lines       42569    42564       -5     
==========================================
+ Hits        37196    37203       +7     
+ Misses       5373     5361      -12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@atztogo
atztogo merged commit 0c745a2 into main Nov 24, 2026
10 checks passed
@atztogo
atztogo deleted the refactor-thermal-displacement branch November 24, 2026 10:03
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.

1 participant