Crystallographic Information Framework


About PyCifRW

PyCIFRW provides support for reading and writing CIF (Crystallographic Information Format) files using Python, including validity testing against DDL dictionaries. It was developed at the Australian National Beamline Facility (ANBF), run by the Australian Synchrotron Research Program (ASRP), as part of a larger project to provide CIF input/output capabilities for data collection. It is currently (April 2009) under active development and testing.

You can exercise the validity testing aspect of PyCIFRW online.

Acknowledgements and Credit

In order to implement the CIF grammar specification, PyCifRW uses the Yapps2 parser generator developed by Amit Patel and generously released to the wider community. The remainder of PyCifRW was written by James Hester.


The package is available as a .tar.gz file, which can be downloaded from here. File "INSTALLATION" contains installation instructions.


The IUCr version 1.1 working specification was used as a reference.

PyCifRW has been tested on the IUCr sample CIF trap files, and fails or successfully reads as it is supposed to for all 11 tests, except for test 5, which contains the no longer acceptable vertical tab and form feed characters. CIF output conforms to the standard, including line length restrictions.

Supported Platforms

PyCIFRW is written entirely in Python. While this makes parsing of large CIF files rather slow, it will run wherever Python runs. It has been tested on Unix (Linux, Solaris) and Windows XP under Python2.3.


If you have found PyCifRW useful and wish to include a citation in your paper, the canonical reference is:

J. R. Hester (2006) "A validating CIF parser: PyCIFRW", J. Appl. Cryst. 39, 621-625


PyCiFRW consists of the following files: Defines the CifFile module for Python
CifFile.nw Noweb file from which is obtained
CifFile.html Programming notes for CifFile derived also from CifFile.nw Cif/Star parser generated by Yapps2
YappsStarParser.html Programming notes for the grammar input to Yapps2
YappsCifParse.nw Noweb file
Makefile How to derive .html and .py files from .nw files Runtime support for Yapps parser (modified version of file in Yapps2 distribution) (linux only) Compiled extension for rapid Starfile reading