-
Couldn't load subscription status.
- Fork 923
Enhance INCAR parsing: handle multi-line string and line continuation with backslash, fix handling of ! as comment marker
#4518
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
base: master
Are you sure you want to change the base?
Conversation
! as comment marker
f511b50 to
8a8eeff
Compare
| def test_from_str_multiline_string(self): | ||
| incar_str = r""" | ||
| # Multi-line string with embedded comments | ||
| WANNIER90_WIN = "begin Projections # should NOT be 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.
An edge case, currently comments in multi-line string would be removed, I guess this agrees with the behaviour described by vaspwiki:
For comments, VASP ignores any text after a hashtag # or exclamation mark !. Use this to add comments anywhere to the INCAR file.
05ffd06 to
2d33219
Compare
|
@esoteric-ephemera can you please review this maybe? I understand using RE would hurt readability but I didn't find a better way other than using a quite complex state machine, also added unit test to cover as much edge cases as I could think of. |
4f47a28 to
537b47f
Compare
|
@DanielYang59 sure will try to find some time to! |
bc0885b to
20d30ca
Compare
|
I wish VASP would switch to YAML for INCARs.... I think use of regex is fine. We use it all over Vasp.outputs. |
…ling test enhance incar parsing of backslash and multi-line str, fix ! comment handle fix most issues: multi-line str still doesn't work almost there, one statement in comment should not be parsed guess it's fine to strip multi-line string I guess ;! is not a valid use case, ; is meant to connect to statements oops, looks like comment would be parsed fix test first working version
3c4e178 to
55a982d
Compare
Enhancements:
Fixes
!as comment marker for string tags likePREC = Accurate ! hello: