MACRO_FILE_OPEN

Some of the information in this topic is related to the add-on Diffusion Module (DICTRA).

The macro file functionality is a way to predefine sequences of Thermo‑Calc commands stored in a macro file (a basic text file usually with the default extension *.TCM or*.DCM for DICTRA) and then executing all of the sequences using this command (preceded by the macro file name). This command can be used within various modules (i.e. SYS, POLY, PARROT, TAB and DICTRA_Monitor).

Syntax

macro_file_open

 

<Name of a macro file *.tcm>

An Open window displays to specify the filename of the macro file (*.TCM) with the macro command, so that the path (in the Look in field) and File name can be specified.

The Files of type *.TCM for Thermo‑Calc (Console Mode) calculations and *.DCM for DICTRA simulations, cannot be changed. Click Open or Cancel to continue.

A window such as Save, Open, or Print opens if the macro file contains commands to:

  • set log files (these have a file extension .TCM)
  • save or read GIBBS, POLY or PARROT workspaces
  • switch user databases
  • compile experiments (from existing *.POP files)
  • create new *.PAR files
  • append *.EXP files
  • plot diagrams, etc.

If required, opening these windows can be avoided by issuing the file names (preferably with file-type extensions; if the files are not in the current working area where the macro is located, the appropriate and complete paths of the files should also be specified) and sometimes with the required options after the corresponding commands or parameters/options.

For details, see the related commands and modules.

When using a macro file that intended to plot graphs on screen, but the command SET_PLOT_FORMAT is used to alter the plotting environment from the default value, it is important to first use the command SET_PLOT_FORMAT again to change back to the default value.

This is useful when the same or similar calculations are made frequently with small changes [in terms of system definitions, data manipulations, conditions (for single points, stepping or mapping calculations), plotting settings, etc.). For example, use this feature when calculating phase/property diagrams during an assessment of thermodynamic data.

A macro file can be automatically generated in Console Mode if in the SYS module the SET_LOG_FILE command is used and a log file name (with a file extension *.TCM) is given before any other SYS, DATA, TAB, GIBBS, POLY, POST, PARROT, or ED-EXP command or any special-module command (e.g. BIN, TERN, POTENTIAL, SCHEIL, POURBAIX, or REACTION). Such a log file generated in Console Mode is a text file. You can use a text editor (such as Notepad++) to remove unnecessary command lines, modify some commands, settings and definitions, add some pause points, add comment lines that start with @@, and so forth. Then save it as a macro file with the standard file extension TCM.

Experienced users can also write/edit an appropriate macro file for calculations/simulations, using any basic textual editor outside the Thermo‑Calc program.

All commands can be used in a macro file.

The file can be terminated with EXIT or interrupted with SET_INTERACTIVE.

Within a macro file you can use comment-lines (for describing the problems and for explaining commands and inputs/outputs), which should always start with the @@ signs in the beginning of each comment-line. Such comment-lines help to document the macro file, while these are not considered as command lines and thus do not affect the proceeding of all the normal commands in modules when the file is called by Thermo‑Calc.

You can put multiple-line comment-blocks in a macro file between the @ (” and “@)” signs. The former sign indicates where the comment begins and the latter sign indicates where the comment ends. A comment-block begins from a line started with the begin comment sign @ (and ends with the finish comment sign @); all the lines written in between are ignored, and the line started with @) is also ignored.

Another use for a macro file is to allow you to interact at some specific points, using the “@?” sign starting a text line (note that the text describing the expected user-specification/input should be written as a continuous string without any empty space), for user’s on-time specifications of arguments/parameters or inputs of parameter-values that are requested by a certain command. The macro temporally stops at the “@?” sign, prompt on screen the text given after “@?”, and waits for the specified argument/parameter/value. Thermo‑Calc then uses specified argument/parameter/value as the input(s) for the associated command. For example, you can input the values of lower and higher temperature limits for the second axis-variable as follows:

GO POLY-3

SET-AXIS-VAR 2 T  @?Low-temperature-limit:

@?High-temperature-limit:

You can have macro-variables denoted by the signs of @#n (for definition) and ##n (for usage); and up to nine variables inside a single macro file. Such a macro-variable can be assigned with its desired value, as for example:

@#3First-element?

This writes the text (note that the text describing the expected user specification/input is written as a continuous string without any empty spaces) after the “@#3” sign as prompted on screen and then wait for a specification. The input is assigned to the macro-variable ##3, which is directly called in different parts within the current macro file.

For example, the content of the macro-variable ##3 is inserted in the command:

DEFINE-SYSTEM ##3

It is also useful in more complicated commands, such as:

SET AXIS VAR 1 x(##3) 0 1,,,

This command sets the mole fraction of macro variable 3 as axis 1.

A macro file can have any number of pauses at the @& signs, for the purpose of checking the details/results of executing certain commands when running the macro file. However, you can also prevent the software from temporarily stopping at any pause by typing any character (except for the Y character for confirming a Yes answer to a command prompt) after specifying the name of a macro file.

A macro file can have a maximum of five nested levels, i.e. a macro file can call another macro file, and if one sub-level macro is terminated by the command it resumes at the next command in the previous macro. If it is terminated by end-of-file, the Thermo‑Calc (Console Mode) software stops.

This feature is especially useful for alloy design that requires many (hundreds) of calculations/simulations on similar material system/processes (specified in many different but appropriately-documented macro files that are organized in up to five levels) during a certain period of time (e.g. in an evening), you can run the main macro (on the top level) at a certain time (e.g. before leaving  the office) and afterwards (e.g. next morning) you can systematically and efficiently check/compare/analyse the results (saved as graphical files, and/or EXP, TXT, XLS… files).

By adding the SYS command SET_ECHO at the beginning of a macro file (or in the primary macro file on the top level if any sub-level(s) of macro files are used), it is useful to automatically display the complete/detailed meaning of various commands in all the sequential operations in the software, all enforced according to the macro file(s).