Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

CIF file support for Python

Project Description

PyCIFRW Readme


PyCIFRW provides support for reading and writing CIF (Crystallographic Information Format) files using Python. 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 now (Mar 2017) maintained and developed within the Australian Nuclear Science and Technology Organisation (ANSTO).


The specifications found in Vol G of the International Tables for Crystallography were used as a reference for CIF 1.0/1.1 syntax. was used as the CIF 2.0 reference.

PyCifRW has been tested on the IUCr sample CIF1.1 trip files located at and fails or successfully reads as it is supposed to (note that ciftest5 contains characters now forbidden in CIFs).

Supported Platforms

PyCIFRW is written entirely in Python, and so should run wherever Python runs. Any failures on Mac, Windows or Linux should be communicated to the author, either through the BitBucket issues tracker or email.

The source code of a C extension module is also included in the distribution. This module accelerates CIF file reading. From time to time system-dependent installation packages are generated containing precompiled versions of this module.


PyCIFRW is made available using the Python 2.0 license. The full text is [here](


See the various files in the docs directory for details of the interface. Essentially, CIF files look like python dictionaries, with each entry in the dictionary corresponding to a data block. The blocks themselves are also dictionaries, with each data name being a single entry in the dictionary, so for example, cf['si_std']['_diffrn_meas_wavelength'] will return the value of _diffrn_meas_wavelength in the data block named si_std of the Cif file object cf.


To read in a CIF:

from CifFile import ReadCif cf = ReadCif(‘jun_01_2.cif’)

to access information in a CIF

wav = cf[‘si_std’][‘_diffrn_meas_wavelength’]

to set a value

cf[‘si_std’][‘_diffrn_meas_wavelength’] = 1.54

Example programs

The file ‘’ in the source distribution contains around 170 tests of PyCIFRW functionality and is a good source of examples for using both simple and advanced PyCIFRW interfaces.

The “Programs” directory in the source distribution contains simple example programs. Of interest are which validates a data files against data dictionaries (execute this file at a terminal prompt without arguments for a help message) and which will convert a DDLm dictionary into an asciidoc document that can then be converted to HTML or other presentation formats.

Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
PyCifRW-4.3-py2.7-linux-x86_64.egg (309.3 kB) Copy SHA256 Checksum SHA256 2.7 Egg Feb 28, 2017
PyCifRW-4.3-py3.5-linux-x86_64.egg (316.5 kB) Copy SHA256 Checksum SHA256 3.5 Egg Feb 28, 2017
PyCifRW-4.3.tar.gz (810.4 kB) Copy SHA256 Checksum SHA256 Source Feb 28, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting