-
Notifications
You must be signed in to change notification settings - Fork 868
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
Read INCAR SYSTEM
as is, check_params
use proc_val
#4136
Merged
shyuep
merged 14 commits into
materialsproject:master
from
DanielYang59:vasp-eq-ignore-comment
Nov 12, 2024
Merged
Changes from 3 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
057f6af
remove unnecessary processing
DanielYang59 82b59de
stupid manual update of GGA recording
DanielYang59 60eb627
stupid manually add ZAB_VDW tag
DanielYang59 1b4438a
avoid casing SYSTEM value
DanielYang59 633db73
fix SYSTEM case and add test
DanielYang59 b3d92a8
tweak comment
DanielYang59 826a27c
use a non capitalized string for test
DanielYang59 eab2e2a
fix test string
DanielYang59 d0fa08a
revert str compare, startswith is slower
DanielYang59 fdfed3a
Merge remote-tracking branch 'upstream/master' into vasp-eq-ignore-co…
DanielYang59 b53d52c
add test for Incar pop method
DanielYang59 c365099
check_params consider lower str exception
DanielYang59 b89da9d
reuse proc_val in check_params, thanks @yantar92
DanielYang59 64a3888
Merge branch 'master' into vasp-eq-ignore-comment
DanielYang59 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -484,7 +484,7 @@ def _parse( | |||
or elem.attrib["comment"] | ||||
== "INVERSE MACROSCOPIC DIELECTRIC TENSOR (including local field effects in RPA (Hartree))" | ||||
): | ||||
if self.incar.get("ALGO", "Normal").upper() == "BSE": | ||||
if self.incar.get("ALGO", "Normal") == "Bse": | ||||
self.dielectric_data["freq_dependent"] = self._parse_diel(elem) | ||||
elif "density" not in self.dielectric_data: | ||||
self.dielectric_data["density"] = self._parse_diel(elem) | ||||
|
@@ -641,7 +641,7 @@ def converged_electronic(self) -> bool: | |||
while set(final_elec_steps[idx]) == to_check: | ||||
idx += 1 | ||||
return idx + 1 != self.parameters["NELM"] | ||||
if self.incar.get("ALGO", "").upper() == "EXACT" and self.incar.get("NELM") == 1: | ||||
if self.incar.get("ALGO", "") == "Exact" and self.incar.get("NELM") == 1: | ||||
return True | ||||
return len(final_elec_steps) < self.parameters["NELM"] | ||||
|
||||
|
@@ -800,10 +800,10 @@ def run_type(self) -> str: | |||
"--", | ||||
"None", | ||||
}: | ||||
incar_tag = self.incar.get("METAGGA", "").strip().upper() | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this would be covered by pymatgen/src/pymatgen/io/vasp/inputs.py Line 1029 in 6992aee
|
||||
incar_tag = self.incar.get("METAGGA", "").upper() | ||||
run_type = METAGGA_TYPES.get(incar_tag, incar_tag) | ||||
elif self.parameters.get("GGA"): | ||||
incar_tag = self.parameters.get("GGA", "").strip().upper() | ||||
incar_tag = self.parameters.get("GGA", "").upper() | ||||
run_type = GGA_TYPES.get(incar_tag, incar_tag) | ||||
elif self.potcar_symbols[0].split()[0] == "PAW": | ||||
run_type = "LDA" | ||||
|
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.
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.
After #4122 we should be confident that string values are now capitalized (except for those in
lower_str_keys
andas_is_str_keys
), these case conversion may not be needed.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.
If they are capitalized, why comparing with "Bse" (non-capitalized)
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.
Sorry I may not understand your question? The value
Bse
is capitalized? The keyALGO
is in uppercase.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.
Sory, I got completely confused. Mostly because of apparent inconsistency between the code and VASP wiki. If you look at https://www.vasp.at/wiki/index.php/ALGO, you will see that BSE and many other values are all capitals:
So, the code reads awkward now.
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.
Yes I find it confusing too #4122 (comment), and @esoteric-ephemera said it's a convention to pymatgen #4122 (comment)
This is likely like this since the start:
As VASP itself is largely case insensitive, we just need to internally standardize for easy handling (no need to cast to upper/capitalize when comparing values and so on). I personally prefer to cast both value and tag to uppercase for the following reason:
But this would be badly breaking (every downstream package would find the INCAR key in a different case) so I guess it's not worth the price. So we'd better come up with something that is not breaking. In any case I would leave this for a future PR.
I'm not sure it's doable or not, a good alternative is to subclass a "case insensitive string" as an inplace replacement of built in
str
to avoid the headache altogether (but I currently don't have a good way to overwrite the membership check), I might have another try later.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.
I see, and I agree that abstracting things out into case-sensitive/insensitive class is the most robust way to go.
As for the convention, it annoyingly has exceptions:
As you can see, capitalization is documented, except "keys specified in lower_str_keys". Currently it is a single key -
ML_MODE
.However, do note that
Incar.check_params
does not expect such exceptions:(aside: incar_parameters.json does not even list
ML_MODE
)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.
Yep I updated the docstring to reflect this key/value case issue, but I'm not sure about the casing of
ML_MODE
either (I thought VASP is largely case insensitive ) #4122 (comment)I never use that tag so cannot comment, it would be great if you (or someone else) could confirm this behaviour.
Thanks I would update it (one exception makes everything hard to handle)
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.
I do not use this tag either, but clearly its value is case-sensitive - #3625
I looked up https://www.vasp.at/wiki/index.php/ML_MODE and it says
I conclude that case-insensitivity is not universal.
Ironically, simply upcasing (rathen than capitalizing) everything would not require making an exception for ML_MODE.
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.
Yes I did see this PR and the VASP comment as well.
I believe ML_MODE is the only exception for now. upcase everything (except for SYSTEM) would make everything easy, but I guess ML_MODE was not there when this part of code was written (12 years ago), and it's hard to change it now without breakage
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.
100% agree.