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
Atom labels in CIF file are silently rewritten by CifWriter #3772
Comments
This is because But I am not writing magnetic moments, and I do not know why that should override labels. |
@fxcoudert thanks for reporting. I assume a pull-request to fix this issue would be very welcome. |
I confirm that removing the magnetic moments with Regarding a PR, my own understanding of what the code tries to do for magnetic moments is insufficient to handle it well. I wouldn't want to break another use case… |
I see! I also don't know that functionality. Should I leave it open to see if someone else can fix it? |
@mkhorton , maybe you now more about this. |
This also struck me as odd. I'm currently working on #3767 which touches this bit of the code and happy to fix this if someone tells me the expected behaviour for magnetic moments. |
Python version
Python 3.11.6
Pymatgen version
2024.4.13
Operating system version
macOS 14.4.1
Current behavior
This is related to #3761 but different. I have upgraded my pymatgen from 2023.10.4 and 2024.4.13 and I have workflows that fail as a result of the update. This is because
CifWriter
now silently replaces atom labels, even when they were unique! This seems very unnatural (and makes my current code fail, because I am writing bond specifications for the labels in the structure, and they don't match in the CIF file).structure.labels
is originally['Lu', 'Lu', 'Al', 'Al', 'Al', 'Al']
make_labels_unique
call (my function, code below), they are['Lu0', 'Lu1', 'Al0', 'Al1', 'Al2', 'Al3']
Al atoms have been renamed from
Al0..Al3
toAl2..Al5
Expected Behavior
When labels are conformant to the CIF format (which they are in this case) they should not be altered.
Minimal example
See code above. The function
make_labels_unique
is:The text was updated successfully, but these errors were encountered: