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 LNONCOLLINEAR match in Outcar parser #4034

Merged
merged 8 commits into from
Sep 4, 2024

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Sep 3, 2024

Summary

For a future PR

  • [Reverted] Turn on terminate_on_match to early exit upon match, I wish I didn't misunderstand the usage, but early exit should speed up the search?

@DanielYang59
Copy link
Contributor Author

Thanks @KylinGuo for reporting this and providing the test OUTCAR. Can I have your permission to include your OUTCAR as a test file for pymatgen?

@KylinGuo
Copy link

KylinGuo commented Sep 3, 2024

Thanks @KylinGuo for reporting this and providing the test OUTCAR. Can I have your permission to include your OUTCAR as a test file for pymatgen?

It's my pleasure! Yes, please.

@DanielYang59
Copy link
Contributor Author

Thanks a lot. All credit goes to you :)

@DanielYang59 DanielYang59 marked this pull request as ready for review September 3, 2024 12:45
Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot for the fix @DanielYang59! 👍 almost ready to go

tests/files/io/vasp/outputs/OUTCAR.noncollinear.gz Outdated Show resolved Hide resolved
@janosh janosh added io Input/output functionality fix Bug fix PRs vasp Vienna Ab initio Simulation Package labels Sep 3, 2024
@DanielYang59 DanielYang59 requested a review from janosh September 4, 2024 03:09
Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm happy to merge despite the unclear implications of terminate_on_match=True given tests pass

self.read_pattern({"noncollinear": "LNONCOLLINEAR = T"})
if self.data.get("noncollinear", []):
self.noncollinear = False
self.read_pattern({"noncollinear": r"LNONCOLLINEAR\s*=\s*T"}, terminate_on_match=True)
Copy link
Member

@janosh janosh Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these lines suggest that the matches dict can contain less keys if terminate_on_match=True and so you might get a different self.data after self.data.update(matches). but given all tests pass, this may not happen in practice

matches = regrep(
self.filename,
patterns,
reverse=reverse,
terminate_on_match=terminate_on_match,
postprocess=postprocess,
)
self.data.update(matches)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any concerns @mkhorton?

Copy link
Contributor Author

@DanielYang59 DanielYang59 Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be safer for me to revert those changes in terminate_on_match until I'm 100% percent it wouldn't cause any breakage.

Currently there must have been some part of Outcar not covered by unit test, because the reverse reading in #4033 seems completely broken in Windows, but tests are still passing.

I would keep this into my TODO list, and have a closer look later.

@DanielYang59 DanielYang59 changed the title Fix LNONCOLLINEAR match condition in Outcar parser Fix LNONCOLLINEAR match in Outcar parser Sep 4, 2024
@janosh janosh merged commit 1404220 into materialsproject:master Sep 4, 2024
43 checks passed
@janosh
Copy link
Member

janosh commented Sep 4, 2024

thanks for the lightning-fast fix @DanielYang59! 👍

@DanielYang59 DanielYang59 deleted the fix-outcar-parse branch September 5, 2024 01:16
@DanielYang59
Copy link
Contributor Author

No problem. Thanks for questioning the usage of terminate_on_match, might look closer later :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix PRs io Input/output functionality vasp Vienna Ab initio Simulation Package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

noncollinear attribute of Outcar class has wrong value for VASP calculations with LNONCOLLINEAR=.TRUE.
3 participants