Provide a mechanism to resolve imaginary modes#174
Merged
rul048 merged 63 commits intomaterialyzeai:mainfrom Mar 17, 2026
Merged
Provide a mechanism to resolve imaginary modes#174rul048 merged 63 commits intomaterialyzeai:mainfrom
rul048 merged 63 commits intomaterialyzeai:mainfrom
Conversation
PhononCalcSigned-off-by: Andrew S. Rosen <asrosen93@gmail.com>
Contributor
Author
|
@rul048 alright! This one should be ready for review now. 👍 This is the last big one. Thank you!! |
Signed-off-by: Andrew S. Rosen <asrosen93@gmail.com>
4 tasks
Contributor
|
The CI failure seems to be related to the recent nvalchemi-toolkit-ops release, which introduced quite a few changes. We will fix it asap. |
Contributor
|
All tests have now passed! Thanks so much for all the work on this. I really appreciate the thoughtful implementation and thorough testing. This will be very helpful for improving the robustness of QHA and harmonic phonon workflows in MatCalc. |
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
In this PR, I have added a new method that attempts to resolve the imaginary modes by rattling the atoms. This has been shown to drastically reduce the number of imaginary modes when followed by a subsequent relaxation. I tested this workflow out on MOF-5 and found it reduced the percent of modes that are imaginary from 5.72% to precisely 0 after just one pass.
To enable this, I have added a new keyword argument
fix_imaginary_attempts: int = 0that is the (maximum) number of attempts to be made to resolve the imaginary modes. One can imagine smarter ways of resolving the imaginary modes in the future, such as displacing the atoms along the imaginary modes, but I leave that to someone else to do if they wish.Tests
Besides the unit tests I added, I have run this test on MOF-5 to reproduce the constant-pressure heat capacity in this paper. I get the exact same answer to within <0.01 J/g/K after the imaginary mode correction. Without the imaginary mode correction, the error is very large.
Motivation
When calculating thermochemistry via
QHACalc(or even in the harmonic limit withPhononCalc), the thermodynamic properties are only strictly valid if there are no imaginary modes. However, a relaxed structure may not necessarily be dynamically stable, in which case the thermochemistry is largely meaningless due to the presence of imaginary modes, which phonopy simply ignores. There are several papers showing that the fraction of imaginary modes you have can drastically alter the predicted thermochemistry. Since users expect to runQHACalcorPhononCalcand get reliable results, it is important for us to provide a mechanism to not only report when things might be questionable but to also systematically correct them. SinceQHACalccallsPhononCalcfor each stress factor, this is something that needs to be implemented inPhononCalcdirectly and unfortunately can't be left to the user.Checklist
ruff.mypy.duecredit@due.dcitedecorators to reference relevant papers by DOI (example)Tip: Install
pre-commithooks to auto-check types and linting before every commit: