Closed JonathanSchmidt1 closed 7 months ago
Thanks for the report, @JonathanSchmidt1. You are absolutely right that this is a bug that should be fixed. Are you interested in submitting a PR for this patch?
CCing @tomdemeyere to let him know about the bug in case it is relevant to his work.
@JonathanSchmidt1 yes, please go ahead and submit a bug fix if you like to. As previously mentioned, we have never used pymatgen or atomate2 for phonon runs of magnetic materials.
Python version
3.9.13
Pymatgen version
2024.2.23
Operating system version
No response
Current behavior
Recently the get_pmg_structure and the get_phonopy_structure methods in pymatgen/io/phonopy.py were updated to include magnetic moments. ( https://github.com/materialsproject/pymatgen/pull/3555 ) the get_pmg_structure method should have the magnetic moment under the magmom key instead it is magnetic moments. I also overlooked this in the pull request ...
This leads to problems e.g. when automatically creating incars in atomate2 etc. (working on adding magmoms to the phonon workflow @JaGeo )
Expected Behavior
It should be under magmom:
than it also corresponds to the other method that converts from pymatgen to phonopy:
The unit test would also need to be changed to confirm that the site_properties are the same. Right now it only tests the following for magmom:
assert list(struct_ph.magnetic_moments) == magmoms
maybe it would be possible to add: assert struct_pmg_round_trip.site_properties['magmom']==struct_pmg.site_properties['magmom']
Minimal example
Relevant files to reproduce this bug
No response