-
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
VaspInput setter and Incar.check_params() are inconsistent #4119
Comments
Thanks for reporting this, I believe the warning on pymatgen/src/pymatgen/io/vasp/inputs.py Line 988 in 4f7aa35
I.e. any keyword not included inside the following and is not pymatgen/src/pymatgen/io/vasp/inputs.py Lines 876 to 932 in 4f7aa35
The warning on pymatgen/src/pymatgen/io/vasp/inputs.py Lines 910 to 924 in 4f7aa35
I believe it should be a float:
|
With Version: 2024.10.22, I am still getting
|
Hi thanks for following up. I just have a look and I believe it's a separate issue related to #4042, i.e. we need to update the
pymatgen/src/pymatgen/io/vasp/incar_parameters.json Lines 191 to 218 in 3ee17e2
But currently I don't have a better way other than doing that manually (which would be very inefficiently) given the amount of possible INCAR tags and their values. Updating the tags should be easier with: pymatgen/src/pymatgen/io/vasp/help.py Lines 68 to 83 in 3ee17e2
But updating the values is a bit tricky so I assume we need to helper script to do this? Would you be interested? If not I'm happy to get my hands on this a bit later :) |
@classmethod
def get_incar_tags(cls) -> list[str]:
"""Get a list of all INCAR tags from the VASP wiki."""
url = ("https://www.vasp.at/wiki/api.php?"
"action=query&list=categorymembers"
"&cmtitle=Category:INCAR_tag"
"&cmlimit=500&format=json")
response = requests.get(url, timeout=60)
response_dict = json.loads(response.text)
def extract_titles(data):
"""Extract keywords from from Wikimedia response data.
See https://www.vasp.at/wiki/api.php?action=help&modules=query
Returns: List of keywords as strings.
"""
return [category_data['title'] for category_data
in data['query']['categorymembers']]
tags = extract_titles(response_dict)
while 'continue' in response_dict:
response = requests.get(
url + f"&cmcontinue={response_dict['continue']['cmcontinue']}",
timeout=60
)
response_dict = json.loads(response.text)
tags = tags + extract_titles(response_dict)
return tags I can make it into pull request if you wish. |
That would be hugely appreciated! You might have misread my previous comment #4119 (comment) Current we already have a method to get the (tags/keywords/parameters): pymatgen/src/pymatgen/io/vasp/help.py Lines 68 to 70 in 0e65d35
What we need is something to update the values, which is a bit tricky. Currently VASP wiki doesn't seem to provide an API to get possible values of a tag directly (do they?), and the webpage format seems pretty inconsistent and probably make scraping infeasible (I'm not a web scraping expert and I wish I'm wrong here). For example the ALGO tag page seems to list all possible values at the start: However the GGA tag only listed a small portion and left the rest inside a table: |
* src/pymatgen/io/vasp/help.py (VaspDoc.get_incar_tags): Use Mediawiki API instead of parsing the HTML source directly. The old approach is not stable against changes in the tag list because of the way URLs are constructed. pagefrom= parameters start from certain tag, which is not guaranteed to provide the complete tag list as the new tags are added before that tag given in pagefrom=. At the moment of writing this commit, PRECFOCK tag is already missed using the old approach. Following up: materialsproject#4119 (comment)
I do not see anything either.
Scaping is possible, but awkward. One will need to write the scaper specifically for this page and add a number of asserts to catch incompatible changes (those are unlikely in practice though). I looked into the source of the page at https://www.vasp.at/wiki/index.php?title=GGA&action=edit It should be still possible to write a dedicated scraper, via pymediawiki + wikitexparser, but non-standard pages like the one for GGA will need to have a specially tailored handler. I think that the most productive course of action here would be asking VASP maintainers to list all the possible keys in their TAGDEF template (the template defining GGA = PE | ... line) for this page and maybe for other pages with the same problem. |
It sounds like the best option to me, not sure what is the best approach to reach out though, perhaps through the VASP forum? |
Yup, the forum. I see no better options on https://www.vasp.at/wiki/index.php/The_VASP_Manual#Support |
* src/pymatgen/io/vasp/help.py (VaspDoc.get_incar_tags): Use Mediawiki API instead of parsing the HTML source directly. The old approach is not stable against changes in the tag list because of the way URLs are constructed. pagefrom= parameters start from certain tag, which is not guaranteed to provide the complete tag list as the new tags are added before that tag given in pagefrom=. At the moment of writing this commit, PRECFOCK tag is already missed using the old approach. Following up: #4119 (comment)
Python version
Python 3.12.4
Pymatgen version
2024.7.18
Operating system version
No response
Current behavior
When I set INCAR parametrs via
vasp_input['INCAR']['PARAM']=value
, they do not always passIncar.check_params()
checks.Using the example below, I am getting:
Expected Behavior
Setting the parameters passes the checks.
Minimal example
Relevant files to reproduce this bug
I used the following INCAR
Other requried inputs may be anything.
The text was updated successfully, but these errors were encountered: