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

Clearer handling of magmom flag #2312

Merged
merged 2 commits into from
Dec 20, 2021
Merged

Clearer handling of magmom flag #2312

merged 2 commits into from
Dec 20, 2021

Conversation

Andrew-S-Rosen
Copy link
Member

@Andrew-S-Rosen Andrew-S-Rosen commented Nov 28, 2021

Summary

Clearer Handling of Magnetic Moments

I have made a few additional clarifications to pymatgen.io.vasp.sets, primarily with regards to the handling of magnetic moments as a follow-up to #2301:

  1. Clearer docstrings. This is rather self-explanatory.
  2. Only print the warning about low magnetic moments on Co if the value is <= 1. If someone were to modify the default config to have high-spin Co, there is no longer a need for this warning. I had done this, and I found it somewhat bothersome.
  3. If the user provides an integer for the magnetic moment, e.g. site["magmom"] = 1, then convert this to a float when get_valid_magmom_struct() is run. Previously, Pymatgen would crash when creating an Incar() object if the structure had an integer magnetic moment due to the lines below.
    elif isinstance(isite.properties["magmom"], float):
    if mode == "v":
    raise TypeError("Magmom type conflict")
    mode = "s"
    elif len(isite.properties["magmom"]) == 3:

Slight Adjustment to Handling of LASPH Warning

  1. Extremely minor, but as a follow-up to Add warning if LASPH != True for meta-GGA/hybrid/vdW/+U #2297, I now check the Incar() object (rather than the settings variable) to see if LASPH is present. This is more robust.

@coveralls
Copy link

coveralls commented Nov 28, 2021

Coverage Status

Coverage decreased (-0.6%) to 83.13% when pulling e6ba47b on arosen93:rosen-clarifications into dd37370 on materialsproject:master.

Clarify docstring of MAGMOM flag, only print warning for Co if magmom <= 1, allow for integer magmom properties; also, check Incar() for LASPH not settings.
Be cautious of trailing digits with float arithmetic rather than assuming exact equality
@Andrew-S-Rosen
Copy link
Member Author

This one is good to go. It's just that broken Mac Windows test holding it up.

@mkhorton
Copy link
Member

Thanks @arosen93 !

@mkhorton mkhorton merged commit 2aeb984 into materialsproject:master Dec 20, 2021
@Andrew-S-Rosen Andrew-S-Rosen deleted the rosen-clarifications branch December 20, 2021 19:57
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.

None yet

4 participants