You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Speed up thermal displacements by batching mode populations - #1121
Thermal displacements recompute Bose populations once per mode and look up the Gamma index at every q-point. A silicon 31 by 31 by 31 mesh with 101 temperatures runs 2.65 times faster in the paired measurements, saving a median 2.17 seconds with the stored mesh path. Evaluate the mode populations together at each q-point, contract their projections and cache the Gamma index. Existing tests and a comparison with projected displacement tensors cover the outputs, with agreement within 1e-12 relative and 1e-14 square angstrom absolute tolerance. This patch was prepared with AI assistance.
Thank you for this one too. Your change computes the contributions of
all phonon modes at a q-point together, instead of one mode at a time.
I checked it: the results agree with the current code, and it is
faster.
Reading the code around it, I found that this part needed refactoring
more than speed: ThermalDisplacements and ThermalDisplacementMatrices had separate loops doing the same sums.
In #1131, one loop sums the thermal displacement matrices with the
modes at a q-point computed together as you did, and the thermal
displacements are taken from them.
To make it really faster, IterMesh would have to be improved. For
historical reasons, the phonopy command uses it for thermal
displacements so that a dense mesh does not run out of memory. Since
speed was not a concern, it computes phonons one q-point at a time.
Computing them in batches should make it faster, but I don't see a need
for it now; I'll work on it if there is a demand. #1131 includes a
first step toward it: IterMesh now diagonalizes the dynamical
matrices with diagonalize_dynamical_matrices, as Mesh does.
Making a new PR was less work for me than asking for changes here, so
I'm closing this PR without merging it.
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
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.
Thermal displacements recompute Bose populations once per mode and look up the Gamma index at every q-point. A silicon 31 by 31 by 31 mesh with 101 temperatures runs 2.65 times faster in the paired measurements, saving a median 2.17 seconds with the stored mesh path. Evaluate the mode populations together at each q-point, contract their projections and cache the Gamma index. Existing tests and a comparison with projected displacement tensors cover the outputs, with agreement within 1e-12 relative and 1e-14 square angstrom absolute tolerance. This patch was prepared with AI assistance.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N