Skip to content
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

Fix KspacingMetalHandler triggering on runs that don't use KSPACING #298

Merged
merged 5 commits into from
Nov 3, 2023

Conversation

janosh
Copy link
Member

@janosh janosh commented Nov 3, 2023

@esoteric-ephemera and I noticed that the KspacingMetalHandler (formerly ScanMetalHandler) triggers even for runs that don't use KSPACING due to using a bad fallback value in

v.incar.get("KSPACING", 1) > 0.22

v = Vasprun(self.output_filename)
# check whether bandgap is zero and KSPACING is too large
# using 0 as fallback value for KSPACING so that this handler does not trigger if KSPACING is not set
if v.eigenvalue_band_properties[0] == 0 and v.incar.get("KSPACING", 0) > 0.22:
return True
except Exception:
pass
return False
def correct(self):
"""Perform corrections."""

If "KSPACING" is not in v.incar this check will still return True and apply the corresponding KSPACING reduction correction.

@rkingsbury Would be great to get your feedback on this in case we overlooked something.

The reason for renaming to KspacingMetalHandler (ScanMetalHandler is still around but deprecated) is that KSPACING is not specific to SCAN and in fact may in the future be used by the MP GGA workflows as well.

We added a test in 6019d60 to make sure the handler does not trigger on an INCAR that doesn't specify KSPACING.

Pinging @Andrew-S-Rosen, @utf, @JaGeo in case you'd like to chime in.

@janosh janosh added handler Error handler fix Bug fix labels Nov 3, 2023
@codecov-commenter
Copy link

codecov-commenter commented Nov 3, 2023

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (377454c) 65.83% compared to head (5f52a59) 65.92%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #298      +/-   ##
==========================================
+ Coverage   65.83%   65.92%   +0.09%     
==========================================
  Files          51       51              
  Lines        5628     5641      +13     
==========================================
+ Hits         3705     3719      +14     
+ Misses       1923     1922       -1     
Files Coverage Δ
custodian/vasp/tests/test_handlers.py 99.78% <100.00%> (+<0.01%) ⬆️
custodian/custodian.py 78.75% <80.00%> (ø)
custodian/vasp/handlers.py 78.43% <71.42%> (+0.23%) ⬆️
custodian/vasp/jobs.py 49.72% <0.00%> (ø)

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

@janosh janosh merged commit 89b6840 into master Nov 3, 2023
3 checks passed
@janosh janosh deleted the fix-KspacingMetalHandler branch November 3, 2023 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix handler Error handler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants