CIF applications
CIFEDIT, a program for viewing and editing CIFs
applications. XIII.aNIST Center for Neutron Research, National Institute of Standards and Technology, Gaithersburg, Maryland 20899-8562, USA
*Correspondence e-mail: brian.toby@nist.gov
The CIFEDIT program displays the contents of single- or multi-block crystallographic information files (CIF). The program can also be used to edit the data values for items, including adding or deleting sets of entries in a loop. dictionaries are used to display definitions for data names and units. In the case of 1.4 dictionaries, validation information is used to check numerical values. The program is written using the cross-platform scripting language Tcl/Tk and thus is largely platform-independent. It has been tested under Windows, Mac OS X and Unix.
Keywords: CIF applications; computer programs; CIFEDIT.
1. Introduction
The et al., 1991). This article describes an application, CIFEDIT, that can be used for viewing the contents of a as well as editing it. Information about many topics related to including other software tools, can be found on the IUCr website https://www.iucr.org/iucr-top/cif. Subsequent to the release of CIFEDIT, the Cambridge Crystallographic Data Centre have released a program with similar capabilities, enCIFer (Smith & Johnson, 2002).
(CIF) is used to communicate results of studies, as well as associated data and other related information (HallThe CIFEDIT program has been written using the Tcl/Tk scripting language, a programming practice that encourages portability (Ousterhout, 1994). It has been tested using Windows and multiple Unix implementations. Limited testing has also been performed on a Macintosh under OS X. It is anticipated that CIFEDIT will function under all operating systems where Tcl/Tk is available. The program highlights the programming features of Tcl/Tk in that only ∼2600 lines of code were written to implement this program. The code was designed from the beginning to be embedded into larger programs, to add reading and editing capabilities. This code has been utilized in the programs EXPGUI, pdCIFplot and FillCIF (Toby, 2001; Toby et al., 2003; Toby, 2003). Other software authors are also encouraged to use this code.
2. Capabilities
The program CIFEDIT reads a into memory and then parses it. The data names and loops within the are then displayed in a hierarchical browser, as seen on the left-hand side of Fig. 1. Selecting a data name causes the associated value to be displayed. The program offers two modes: values can be viewed in `browse mode' and changed in `edit mode'. The program offers two methods for working with information in loops. If the loop entry is selected, then one set of values for all data names in the loop is displayed, as shown in Fig. 2. Alternatively, if a single data name within a loop is selected, then all values (up to 100) for that data name are shown. This limit can easily be increased or decreased by changing the variable CIF(maxRows). However, display of very large loops can overtax the computer operating system.
The program utilizes information from
dictionaries to display units or enumerated values for a data item. When a data item has a list of enumerated values, those values, along with the special values of `?' and `.', are the only options offered to the user. For version 1.4 dictionaries, numerical values are checked when entered against the allowed range specified for the data item.As shown in Fig. 3, definitions from dictionaries are displayed in a separate window. Dictionaries are accessed via an index file, which provides a list of defined data names, locations for the definitions and validation information. CIFEDIT is distributed with the copies of six dictionaries and an index file that references these dictionaries. If a user wishes to update a dictionary or select dictionaries to be accessed by the program, the index file must be rebuilt. This is accomplished by executing a separate Tcl/Tk script, indexCIFdict.tcl, which is also supplied with CIFEDIT. The index file is read from the subdirectory where the CIFEDIT script is found. This means that, by duplicating this single subdirectory, it becomes possible to have multiple versions of CIFEDIT, where each copy validates CIFs against differing sets of dictionaries.
A third window can be used to view or edit the contents of the
directly. Editing the from this window bypasses the normal dictionary-based validation procedures, so it is not recommended for routine use. However, it can be useful for more advanced purposes, such as correction of syntax errors.The in-memory processing used in CIFEDIT can be expected to pose limitations on the maximum size of that can be read, but the limit will depend on the operating system and the amount of available memory. Since many computer systems behave poorly when all resources are consumed, a limit of 100 000 data values has been coded into CIFEDIT. This limits CIFEDIT to a circa 25 Mb task size (in Linux) and is sufficient for CIFs of the order of 0.5 Mb in length. If resources permit, this limit can easily be raised by editing the cifedit.tcl file to change the value of the variable CIF(maxvalues). On larger computers, CIFs as large as 3 Mb have been read successfully.
3. Distribution and documentation
The CIFEDIT program is not subject to copyright and thus is freely available for use, modification and redistribution. The program, including source code, can be downloaded from a NIST website as part of the NCNR CIFtools distributions (ftp://ftp.ncnr.nist.gov/pub/cryst/cif). A separate WWW page describes how to install and use the program (https://www.ncnr.nist.gov/xtal/software/cif/cifedit.html). WWW pages have also been provided to describe the internal operation of the program by documenting the computer code (https://www.ncnr.nist.gov/xtal/software/cif/cifedit/cifedit_doc.html).
Acknowledgements
The author would like to thank Brian McMahon for suggesting a number of useful enhancements to this program. Certain commercial products are identified in this report in order to describe the documented software adequately. Such identification is not intended to imply recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended to imply that these products are necessarily the best available for the purpose.
References
Hall, S. R., Allen, F. H. & Brown, I. D. (1991). Acta Cryst. A47, 655–685. CSD CrossRef CAS Web of Science IUCr Journals
Ousterhout, J. K. (1994). Tcl and the Tk Toolkit. London: Addison-Wesley Professional Computing.
Smith, B. & Johnson, O. (2002). enCIFer: a Program for Checking and Editing CIF Files. Cambridge Crystallographic Data Centre, 12 Union Road, Cambridge, England. (https://www.ccdc.cam.ac.uk/prods/encifer/.)
Toby, B. H. (2001). J. Appl. Cryst. 34, 210–213. Web of Science CrossRef CAS IUCr Journals
Toby, B. H. (2003). J. Appl. Cryst. 36, 1285–1287. Web of Science CrossRef CAS IUCr Journals
Toby, B. H., Von Dreele, R. B. & Larson, A. C. (2003). J. Appl. Cryst. 36, 1290–1294. Web of Science CrossRef CAS IUCr Journals
This article is published by the International Union of Crystallography. Prior permission is not required to reproduce short quotations, tables and figures from this article, provided the original authors and source are cited. For more information, click here.