VACUUM - To be (Hermitian) or not to be (deprecating force_wv_symmetry)#330
Merged
Conversation
jhalpern30
marked this pull request as ready for review
July 16, 2026 19:58
Collaborator
Author
|
@logan-nc relatively quick one here motivated by background reading I was doing to prep for the perturbed eq updated |
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.
Brought about by my investigation for the plasma response matrix in #93, I realized that we can deprecate the
force_wv_symmetryparameter.The response matrices are inherently Hermitian - they compute real quantities (energies), so they must have all real eigenvalues and the formulation of the code expects this. However, numerical errors allow for non-Hermitian components to appear. In ForceFreeStates, this is highly nontrivial (again, see #93), but in Vacuum, its must simpler. The non-Hermitian error is only due to the error induced from discretization and can be easily decreased by increasing the number of grid points:
In general, this is much less than the non-Hermitian errors seen in the plasma response matrix. I chose the value of 1e-4 relatively arbitrarily to be just a bit tighter than the arbitrary one for the plasma response matrix tolerance we've been using.
The
force_wv_symmetryparameter (lsymz) in the Fortran, allowed a flag to turn this on/off in the vacuum code. However, for the above reasons, this was pretty much always left as true. Because of this and my above arguments, I have deprecated this "always-on" parameter in favor or always symmetrizing the matrix, and including a simple warning statement for large Hermitian errors, requesting the user to increase the grid size (this will go hand in hand with just increasing the accuracy needed to converge the boundary integral too), so I doubt users will ever really run into this, but just in case.Since this parameter defaulted to true, this doesn't change the outputs. However, I've added it to the list of deprecated parameters for backwards compatibility.
As an example of usage, I ran DIIID ideal as normal (and nothing changed), and then dropped
mthvacdown to an unrealistic 32, and the warnings pop up like this