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.
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.
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)
The following example generates a distribution of structure.
from cifkit import CifEnsemble
ensemble = CifEnsemble("your_folder_path_containing_cif_files")
ensemble.generate_structure_histogram()
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.
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 likecifkit
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 withCifParser
, or XRD plot generation withdiffraction.core
inpymatgen
. The pre-processing logic incifkit
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 usecifkit
by default for processing CIFs before they pass through the rest of my pipeline." - Alex Vtorov `
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. . Check out CONTRIBUTING.md for instructions.
- If you have any suggestions or need further clarification on how to use
cifkit
, please reach out to Bob Lee (@bobleesj).
pip install -r requirements/docs.txt
mkdocs serve