# Fixing space group perception for CIF files

**URL:** <https://discuss.avogadro.cc/t/fixing-space-group-perception-for-cif-files/7544>\
**Category:** General Discussion\
**Created:** [October 7, 2026, 5:20pm UTC](https://discuss.avogadro.cc/t/fixing-space-group-perception-for-cif-files/7544 "2026-10-07T17:20:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [October 7, 2026, 5:20pm UTC](https://discuss.avogadro.cc/t/fixing-space-group-perception-for-cif-files/7544/1 "2026-10-07T17:20:06Z")

</div>

For the next release (2.2), I’m inclined to use the [gemmi](https://gemmi.readthedocs.io/en/latest/) library to read CIF files and handle unit cell manipulations. It also handles mmCIF / PDBx files as well as grid data (e.g. electron density maps)

> Gemmi is a joint project of [Global Phasing Ltd](https://www.globalphasing.com/) and [CCP4](http://www.ccp4.ac.uk/).

In the meantime, I’ve been pushing a new branch that should handle a bunch of cases in which Avogadro wouldn’t know the full space group setting and ask the user to pick. Through some automated testing, this was happening ~300 / 500 example files in the `crystals` directory. ☹

This happens for a few reasons - inconsistent space group naming (e.g., evolving rules) and the space groups don’t necessarily specify the _setting_ for a particular file.

The new branch uses the symmetry transforms in the CIF file to deduce the space group and setting. It looks good, but I could use some feedback and testing from folks like @Thomas because I’d like to finish it and merge for v2.1.

> <https://github.com/OpenChemistry/avogadrolibs/pull/3126>
>
> Developer Certificate of Origin
> Version 1.1
> 
> Copyright (C) 2004, 2006 The Lin…ux Foundation and its contributors.
> 1 Letterman Drive
> Suite D4700
> San Francisco, CA, 94129
> 
> Everyone is permitted to copy and distribute verbatim copies of this
> license document, but changing it is not allowed.
> 
> 
> Developer's Certificate of Origin 1.1
> 
> By making a contribution to this project, I certify that:
> 
> (a) The contribution was created in whole or in part by me and I
> have the right to submit it under the open source license
> indicated in the file; or
> 
> (b) The contribution is based upon previous work that, to the best
> of my knowledge, is covered under an appropriate open source
> license and I have the right under that license to submit that
> work with modifications, whether created in whole or in part
> by me, under the same open source license (unless I am
> permitted to submit under a different license), as indicated
> in the file; or
> 
> (c) The contribution was provided directly to me by some other
> person who certified (a), (b) or (c) and I have not modified
> it.
> 
> (d) I understand and agree that this project and the contribution
> are public and that a record of the contribution (including all
> personal information I submit with it, including my sign-off) is
> maintained indefinitely and may be redistributed consistent with
> this project or the open source license(s) involved.
> 
> 
> 
> \## Summary by CodeRabbit
> 
> \* \*\*New Features\*\*
> \* Space-group identifiers can be resolved from common symbol variants, Hall symbols, international numbers, and symmetry operations.
> \* CIF files now provide symmetry information for identifying a molecule’s space group. CJSON and CML imports also recognize more space-group identifiers.
> \* Unit-cell filling supports explicit space-group selections and international-number filtering, with clearer handling of ambiguous or unavailable settings.
> 
> \* \*\*Bug Fixes\*\*
> \* Invalid coordinate transforms now return zero-valued results instead of triggering assertion failures.
> \* International space-group numbers are kept separate from general molecule properties when displaying or exporting data.

---

<div class="post-metadata">

**Author:** ![Thomas](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/thomas/32/3403_2.png) [@Thomas](https://discuss.avogadro.cc/u/Thomas)\
**Post date:** [October 12, 2026, 8:31pm UTC](https://discuss.avogadro.cc/t/fixing-space-group-perception-for-cif-files/7544/2 "2026-10-12T20:31:36Z")

</div>

To amend automatic checks against the set of [crystals](https://github.com/OpenChemistry/crystals) on GitHub, I’ll add a couple of .cif about small (organic) molecule structure models (monoclinic P 2\_1/c (and special setting P2\_1/a), orthorhombic P2\_12\_12\_1, some R3 and R\bar{3}, etc) preferentially without complications by disorder, nor twinning. In line with the established pattern, they will copy files of the COD.

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [October 12, 2026, 9:33pm UTC](https://discuss.avogadro.cc/t/fixing-space-group-perception-for-cif-files/7544/3 "2026-10-12T21:33:20Z")

</div>

That would be great. If you want, you can send me the files or post here as a ZIP.

At the moment for v2.1, I’m simply aiming for “better than 2.0” - for v2.2, as I think I mentioned to you, I’m intending to adapt the [gemmi](https://gemmi.readthedocs.io/en/latest/index.html) library, which should significantly improve our support for CIF / mmCIF.

---

<div class="post-metadata">

**Author:** ![Thomas](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/thomas/32/3403_2.png) [@Thomas](https://discuss.avogadro.cc/u/Thomas)\
**Post date:** [October 13, 2026, 9:25pm UTC](https://discuss.avogadro.cc/t/fixing-space-group-perception-for-cif-files/7544/4 "2026-10-13T21:25:13Z")

</div>

@ghutchis The tar.gz archive attached below includes a small set of organic small molecule crystallographic models as .cif; an ylid + 36 other examples. With the 10 most frequently seen space groups in CCDC’s CSD, about 9 of 10 admissions to CSD are covered. (The repartition of space groups in the ICSD with focus on inorganics is a different one.)

[2026-10-13\_organic\_crystals.tar.gz](https://discuss.avogadro.cc/uploads/short-url/wwXwzgKjjBiR2fb6olfQ8rZeeKP.gz) (5.4 MB)
