Notes for version 3.1

D.J. Waters, June 1992

MINCALC is a utility for recalculating mineral analyses. In addition to simply recalculating the formula on the basis of a specified number of oxygens, it can also recalculate for ferric iron using a charge balance method (Droop 1987), and can make neat vertical tables suitable for inclusion in manuscripts for publication. It accepts input from disk files in three types of format, as described below, and outputs either to file or to a printer. The file formats are customizable, and are compatible with spreadsheet and database programs, and also with Afifi and Essene's mineral database program MINFILE.

MINCALC consists of the executable file MINCALC.EXE and a reference data file such as MINCALC.REF, which contains file format information, molecular weights, etc. The reference data are kept outside the program in an ordinary ASCII file so that you can edit them if you want to. Some alternative reference data files in other formats are also provided. MINCALC.REF (or any other reference data file you want to use) should be kept in the same directory as MINCALC.EXE.

Input file formats

First, some general information about input data files. The first line of each data file contains headings for the columns of sample information and weight percentages which appear on the following lines. The headings to the weight percent columns must match the oxide names in the first column of the file MINCALC.REF (or of your own customized reference data file), otherwise MINCALC won't recognize them. Each succeeding line contains information and weights for one analysis. Before the list of weight percentages starts, you may include up to ten fields containing items of information to identify the analysis, provide the number of oxygens to calculate for, etc. The file MINCALC.REF, as supplied with the program, defines six such fields. For more description of this aspect of file formatting, see the section on reference data files.

An important feature of MINCALC is that the weight percentages are read in as strings (i.e. as text, not as numbers) and appear in the output in exactly the same form. (The exceptions to this are: (i) FeO and Fe2O3, when Fe3+ has been recalculated, and (ii) when using the "database option" described later, which forces numeric output.) As a result, you can use "n.d." for not detected, "-" for missing data, etc, and these abbreviations reappear in the resulting table, or are preserved in the recalculated database. The program treats all these as zero values.

You do not need to add totals for the weight percentages. These will be calculated by MINCALC.

You can use, as an input file, a file in any of the legal formats even if they already contain totals and recalculated cations. When a field heading "Total" (or "total" or "TOTAL") is encountered in the first line, the program will skip over the fields from this one to the line end when each sample is read.

File format No 1: Delimited ASCII.

This is a compact format suitable for storing data. The fields are separated by commas, and text fields (such as the headings in line 1, and the analysis information fields 3, 4 and 6 in the MINBASE format) are enclosed in quotation marks. Many spreadsheets and databases can read such files. If you create a data file in this format, using an editor, make sure that you include the right number of fields in each data line (their lengths are immaterial), and that fields do not contain internal spaces. LOTUS 1-2-3 cannot produce files in this format, but it can import them with ease. For this reason the default format options in MINCALC are .PRN (format 2) for input and delimited ASCII for output.

File format No 2: Fixed field-widths (Spreadsheet .PRN file).

If you use a spreadsheet program such as Lotus 1-2-3, the simplest way to produce an input file for MINCALC is to enter the data in the MINBASE spreadsheet, and save it in a .PRN file using the built-in macro alt-S. You may leave MINBASE fields empty (MINCALC will fill them with a dash), and the text fields may have internal spaces (MINCALC will replace internal spaces with underline characters).

You can construct a data file yourself in this format, if you wish, but be sure to use field widths exactly as defined in the reference data file currently in use (e.g. MINBASE.REF). Use an existing .PRN file in the appropriate format as an example. There should be one on this disk.

File format No 3: MINFILE format

For details of this format, see the manual for the program MINFILE by Afifi and Essene.

Reference data files

The reference data file controls some aspects of the operation of MINCALC, and allows you to customize the format of the mineral data files you want to recalculate. The first few lines of the standard reference file MINCALC.REF look like this:

6                                 (= no of info fields)
No  Sample  Min  #  Descr  Ox     (= names of info fields)
4 10  5  5 11  5  8      (= widths of info fields + global fieldwidth)
1  1  1  0  1  0         (= codes (number = 0, label = 1) for fields)
6  3  3  0          (= field nos for oxygens, ID, mineral name, group#)
2            (= decimal places, oxides)
3            (= decimal places, cations)
70           (= page length in lines)
Al2O3 Al    101.94  2  3
B2O3  B     69.64   2  3
BaO   Ba    153.36  1  2

The field names in line 2 would normally be in the first line of your data file. However, they are not stored in the MINFILE format, and so are read from the reference file when MINFILE input is selected.

The field widths in line 3 are used to read and write files in the fixed field-width .PRN format. These default values correspond to the standard version of the MINBASE.WK1 spreadsheet.

The codes in line 4 are only used when the "database mode" switch is set (see "Running the program", below). This option forces the data in each field to be output as numeric, or as text (enclosed in quotes), to ensure compatibility with specified field types in databases. (Otherwise MINCALC determines for itself whether each individual item to be output is a number or text.)

Line 5 tells MINCALC which of the information fields contain necessary data for the calculation or for output formatting. The ID (specimen identification) and group# fields control what goes into these specific fields in the MINFILE format, and are not applicable to other formats.

To change the page length (72 lines = 12 inches, 70 lines = A4), or the number of decimal places in totals or cations, edit the appropriate line. The rest of this file consists of data on the oxides. Add any further oxides of interest to you (up to 100 of them), or edit anything (e.g. cation names) you are not happy with. There are five free-format fields:

  1. Name of oxide (as it must appear in data file).
  2. Name of cation (as you want it to appear in output).
  3. Molecular weight of oxide.
  4. Number of atoms in oxide formula unit.
  5. Valence of atom.

Note the way anions such as Cl and S are treated here:

S     S-2   32.066  1 -2
Cl    Cl-   35.457 -1 -1

To avoid conflict when data are re-imported into databases, the weight % and molar symbols are different. Anions have negative valence. Anions such as Cl, which substitute for OH, have been given negative atom numbers (see the section on recalculating hydrous minerals).

Several .REF files are supplied, which differ in the definition of the sample information fields.

New, customized reference files can be built by editing any of the above. Comments can be placed at the end of any line of a .REF file.

To use a particular reference data file, do one of the following:

  1. Make a copy of it called MINCALC.REF.
  2. Give its full name on the entry screen.
  3. Give its full name as a command line parameter when MINCALC is started.

Hydrous minerals

Be careful when recalculating the formulae of hydrous minerals for which you have data for F and Cl. If you have microprobe analyses, without a value for H2O, use the number of oxygens which corresponds to the formula without its ideal H2O content (i.e. 22 for micas, 23 for amphiboles), and make sure you do not list H2O among the oxides in that data file. If you have full analyses, including H2O, use the total number of (O, OH, F, Cl), i.e. 24 for micas and amphiboles. MINCALC looks for H2O in line 1 of the data file, and chooses the appropriate recalculation method for F and Cl. You will thus not be able to mix microprobe and full analyses in the same file.

Running the program

Make sure the appropriate reference data file(s) (e.g. MINCALC.REF) is in the same directory as the program MINCALC.EXE, and type MINCALC at the DOS prompt.

When MINCALC is running, an entry screen appears, on which you can enter the input, output, and reference file names (with their full path if they are not in the current directory), and select options for file formats and type of output.

The fourth field on the screen allows you make output more compact or legible by specifying a set of characters to replace entries like "0.000" in the cation listings.

Near the bottom of the screen, there are two switches (1 = yes, 0 = no) which control program operation:

  1. Database mode. This option forces weight and cation output fields to contain numerical data (e.g. replaces entries such as n.a. with 0.00). For the sample information fields, MINCALC usually tests the initial character of the entry to determine whether it is a number or text. This option overrides the test and imposes the definitions in the reference data file.
  2. No screen listing. This option suppresses the full listing of each analysis to the screen, giving only the sample identification. Program execution is significantly faster.

Some default options are already there. As soon as everything is entered to your satisfaction, press ESC. If the input file can't be found, you get the option, via further prompts, to search for the file you want, first in the current directory, then anywhere you like. If the output file currently exists, MINCALC prompts you for permission to continue.

While MINCALC processes the analyses, it shows the calculated results, one analysis at a time, on the screen. You can "freeze" the recalculation at any time, to examine a particular analysis, by hitting any key (the space bar is the most convenient). To restart, just hit any key once again.

If you selected ferric iron recalculation, you will be prompted to enter the appropriate number of cations before the first analysis is processed, and thereafter whenever the program detects (by noting a change in the number of oxygens specified) that the mineral species has changed.

There are some optional command-line parameters:

and the two switches:

The parameters can appear in any order. For example: to run MINCALC using a different reference file and without full screen listings type either




Printing vertical tables

On the entry screen you can choose how many analyses to print on a page. The choices given (7, 9 and 13) correspond to a full page width using pica, elite and compressed type respectively on a standard EPSON-type dot-matrix printer, but (within reason) you can enter other numbers here. If you choose printer output, the tables should format correctly on a dot-matrix printer, or on a laser printer configured for EPSON FX emulation. For fancier effects, output the vertical list to a file, and import the file later into your favourite word processor to add fonts and page formatting. You should only have to edit out a few printer codes.

Use the "back" button on your browser, or return to Tools page documentation list.