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 monty imports, enhance test for Outcar parser to cover uncompressed format #4068

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Sep 15, 2024

Summary

  • Test monty fix for reverse readline, to close Outcar class returns empty magnetization attribute when parsing OUTCAR file on Windows operating system #4033
  • Replace reverse_readline with faster reverse_readfile
  • Fix incorrect monty imports
  • Enhance unit test for reported Outcar parser (need to test unzipped format):
    def test_init(self):
    outcar = Outcar(f"{VASP_OUT_DIR}/OUTCAR.gz")
    expected_mag = (
    {"d": 0.0, "p": 0.003, "s": 0.002, "tot": 0.005},
    {"d": 0.798, "p": 0.008, "s": 0.007, "tot": 0.813},
    {"d": 0.798, "p": 0.008, "s": 0.007, "tot": 0.813},
    {"d": 0.0, "p": -0.117, "s": 0.005, "tot": -0.112},
    {"d": 0.0, "p": -0.165, "s": 0.004, "tot": -0.162},
    {"d": 0.0, "p": -0.117, "s": 0.005, "tot": -0.112},
    {"d": 0.0, "p": -0.165, "s": 0.004, "tot": -0.162},
    )
    expected_chg = (
    {"p": 0.154, "s": 0.078, "d": 0.0, "tot": 0.232},
    {"p": 0.707, "s": 0.463, "d": 8.316, "tot": 9.486},
    {"p": 0.707, "s": 0.463, "d": 8.316, "tot": 9.486},
    {"p": 3.388, "s": 1.576, "d": 0.0, "tot": 4.964},
    {"p": 3.365, "s": 1.582, "d": 0.0, "tot": 4.947},
    {"p": 3.388, "s": 1.576, "d": 0.0, "tot": 4.964},
    {"p": 3.365, "s": 1.582, "d": 0.0, "tot": 4.947},
    )
    assert outcar.magnetization == approx(expected_mag, abs=1e-5), "Wrong magnetization read from Outcar"

@DanielYang59 DanielYang59 force-pushed the test-monty-reverse-read branch from c234535 to 7d2ed7b Compare September 15, 2024 05:35
@DanielYang59 DanielYang59 changed the title Test monty fix for reverse readline Test monty fix for reverse_readline Oct 10, 2024
@DanielYang59 DanielYang59 changed the title Test monty fix for reverse_readline Fix monty imports, enhance test for Outcar parser to cover uncompressed format Dec 11, 2024
@DanielYang59 DanielYang59 marked this pull request as ready for review December 11, 2024 15:15
@DanielYang59 DanielYang59 marked this pull request as draft December 12, 2024 02:10
@DanielYang59 DanielYang59 force-pushed the test-monty-reverse-read branch from 6b44797 to d41a039 Compare December 20, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Outcar class returns empty magnetization attribute when parsing OUTCAR file on Windows operating system
2 participants