Support CIF files from ICSD with atom type symbols like Au0+#245
Merged
CSSFrancis merged 6 commits intopyxem:mainfrom Oct 24, 2025
Merged
Support CIF files from ICSD with atom type symbols like Au0+#245CSSFrancis merged 6 commits intopyxem:mainfrom
Au0+#245CSSFrancis merged 6 commits intopyxem:mainfrom
Conversation
A recent CIF file pulled from https://icsd.fiz-karlsruhe.de/ for collection code 163723 contained the atom type symbol "Au0+" instead of just Au. This lead to empty diffraction patterns. With this change only the first alphabetical part of the atom type symbol is used as an element, and a warning is emitted if unknown elements are encountered. See https://www.iucr.org/__data/iucr/cifdic_html/1/cif_core.dic/Iatom_type_symbol.html for the definition of the atom type symbol. It can be debated if unrecognized atom type symbols should actually be a hard error since the current code will quietly zero the contribution of sites with unknown atom types, which may lead to plausible but wrong diffraction patterns if recognized and unrecognized atom type symbols are mixed in a CIF file.
Au0+
Contributor
Author
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
Contributor
Author
|
The docs failure seems to be an issue with Sphinx or an extension? |
Member
|
Good fix, @uellue! The doc fail is related to pyxem/orix#570, I think. @CSSFrancis, how about a patch release v0.7.1 with this fix? Nothing on main since v0.7.0. |
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Member
|
@hakonanes Sounds good to me :) |
This should be about right?
Specify more clearly what kind of strings are accepted, update to new feature of supporting more valid atom type symbols found in CIF files in the wild.
Contributor
Author
|
About |
Contributor
Author
|
Is there anything that I can still do here? @hakonanes @CSSFrancis |
Member
|
@uellue let me try to find some time to look at this today! |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A recent CIF file pulled from https://icsd.fiz-karlsruhe.de/ for collection code 163723 contained the atom type symbol "Au0+" instead of just Au. This lead to empty diffraction patterns.
With this change only the first alphabetical
part of the atom type symbol is used as an element, and a warning is emitted if unknown elements are encountered.
See https://www.iucr.org/__data/iucr/cifdic_html/1/cif_core.dic/Iatom_type_symbol.html for the definition of the atom type symbol.
It can be debated if unrecognized atom type symbols should actually be a hard error since the current
code will quietly zero the contribution of sites with unknown atom types, which may lead to plausible but wrong diffraction patterns if recognized and unrecognized atom type symbols are mixed in a CIF file.
Description of the change
Progress of the PR
Minimal example of the bug fix or new feature
EntryWithCollCode163723.cif.txt
For reviewers
__init__.py.unreleased section in
CHANGELOG.rst.creditsindiffsims/release_info.pyandin
.zenodo.json.