Skip to main content

cifkit

PyPI Forge PythonVersion PR

CI Codecov Tracking

Logo light mode Logo dark mode

cifkit is designed to provide a set of fully-tested utility functions and variables for handling large datasets, on the order of tens of thousands, of .cif files.

Features:

cifkit provides higher-level functions in just a few lines of code.

  • Coordination geometry - cifkit provides functions for visualing coordination geometry from each site and extracts physics-based features like volume and packing efficiency in each polyhedron.

  • Atomic mixing - cifkit extracts atomic mixing information at the bond pair level—tasks that would otherwise require extensive manual effort using GUI-based tools like VESTA, Diamond, and CrystalMaker.

  • Filter - cifkit offers features for preprocessing. It systematically addresses common issues in CIF files from databases, such as incorrect loop values and missing fractional coordinates, by standardizing and filtering out ill-formatted files. It also preprocesses atomic site labels, transforming labels such as ‘M1’ to ‘Fe1’ in files with atomic mixing.

  • Sort - cifkit allows you to copy, move, and sort .cif files based on attributes such as coordination numbers, space groups, unit cells, shortest distances, elements, and more.

Example usage 1 - coordination geometry

The example below uses cifkit to visualize the polyhedron generated from each atomic site based on the coordination number geometry.

from cifkit import Cif

cif = Cif("your_cif_file_path")
site_labels = cif.site_labels

# Loop through each site label
for label in site_labels:
    # Dipslay each polyhedron, .png saved for each label
    cif.plot_polyhedron(label, is_displayed=True)
Polyhedron generation

Polyhedron generation

Example Usage 2 - sort

The following example generates a distribution of structure.

from cifkit import CifEnsemble

ensemble = CifEnsemble("your_folder_path_containing_cif_files")
ensemble.generate_structure_histogram()
structure distribution

structure distribution

Basde on your visual histogram above, you can copy and move .cif files based on specific attributes:

# Return file paths matching structures either Co1.75Ge or CoIn2
ensemble.filter_by_structures(["Co1.75Ge", "CoIn2"])

# Return file path matching CeAl2Ga2
ensemble.filter_by_structures("CeAl2Ga2")

To learn more, please read the official documentation here: https://bobleesj.github.io/cifkit.

Quotes

Here is a quote illustrating how cifkit addresses one of the challenges mentioned above.

“I am building an X-Ray diffraction analysis (XRD) pattern visualization script for my lab using pymatgen. I feel like cifkit integrated really well into my existing stable of libraries, while surpassing some alternatives in preprocessing and parsing. For example, it was often unclear at what stage an error occurred—whether during pre-processing with CifParser, or XRD plot generation with diffraction.core in pymatgen. The pre-processing logic in cifkit was communicated clearly, both in documentation and in actual outputs, allowing me to catch errors in my data before it was used in my visualizations. I now use cifkit by default for processing CIFs before they pass through the rest of my pipeline.” - Alex Vtorov `

Documentation

Citation

If you use cifkit in your publication, please cite the following:

@article{Lee2024,
  author    = {Sangjoon Lee and Anton O. Oliynyk},
  title     = {cifkit: A Python package for coordination geometry and atomic site analysis},
  journal   = {Journal of Open Source Software},
  year      = {2024},
  volume    = {9},
  number    = {103},
  pages     = {7205},
  publisher = {The Open Journal},
  doi       = {10.21105/joss.07205},
  url       = {https://doi.org/10.21105/joss.07205}
}

How to contribute

Here is how you can contribute to the cifkit project if you found it helpful:

  • Star the repository on GitHub and recommend it to your colleagues who might find cifkit helpful as well.

  • Create a new issue for any bugs or feature requests here

  • Fork the repository and consider contributing changes via a pull request.

  • If you have any suggestions or need further clarification on how to use cifkit, please reach out to Bob Lee (@bobleesj).

Acknowledgements

cifkit is maintained and developed with the help of scikit-package (https://scikit-package.github.io/scikit-package/).

Metadata

Release files for cifkit 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cifkit 1.2.2
File Size Uploaded
cifkit-1.2.2.tar.gz 262.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cifkit 1.2.2
File Interpreter ABI Platform
cifkit-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 479.4 kB

Release files / cifkit-1.2.2.tar.gz

Download URL cifkit-1.2.2.tar.gz
Size 262.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4e2d37963fd69ac96a010b80080f95f2331bea8df16357d5b1fafc2ec5af53b1
BLAKE2b-256 checksum
How to use checksums
4889951588854b314ba9dd17553258434c572b7b2a107dfa7783e0d8d1ea89d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / cifkit-1.2.2-py3-none-any.whl

Download URL cifkit-1.2.2-py3-none-any.whl
Size 217.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
721f92c20fc45dae7d9707519a173a556ee96412c48ee25421473a151dbd4149
BLAKE2b-256 checksum
How to use checksums
012c62135e94ed18bdfbde12f45ee469b9a93e53bd2d66650c1610d976d535f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page