Tables for
Volume G
Definition and exchange of crystallographic data
Edited by S. R. Hall and B. McMahon

International Tables for Crystallography (2006). Vol. G, ch. 5.3, pp. 521-522

Section Input to a Fortran application program

B. McMahona*

aInternational Union of Crystallography, 5 Abbey Square, Chester CH1 2HU, England
Correspondence e-mail: Input to a Fortran application program

| top | pdf |

A Fortran program can make use of the C input function generated by BuildSiv as long as the compiler used is capable of linking C and Fortran modules. For Fortran applications, the `-f' command-line option is used:

BuildSiv -f dictfile ddlversion

A C structure is defined for use within the cifsiv_ subroutine and an identically constructed Fortran common block is built for use within Fortran routines. The first variable within the common block must be passed as an additional argument when the cifsiv_ function is called. In the current implementation, that variable is always called `BLOCKBEG'. The input subroutine is thus called from within a Fortran program by a line of the type


where FILE and BLOCK are, respectively, the name of the input file and data block.

Fig.[link] is an example Fortran include file generated by BuildSiv and Fig.[link] is an example application incorporating this file. As with the C examples, the CIF data to be read are those specified in the dictionary augmented according to Fig.[link].


Figure | top | pdf |

Fortran include file for an application built by BuildSiv from the augmented DDL dictionary of Fig.[link].


Figure | top | pdf |

An example Fortran program designed to read CIF data as tagged in the augmented DDL dictionary of Fig.[link].

It may be noted that the C header file generated by the Fortran implementation of BuildSiv (and which is used directly by the C object file produced) is callable by any other C program or subroutine. The Fortran common block is represented by a C structure named cifcmnptr, so that the variable names are stored within that structure and must be addressed through the C [\rightarrow] operator. That is, an additional C routine compiled in with the Fortran example program of Fig.[link] would refer to the variable holding the value of the input _refine_ls_extinction_method as (char *)cifcmnptr->extmet.

to end of page
to top of page