MTDATA – Phase Diagram Software from the National Physical Laboratory







Training and Support 




Other Services 





How to use MTDATA

The MTDATA command line interface

Module level

All modules within MTDATA share a common user interface, which is essentially command-driven with on-screen help. User control operates at four levels of user awareness.

The prompt tells the user very briefly the current level. For example at the top level the prompt asks what module the user wishes to select. The users responses here are given in red italics and are assumed to be terminated by a carriage return.

Entry of a question mark gives a menu of the keywords and other user options at any point.



The above menu appears on entry of a question mark and the prompt returns. To leave MTDATA from the module level the user enters exit. Information about the current version of MTDATA can be obtained by entry of version.

Help is obtained for any one of these options by entry of the option name preceded by a question mark. For example to learn about THERMOTAB

WHICH MODULE ? ?thermotab

The user interface will accept any unique abbreviation. Thus in the above example


is acceptable but


is not sufficient, as the "t" could stand for THERMOTAB or TERNARY. The correct entry will cause the program to move to the THERMOTAB module and to issue a prompt at the COMMAND level:


Command Level

On entering a module, the menu of commands can be obtained by entry of a question mark, for example, for THERMOTAB:


<'Macro name'>

Again, this menu can be displayed by entry of a question mark, and the current module is indicated by a change in the prompt, in this case to:


An appropriate response would be any of the keywords in the list or their unambiguous abbreviations.

Some command keywords bring immediate response without further entry apart from carriage return. For example:

In THERMOTAB, entry of go results in tabulation and/or plotting of thermodynamic functions. Entry of status yields the value of such parameters as temperature and pressure, and indicates which database(s) and substance(s) have been selected.

In all modules return moves the user back from the command to the module level.

Each of these keywords is typed in and followed immediately by <CR>.

The majority of command keywords, however, require a series of parameters with their associated values followed by an exclamation mark ! to complete them. It is this set of modifiers which constitutes the third level of the program.

Parameter/value level

Most command keywords must be followed by a valid series of parameters and values and be terminated by !. What constitutes a valid series depends upon the option selected.

The stop option is always available; it is used to abort a command.

The main purpose of this section is not to give exhaustive examples for each option keyword - details for these can be found in information about the appropriate module - but to illustrate the two main styles available for entries by the user.

Perhaps the easier of the two methods for beginners or intermittent users, is to allow the program to act as a guide through the entry. A typical conversation, using THERMOTAB as an example, would be:


TABULATE allows the user to define the destination of the output



Keyword options or prompts are always available



This sequence causes the output to go to the terminal


Please note that each command sequence must be terminated by !


A briefer form of interaction is more appropriate for the user familiar with THERMOTAB, its options and parameters. The above conversation could be replaced by one line of the format:

<option keyword> [<parameter> = <value>] !

where [] indicates allowable repetition

THERMOTAB OPTION ? tabulate terminal=no !

Indeed, the system is flexible enough to take several options and parameters on one line, provided they are in the correct sequence. An example is given below which will repay further inspection, once the remainder of the handbook has been digested:

THERMOTAB OPTION ? use sgsub =all ! define equation 'H2<g>%

+ O2<g> = H2O<g>' ! plot terminal=yes ! go

The concatenation character % (see [ENDCHR on page concerned with Configuration Variables) at the end of the first line is occasionally useful because it allows more than one line on the screen to be treated as though it were only one line of input. It results in a ? character being sent as a prompt for the rest of the user's entry.

Just as, at the module and command level, keywords may be shortened to an unambiguous abbreviation, so at the parameter/value level, the parameters, and if appropriate their values, may be abbreviated. Thus, in THERMOTAB:

autobalance mode=decimal substance=4 ! can be shortened to:

auto mode=dec sub=4 ! or even to au m d su 4 !

In the information for each module, for the sake of clarity, abbreviations are rarely used, but this should not be taken to imply that abbreviation is not recommended. Each user develops his/her own shorthand, but a convenient rule is to abbreviate to a monosyllable, since these are nearly always unambiguous, and at this level they still retain a recognizable relationship to the full form.

A special mention should be made of keywords containing underscores. Generally speaking, the part of the keyword on either side of an underscore may be abbreviated, and in appropriate cases, deleted altogether. Thus in MULTIPHASE:

set lgt_pressure(1)=-6 ! may be abbreviated to:

set l_p(1)=-6 ! or even set _p(1)=-6 !

In this case the underscore itself cannot be dispensed with but only because LGT is not unique.

Subscripted Keywords

The above is an example of a subscripted keyword. The subscript is bracketed and always applies to components, substances or phases. In some cases the subscripts can include multiple values. Depending on the particular function the subscripts may be numbers or character strings or in some cases either. The on-line help should be used to determine which. Where multiple values are possible entry of * or all results in the operation being applied universally. Examples are given below.

classify absent phase(bcc) s(all) normal s(1-7,16) !

In the above example the BCC_A2 phase and all of the substances are removed and then some of the substances are restored. Commas and hyphens are the only delimiters allowed within the brackets. Note that bcc is an acceptable abbreviation.

set n 1 n(1) 0.3 !

In a two component system the above command would set the total moles to 1 and that of the first component to 0.3. The amount of the second component would be calculated by difference.

set n(CO2) 0.2 !

set n(CO2<gas>) 0.2 !

The above two examples give quite different results. In the first 0.2 moles of C and 0.4 moles of O are added to the overall system composition, in the second the final amount of CO2 present in the gas phase at equilibrium is 0.2 moles.

set n( ) 1 2 0.2 !

If the system were C-H-O, the above command would set the amounts of components C, H and O to 1, 2 and 0.2 moles respectively. The user would be prompted if insufficient values were entered.

ordinate component_distribution component(Fe) !

The above command would change the graphics ordinate to the distribution of Fe between the phases.


A macro is a file containing exactly the same sort of commands, parameters and values as a user would enter from the terminal. The system editor could be used to make up a file like the following example in which the file is named step.mac.

define data 'JET4' !

; This line and the next two lines are "silent" comments.
; The next line removes phase 3 from the problem and
; makes phase 4 the reference phase for component 1.

classify absent p(4) reference(1) 3 !
set w 1 w(2) .3 ! step w(1) .01 .69 .01 !

; The following three comment lines will be echoed.
: Calculation for 1150 K in progress.

set te 1150 ! comp !

: Calculation for 1250 K in progress.

set te 1250 ! comp !

: Calculation for 1350 K in progress.

set te 1350 ! comp !

; The next command will require a response from the user to
; the prompt ENTER TEMPERATURE/K :
; Exactly eight asterisks are put in the macro where input is required.
; The asterisks should be the last item on the line.

set te ********
! comp !

: ***** project terminated ****

ret exit

In the above example, lines prefixed by a semicolon are purely remarks; those prefixed by a colon are echoed to the screen during macro operation. Macros are particularly useful when the effects of varying the data are to be explored. Macros avoid the repeated typing of commonly repeated conditions and in this particular example the macro functions as a mini batch file, undertaking the production of a series of graph files while the user gets on with other tasks. This particular macro begins with a multiphase command and can therefore be invoked from within MULTIPHASE by prefixing the name of the macro with an apostrophe as follows:


There is a useful overlap in the functions of macros and batch operation of MTDATA. Advice on the generation and use of batch files can be found elsewhere on the MTDATA web site. Macros may include user defined input points, because parameters will be prompted for if not supplied on the original command line in the macro file. "Silent" and "echoing" comments may be inserted into macros. These facilities, when used together provide a mechanism for customising the user interface. A disadvantage is that user input must be completely accurate. The macro will not recover from erroneous input unless [MACRO=CONTINUE has been entered as is the case in all log files.

Configuration Variables

In MTDATA it is possible to assign values to a range of settings that apply across the whole of MTDATA and affect a number of ways in which MTDATA appears or the accuracy of the calculations. These are called "Configuration Variables" and are assigned through use of "[" followed by the appropriate variable name. A list of the most important Configuration Variables can be obtained here.

Log files

By default MTDATA automatically produces a log of all user interaction and of data sources used. The log opens when the user enters MTDATA and closes on exit. Log files are generated in the directory from which MTDATA is run. They are named consecutively in the form mt123.log. Each line of user input will appear twice in the file: once prefixed by a colon to provide an echo to the screen, the other executive.

The log file may be used as a macro to repeat exactly what was done on a previous occasion or it may be edited to change the calculations or to prevent the macro exiting. In this case it is recommended that the mt???.log file is copied to one with the same root name but the extension .mac, so that the original log file is preserved and the macro can be easily identified. For purposes of total quality management all datafiles (those with the extension .mpi) should be preserved with the relevant .log files.


Updated 2 March 2010