International
Tables for
Crystallography
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 5.3.7.2.4. Input to a Fortran application program

B. McMahona*

a International Union of Crystallography, 5 Abbey Square, Chester CH1 2HU, England
Correspondence e-mail: bm@iucr.org

5.3.7.2.4. 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

CALL CIFSIV( FILE , BLOCK , BLOCKBEG)

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

Fig. 5.3.7.7[link] is an example Fortran include file generated by BuildSiv and Fig. 5.3.7.8[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. 5.3.7.4[link].

[Figure 5.3.7.7]

Figure 5.3.7.7 | top | pdf |

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

[Figure 5.3.7.8]

Figure 5.3.7.8 | top | pdf |

An example Fortran program designed to read CIF data as tagged in the augmented DDL dictionary of Fig. 5.3.7.4[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. 5.3.7.7[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