Chapter 2: Initialising the Interface and Reading a Data-file

The first steps when programming ChemApp are

Initialisation of the interface is done with a call to TQINI. The subroutine TQRFIL enables a thermodynamic data-file in ASCII format to be read. In case you have data-files supplied in binary or transparent format, use TQRBIN or TQRCST, respectively, instead. After loading a transparent data-file, TQGTRH retrieves information from the transparent file header.

TQCPRT retrieves a copyright message for ChemApp, while TQVERS gets its version number. TQLITE can be used to determine whether the ChemApp library used is ChemApp light or the regular version of ChemApp. TQSIZE retrieves a number of parameters which indicate the sizes of a number of internal arrays of the version of ChemApp used, while TQUSED returns a similar set of values for the currently loaded thermochemical system.

The subroutines TQCIO and/or TQCSU need to be called if any default settings relating to input/output or system units are to be modified. Similarly, TQGIO and TQGSU are used to determine the current values of these options.

TQOPNA, TQOPNB, TQOPNT, TQCLOS, and TQOPEN make sure that when programming in a language other than FORTRAN, files used by ChemApp are opened and closed using the correct FORTRAN unit numbers. Even when programming in FORTRAN, the use of these subroutines over FORTRAN's OPEN and CLOSE is still strongly recommended.

When opening an ASCII output file for writing with TQOPEN, for instance to store ChemSage result tables, TQWSTR can be used to write user-defined text to the same file.

As of Version 4.0.0, each ChemApp library contains information on the license holder (see TQGTID and TQGTNM), and can be identified via a short signature string (see TQGTPI).

All the subroutines used in these procedures are summarised in Table 5, and described in more detail below.

Table 5: ChemApp subroutines for the initialisation stage

Subroutine Function
TQINI Initialises ChemApp
TQCPRT Gets copyright message
TQVERS Gets the ChemApp version number
TQLITE Checks whether ChemApp light is used
TQGTID Gets the user ID of the license holder of ChemApp
TQGTNM Gets the name of the license holder of ChemApp
TQGTPI Gets the ID of the program
TQGTHI Gets the HASP dongle type and id
TQGTED Gets the expiration date of the ChemApp license
TQSIZE Gets the internal array dimensions of ChemApp
TQUSED Gets the dimensions of the currently loaded thermochemical system
TQGIO Gets the value of an output option
TQCIO Changes the value of an output option
TQRFIL Reads a thermodynamic data-file in ASCII format
TQRBIN Reads a thermodynamic data-file in binary format
TQRCST Reads a thermodynamic data-file in transparent format
TQOPEN Opens a file
TQWSTR Writes a character string to the units associated with 'LIST' or 'ERROR'
TQOPNA Opens a thermochemical data-file in ASCII format
TQOPNB Opens a thermochemical data-file in binary format
TQOPNT Opens a thermochemical data-file in transparent format
TQCLOS Closes a file
TQGTRH Retrieves information stored in the header of a transparent file
TQGSU Gets a system unit
TQCSU Changes a system unit

Table 4: Default values and units

Temperature 1000 K
Pressure 1 bar
Composition No incoming amounts, no streams
System units bar, dm3, Kelvin, Joule, mol

ChemApp Programmer's Manual, Edition 3.6© GTT-Technologies, 2003