A new C language library for reading, writing and manipulating MTZ files

Martyn Winn August 2001

CMTZ is now part of the CCP4 library in CCP4 release 5.0

There is also some general documenation.


CMTZ was originally based on Jan-Pieter Abrahams' functions in Solomon. These have been substantially altered and added to, and so all problems are my creations.

The formulation of this library has benefited from many discussions with Kevin Cowtan (who also provided some core functions) and Airlie McCoy.

Core C library

The core C library includes the files:

mtzdata.h        defines basic MTZ data structure
mtzlib.c         C library for MTZ i/o and manipulating MTZ data structure
library.c        library.c for C programs (made robust by Charles Ballard)
symlib.c         C versions of symfr3 and symtr3
cparser.c        C version of parser (from Pete Briggs)
ccplib.c         C versions of ccperr, ccpfyp, ccprcs (mainly from Pete Briggs)
ccp4program.c    some helper functions (mainly from Pete Briggs)

Type make libccp4c.a to get this library.

Fortran API

I have also written a Fortran API "mtzlib_f.c", which is basically a wrapper for the functions in mtzlib.c, which mimics the existing mtzlib.f. It should be possible to migrate existing Fortran programs to use this API with few/no changes. It is expected however, that future applications will use the core C functions which give better access to the data structure.

The Fortran API is included in the core library libccp4c.a. Some CCP4 programs are included as examples, e.g. type "make ecalc_new".

Other languages

I have used SWIG to generate interfaces to Python, perl and Tcl. These interfaces exist as wrapper functions, which can be used to generate shared libraries:

cmtzlib_python_wrap.c     type "make"
cmtzlib_perl_wrap.c       type "make"
cmtzlib_tcl_wrap.c        type "make"

These shared libraries are used as in the distributed examples, and cexample1.tcl
Last modified: Tue Aug 21 12:16:23 BST 2001