-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve LargeSigmaHandler
#333
Merged
Merged
Conversation
This file contains 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
janosh
added
handler
Error handler
fix
Bug fix
vasp
Vienna Ab initio Simulation Package
labels
May 10, 2024
This is slick!!!! |
janosh
approved these changes
Jun 4, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me! thanks @esoteric-ephemera! 👍
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.
Context
The
LargeSigmaHandler
for VASP calculations tries to ensure that the energy contribution to the electronic free energy due to Fermi-level smearing ("smearing entropy") is not in excess of 1 meV/atom. This recommendation comes from VASP.Currently, this only checks for order >= 1 Methfessel-Paxton smearing (ISMEAR >= 1), probably because the VASP manual doesn't make it clear that Gaussian smearing (ISMEAR = 0) is just order-0 Methfessel-Paxton.
For Fermi-Dirac smearing (ISMEAR = -1), one can simulate the effect of finite electronic temperature, so it's not a good idea to check the entropy in this case.
Changes
This PR ensures that the smearing entropy is monitored for ISMEAR >= 0, and now looks at the smearing entropy at the end of each ionic step, rather than just the last step.
Additionally, the method by which SIGMA (the smearing width) is reduced has been changed based on the work of dos Santos and Marzari. (See note below.)
The test for this handler has also been updated.
Copying @matthewkuner who brought this issue up and worked with me to get a fix together
Minor changes
Adding functionality to gzip test files - pytest seems to unzip them at test time, but only in CI. Similar behavior occurs for the Gaussian tests (see the
gunzip_file
function intests/gaussian/test_handlers.py
).The function
get_gzip_or_unzipped
inconftest.py
is a simple utility to return the gzipped file if it exists, and the unzipped version if that exists (a reversemonty.os.path.zpath
that also raises an exception if none of the files exist).Explanation of new smearing extrapolation
Near the SIGMA = 0, the free energy has a low-order Taylor expansion:
$F(\sigma) \approx E(\sigma \to 0) + \frac{1}{2} \gamma \sigma^2$ $F(\sigma)$ is the free energy due to smearing, $E(\sigma \to 0)$ is the electronic energy without smearing (the quantity we usually want), and $\gamma$ is related to the second derivative of the smearing entropy wrt $\sigma$ .
where
One can then extrapolate to what the best reduced sigma value$\sigma'$ is by demanding that the smearing energy is $E_s=1$ meV/atom:
$\sigma' = [2 E_s / \gamma]^{1/2} \sigma$ .$\sigma' = \max(0.01, 0.8 \cdot [2 E_s / \gamma]^{1/2} \sigma)$ to ensure that $\sigma'$ is not too small.
Practically, we also impose
The factor of 0.8 helps ensure that the threshold is overshot slightly. The previous
LargeSigmaHandler
decreased SIGMA too slowly in many cases.