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

Bug fix: change CifWriter to save only the element symbol, and not the entire species string #3071

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kamronald
Copy link

Change the "atom site type symbol", such that the element symbol is saved instead of the full species string (which includes site properties). This fixes Issue #3065, allowing for accurate writing of structures containing species properties to CIF and MCIF files.

Summary

Major updates:

Change the "atom site type symbol", such that the element symbol is saved instead of the full species string (which includes site properties).

Todos

Checklist

Ensure:

  • Google format doc strings added. Check with ruff.
  • Type annotations included. Check with mypy.
  • Tests added for new features/fixes.
  • All tests and linting pass.

Change the atom site type symbol, such that the element symbol is saved instead of the full species string (which includes site properties)
@mkhorton
Copy link
Member

@kamronald does this still handle species with oxidation state correctly?

@kamronald
Copy link
Author

@mkhorton good point, I just checked and it does not handle them properly, I'll fix that

atom_site_type_symbol now saves the element and oxidation state, without the other site properties
@kamronald
Copy link
Author

@mkhorton oxidation states are now properly saved

@janosh
Copy link
Member

janosh commented Jun 16, 2023

Thanks @kamronald! 👍

IIUC @mkhorton in #3065 (comment), he's suggesting we continue saving scalar magmoms to regular CIF using the local data name mp registered here https://www.iucr.org/cgi-bin/cifreserve.pl.

Also, would be great if you could refactor your repro #3065 (comment) into a new test case.

@janosh janosh added needs testing PRs that are not ready to merge due to lacking tests io Input/output functionality fix Bug fix PRs labels Jun 16, 2023
@kamronald
Copy link
Author

@janosh @mkhorton Yes will work on that

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.57% ⚠️

Comparison is base (a1c19db) 74.65% compared to head (324a675) 74.09%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3071      +/-   ##
==========================================
- Coverage   74.65%   74.09%   -0.57%     
==========================================
  Files         230      230              
  Lines       69377    69382       +5     
  Branches    16154    16154              
==========================================
- Hits        51796    51410     -386     
- Misses      14513    14937     +424     
+ Partials     3068     3035      -33     
Files Changed Coverage Δ
pymatgen/io/cif.py 92.21% <100.00%> (+0.04%) ⬆️

... and 6 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 needs testing PRs that are not ready to merge due to lacking tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants