TWQ_View
version 1.2
© Dmitry Dolivo-Dobrovolsky, 2006-2016
IPGG RAS, Makarova emb., 2, St.Petersburg 199034, Russia

E-mail: ddd@ipgg.ru


Purpose and main features of the program

 TWQ_View is a handy freeware ©MS Windows program for viewing and basic work with diagrams generated by the ©TWQ program of R.G. Berman, T.H. Brown, E.H. Perkins and J. Ellwood (Berman, 1991). With TWQ_View, you can:

  • display diagrams;
  • adjust their design;
  • colorize curves and find specific equilibria (by clicking on curves as well as by selecting from the list);
  • zoom;
  • scroll;
  • show / hide specified curves and sets of equilibria containing specified components;
  • combine diagrams;
  • browse diagrams by moving through the list of plot-files;
  • plot compositions of phases (mole fractions of components/elements) for the list of compositional files;
  • run INTERSX.EXE from the program for selected plot-files or for all plot-files in the direcory (using cyclic batch mode process). You can launch old 16-bit DOS version of INTERSX.EXE under 64-bit OS (Windows Vista, 7 and 8) due to implemented support of the DOSBox emulator;
  • display averaged values (with deviations) on diagrams together with equilibria;
  • search plot-files with best convergence of intersections using sorted lists of averages;
  • change pressure units (bar→kbar) and activity scale (Log(α)→α);
  • replace abbreviations automatically by a commonly accepted ones (taken from the editable list);
  • copy diagrams to the clipboard as a vector Windows Meta-Files (WMF) with following pasting to any editor of vector graphics (like ©CorelDraw) or to a text processor (like ©MS Word).

 You can associate TWQ_View with desired extensions of plot-files (e.g. *.PLT, *.P1) and view diagrams simply by clicking on their files in the file explorer.

 TWQ_View is written on ©Borland Delphi 7 and based on the ©TeeChart component (standard edition v. 4.04 by D. Berneda, Steema software).

Back to Contents


Requirements and installation

 TWQ_View is a ©MS Windows program. At present, I'm developing it under ©MS Windows XP, although it should also work under earlier and newer Windows versions. It's important (but not critical) to use high-resolution display mode because the program shows a lot of information in several windows simultaneously.

 While TWQ_View is primarily oriented to work with old DOS version of the INTERSX.EXE program, you can use the program with a Windows version winTERSX.EXE, too (but launched separately). Unfortunately, working with winTERSX.EXE in its batch mode may be problematic, especially with newest version 2.34. TWQ_View allows working with old 16-bit INTERSX.EXE under 64-bit OS (like Windows Vista, 7 and 8) due to implemented support of the DOSBox emulator (which should be downloaded and installed by yourself). Usage of emulator for the DOS version of TWQ may be attractive also for 32-bit Windows due to removed 19-symbol restriction on lengths of paths to TWQ programs and data files (you can also use long names of directories). NB! DOSBox has a restriction, too: directory with your data files should not be placed within directory with TWQ programs (and vice versa)!

 Despite the fact that DOSBox emulator is specially designed for launching of old PC games on modern OS and hardware and its authors strongly refuse to support any non-gaming applications (see: http://www.vogons.org/viewtopic.php?t=27920), this program has the next important advantages:

  • it is a free software with open source (GNU General Public License);
  • small;
  • very simple installation and usage;
  • loads fast;
  • works fine;
  • it is a portable application, i.e. you can copy directory with emulator to removable drive (e.g. to your flash-disk) and continue working with it. TWQ_View as well as TWQ package also can be launched from removable drives (TWQ_View sets correct logical disk letter in paths to TWQ and DOSBox programs).
 To install the program just copy (unzip) all files from the archive to a desired directory. These files are:
  • TWQ_VIEW.EXE – the executable file of the program;
  • TWQ_VIEW.INI – the file with saved program parameters (the program will create a new one if this file is absent);
  • TWQ_VIEW.RPL – the ASCII text file with the editable list of replacements;
  • TWQ_VIEW.CHM – the help-file of the program (documentation), English version;
  • TWQ_VIEW_RUS.CHM – the help-file of the program (documentation), Russian version;
  • ALS.PLT – a very useful Ky-Sil-And P-T diagram (for the Repository of overlays, you can use the TWQ_View directory or any separate directory instead);
  • QTZ.PLT – an another useful αQtz-βQtz P-T diagram (for the Repository);
  • 001.P1 – an example of a P-T diagram (NB! A good fit of a garnet-absent assemblage!);
  • 002.P1 – an example of a P- Log α(H2O) diagram.

 Then, you should edit some data in the TWQ_View.ini file. At least, write correct values there for the next variables:

  • TWQDir= the path to the DOS version of the TWQ package;
  • DOSBox= the path to executable file DOSBox.exe (if emulator has been installed, too);

 TWQ_View writes nothing to the system registry. However, you can associate desired types of files (extensions of TWQ plot-files) with this program manually.


Working with TWQ_View

 You can run the program with a command line parameter – the name of a TWQ plot-file (extension is required). This feature allows you to associate TWQ_View with extensions of plot-files. If TWQ_View is run without command line parameters then you must select a plot-file in the standard "Open" dialog window first. The program will remember the path to a last loaded plot-file as a default for the next run.

 TWQ_View operates in five independent windows. You can show, hide, move and resize them as you prefer, and the program will remember screen positions and dimensions of these windows for the future runs.

Menu (main window)
Diagram (main window)
Program settings (Options)
Lists of equilibria and components (Equilibria)
List of plot-files (Plot-files)
Compositional diagram (CMP-files)
File with replacements for abbreviations
Working with INTERSX.EXE and calculated averages
Variables of the initialization file


Menu (main window)

 Menu of the TWQ_View main window consists of four items (their hot-keys are underlined):

File
 Basic file operations. Its submenu items are:

Load – clear diagram and load a new plot-file using the standard Windows "Open" dialog box. This method allows you to change the default directory of plot-files for TWQ-View. Current path is displayed on the title-bar of the main program window.

Combine – load a new plot-file using the standard Windows "Open" dialog box and combine it with previously plotted data. The program performs the simplest compatibility checking of diagrams (by axes' names) and adjusts borders if necessary. This method changes the default directory of plot-files for TWQ-View, too.

Repository – load a plot-file from the special "Repository" directory (the library of the most common and useful curves) and draw its lines over existing data. In contrast to the previous method, borders are left untouched. Simple structure of ASCII-text TWQ plot-files permits manual creation of such templates (with any curves – not only TWQ-generated). Loading of a file from another place changes Repository directory path.

Exit – quit the program.

The program places the list of Last visited directories (up to 30) at the bottom of File submenu. You can click these items to load/append/browse files from several frequently used locations. You can clear this list manually: just delete all lines starting with PlotPath= from the TWQ_View.ini file.

Windows
 Show / activate other four windows of the program:

Options – the program settings;

Equilibria – the lists of equilibria and components;

Plot-files – the list of plot-files in the current directory (for quick access) and the list of extensions.

CMP-files – the diagram plotted for compositional files of all corresponding plot-files from the list.

 The program uses named sets of windows parameters (their positions and sizes): so-called Desktops. They appear at the bottom of the Windows submenu. Click on one of these names to re-organize the program windows, or click on the last item (<Save desktop>) to save the current desktop. Type a new name in the input-box to add a new desktop, or type Default (or clear the name string) to save the current desktop as a default one.

Analysis
 TWQ_View can help you with the analysis of intersections if the pairs plot-file + compositional file are present. The program calls the INTERSX.EXE program (from the DOS version of the TWQ package) and extracts the averaged values from its output file(s).

 Of course, it's not necessary to perform such analysis every time you run TWQ_View for the same set of plot-files. The program loads the results of calculations from their files automatically at directory changes and immediately displays the existent averages on the diagrams.

INTERSX.EXE – call the INTERSX.EXE program with the parameters specified in the next menu item.

Database: <file name or "?"> – open the small dialog window to specify parameters for the INTERSX.EXE program. Press the Add button to add a thermodynamic database to the list (e.g. ba96.dat). The program takes path to database files as the TWQ directory parameter. Press the Delete button to remove the highlighted file from the list. Press the Solutions button to associate the corresponding SLN-file with the highlighted database. This file is also required for the INTERSX.EXE program. Press the Select button (or double-click on the database in the list) to select the highlighted database as the current one: its name will replace the question mark "?" in the menu. Check the Paused run checkbox to leave the DOS window opened after the termination of the INTERSX.EXE program. This option can help if you don't understand: why the INTERSX.EXE program doesn't work properly? Check the Batch run checkbox to process a set of similar plots in the batch mode. NB! The program clears this checkbox after the operation.

 If window with the table of averages (see below) is opened, TWQ_View will process only subset of plot files checked in this table.

 If some curves are hidden then the INTERSX.EXE program calculates averages only for shown equilibria. This feature is useful to exclude those sensitive curves that change their position dramatically even at minute variations of mineral compositions.

 Checkbox DOSBox may be used to launch 16-bit DOS version of INTERSX.EXE program under the DOS emulator. If emulator hasn't been (properly) installed and/or path to the file DOSBox.exe is not specified in the initialization file ">TWQ_View.ini, then this option is unchecked and disabled. If emulator has been installed, path to the DOSBox.exe file is correct and you're working under 64-bit operating system (Windows Vista, 7 or 8) then this checkbox is checked and disabled. You can check it by yourself only if you're working under 32-bit OS (e.g. Windows XP).

 TWQ_View uses the complicated strategy for the batch mode runs. It tries to guarantee that all your plot-files will be processed irrespective of INTERSX.EXE faults (that are critical if you use intersx.exe /b command):

  1. Replace references to the database file and corresponding SLN-file in the TWQ's PTAXCON.FIG configuration file;
  2. Create the file BATCH.DAT in the TWQ directory and write there:
    1. The name of the directory with your plot-files (NB! Remember that in the DOS version of the TWQ package this name must not exceed 20 characters including terminating back-slash "\"!),
    2. The name of the restart file (always RESTART.RES),
    3. The names of the database file and of the "aqueous" HKF'81 database (the last is taken from the PTAXCON.FIG file),
    4. The name of the list-file (always CMP.DAT);
  3. Write the list of existent compositional files to the file CMP.DAT in the directory with your plot-files;
  4. Create the batch file INTRSX.BAT in the TWQ directory and write the DOS commands there:

    @echo off
    cd TWQ_directory
    INTERSX.EXE /B < INTERSX.ASK

    where INTERSX.ASK is the file with re-directed keyboard input;
  5. Create the file INTERSX.ASK in the TWQ directory. It contains only 3 <CR> characters (i.e. 3 pressings of the <Enter> key);
  6. Create the file TEMP.AVG in the directory with your plot-files. The program accumulates results there;
  7. Run INTRSX.BAT and wait for its termination;
  8. Read CMP.AVG and add analysed records to the TEMP.AVG. The program looks for:
    1. Averaged values,
    2. The name of the last processed file;
  9. If all the files were processed then jump to 12;
  10. Update the list-file CMP.DAT: write there the names of unprocessed files;
  11. Return to 7.
  12. Delete the files: CMP.AVG, CMP.DAT, INTERSX.ASK, INTRSX.BAT and Averages.dat (see below);
  13. Rename TEMP.AVG to CMP.AVG;
  14. Analyse CMP.AVG and all existent separate AVG-files missed in CMP.AVG;
  15. Exit.

 If some of the plot-files has not been processed (e.g. due to critical faults of the INTERSX.EXE program) or if the file CMP.AVG is not present at all then TWQ_View looks for the separate AVG-files in the directory with plot-files and fills empty entries. I've recognized that INTERSX.EXE works fine for some separate plot-file while it crushes on the same file in the batch mode.

 In some cases permanent faults of INTERSX.EXE lead to infinite loops at the batch processing when the program tries to load the same plot file again and again. To exit this looping you can use the button with red circle which appears at the right bottom corner of the diagram window while the program operates in batch mode. However, reaction of the button is not immediate: question about process termination appears after closing of current DOS-window with INTERSX.EXE.

 The resulting CMP.AVG file (together with the other AVG-files) occupies a lot of disk space: TWQ_View requires a long time to analyse them. Therefore, the program writes a special smaller text file Averages.dat (with the essentials extracted from the AVG-files) at the first processing of CMP.AVG + *.AVG files and loads only this file at the next runs. You can delete Averages.dat to re-analyse all existent AVG-files, or delete/archive/compress (e.g. using ZIP-method) all AVG-files to free the disk space. Data from separate AVG-files override data from Averages.dat.

Table of averages –  Create and display the table of calculated values for the all processed plot-files. You can select one of the three types of averages:

  1. All – averages based on the all intersections,
  2. 1.5 sigma – averages based on the intersections lying within 1.5 of the MSD value,
  3. IR – averages based on the intersections of the linearly independent equilibria.

 The table consists of 12 columns:

  1. Names of the Files;
  2. Quantities of the Used intersections;
  3. X – values by the horizontal axis;
  4. dX – mean square deviations of X;
  5. Y – values by the vertical axis;
  6. dY – mean square deviations of Y;
  7. Xm – "simple averages" by the horizontal axis;
  8. Ym – "simple averages" by the vertical axis;
  9. nR – number of reactions used in calculation of "simple averages";
  10. Scatter – RMSD values (minimum root-mean-squared distances form points of "simple averages" to all the lines of reactions);
  11. Analyses – indexes of fields and analyses (contents of the file *_REF.TXT);
  12. Comments.

 You can press on the title of any column to select the sorting value (e.g. sort the list by dX or dY to find the plot-file demonstrating the best convergence of intersections), or double-click on any row to add/edit a comment. Press the Save button to save the sorted table to the file AVG_xxx.TAB (where xxx depends on the type of averages and possible column used for sorting results). TAB-file is an ASCII text file with values separated by the tabulations. These files can be easily imported into ©MS Excel.

 Checkboxes are used for selection of plot files to be processed by INTERSX.EXE in batch mode (if this window is visible). You can also use pop-up menu for (un)checking group of files at once.

 TWQ_View shows the second small separate Find window if the Averages window is opened. You can select desired analyses there and jump on corresponding combination in the table immediately.

 The program places all comments to the special text file Comments.dat created in the directory with your plot-files.

 The program shows corresponding diagrams at navigating in the table.

Plot all/current averages – you can plot averages for the whole set of plot-files in the current directory or averages for the currently plotted diagrams: just switch the mode by this menu command. If all averages are plotted on the diagram with horizontal temperature axis then different colors can be used for different temperature MSD ranges. These ranges and their colors can be set by the dTRanges value in TWQ_View.ini. See also "Displaying of averages (Options window)" about usage of colored ranges.

Simple averages – this command calculates "simple averages" for the whole set of plot files. You can use "simple averages" as the express-method for primary estimation of PT parameters and for detection of combinations demonstrating good convergence of reaction lines before running INTERSX.EXE.

Copy

Copy plot to the clipboard – this command copies the diagram to the clipboard as a vector Windows Meta-File (WMF). Then you can paste it to any editor of vector graphics (like ©CorelDraw or ©Adobe Illustrator) or to an advanced text processor (e.g. ©MS Word).

Save plot as a TVL file – save diagram as a vector graphics to a file of TVL format (used by the TriQuick program).

Help
 Display help information. Its two submenu items are:

Help – open this help-file (TWQ_VIEW.CHM).

About – call window with general words about the program and my contact information. You can send me e-mail by clicking the address (or simply by pressing "e" on the keyboard). You can also press the Updates button here to open the window with settings of automatic checking for the program updates and information about the latest version.

Back to Working with TWQ_View


Diagram (main window)

 Most of the diagram properties are controlled in the Options window. Though, the diagram is also interactive:

  1. Browsing – use two small buttons with arrows at the bottom-right corner of the window (or press corresponding keys on the keyboard) to view the previous/next plot-file.
  2. Zooming – use the left mouse button to draw a zoom rectangle from the top-left corner to the bottom-right corner of the interesting area. Draw an arbitrary rectangle in any other direction to restore the original scale of the diagram.
  3. Scrolling – use the right mouse button to drag curves within the diagram window (i.e. to scroll the diagram). Again, draw a rectangle (in the direction different from zooming) to restore the original position of the curves.
  4. Clicking – click on any curve to display corresponding stoichiometric equation of this equilibrium (precise positioning is required, though: displaying nodes on the curves is helpful to "bad snipers"). Click on the equation again with the left mouse button (or anywhere outside it) to hide this label, or with the right mouse button – to show the small pop-up menu. You can show this pop-up menu immediately by clicking on the curve with the right mouse button. I must notice that these labels are not diagram elements and cannot be exported with WMF graphics: they are separate windows.

Pop-up menu
 You can change here some individual parameters of the selected curve:
  – quick selection of equilibrium for its inspection (or cancel selection); selected equilibria are shown by bold magenta lines (irrespective of color settings);
  – color;
  – line width (within the range 1...4);
  – symbol;
  – hide curve (in the Diagram window only).

Available symbols
Circle – default
Upright cross
Diagonal cross
Triangle (apex up)
Triangle (apex down)
Square
Diamond
Star (octactinal)
Small dot (almost invisible in fact!)


Program settings (options)

 Most of the diagram properties are controlled in the Options window having four tabs:

Axes
 You can change different parameters of the horizontal (X) and the vertical (Y) axes. The program estimates automatically Minimum and Maximum values if Auto in this section is checked, or use values from the plot-file if auto-mode is "off" (automatic values are written in bold). Although, you can specify your own values. Press Reset buttons to restore the original values (automatic or from the plot-file).
 The next two values control distances between labelled ticks on the axes. The program uses minimum values instead of strict ones to make the diagram behaviour acceptable at window resizing and zooming. Minimum increment is the minimum distance between the labelled ticks. In some cases, it is convenient to specify large exact values. However, the better solution is to set the appropriate Separation values – the percent amounts of minimum distance between labels (within the range 10...255). Visibility of the labels also depends on their font size.

Colors
 All colors used for curves are shown in the list as a colorized hexadecimal values (a single-value representation of RGB triplet) with the prefix "#". If all Color= lines are deleted from the TWQ_View.ini file, then the program fills this list with 16 default values (used by the TWQ program) at the start:

  1. Black
  2. Blue
  3. Green
  4. Cyan
  5. Red
  6. Magenta
  7. Brown
  8. Gray
  9. Dark Gray
  10. Light Blue
  11. Light Green
  12. Light Cyan
  13. Light Red
  14. Light Magenta
  15. Yellow
  16. White

NB! Standard colors include black (first) and white (last) colors – you may wish to change one of the curve colors to make it visible on the background! In other cases, the program prevents selection of a curve color identical to the fill color (and vice versa).
 You can click on the list of colors by the right mouse button to show the small pop-up menu for some operations with this list: select the Add item in this menu to append a new color at the end of the list (you can also double-click in the empty area of the list to do this), Insert – to insert a new color at the current position (you can press the <Insert> key on the keyboard, too), Delete – to remove the selected color (you can press also the <Delete> key on the keyboard; at least one color must be present), Edit – to change the selected color. You can edit the selected color also by double clicking on it and change the order of colors by the mouse "drag'n'drop" operation.
Auto to assign colors automatically. The order of colors is taken from the list and the order of curves is taken from the plot-file. The program uses colors specified in the plot-file only if auto-mode is "off".
 You can specify colors of individual curves in the Diagram window using the curve pop-up menu.

 Press buttons to change other colors of the diagram: Fill – to change the background color, Pen – to change the color of drawing (lines and text), Grid – to change the grid color (it's a good idea to choose it close to the background color).

 Press the button Averages to open a new window for adjusting MSD(T) ranges of averages to be shown by different colors on P-T diagrams (if all the results are showing). Averages are colored if the Use colored MSD ranges option is checked. You can use checkboxes placed at separate items in the list of ranges to show/hide them on diagram. Edit integer maximum temperature MSD value before adding new range (the Add button) or modifying of existing range (the Edit button). Press the Delete button to remove selected range from the list.

Averages
 Check the Show checkbox at the top to display or hide average values of all types on the diagram. The Ranged checkbox turns on/off usage of different colors for distribution of TWQ averages' on different MSD ranges and of "simple averages" according to their "Scatter" values. If this checkbox is checked, the program shows additional color legends at the diagram corners. Check the B/W checkbox to apply grayscale palette (instead full color one) for printing or for publications. You may also wish to apply Inversed color palette on diagrams.

TWQ averages
Their points are represented by small circles or by MSD-crosses or ellipses (depending on the + and O states). You can also control the separate types of averages by corresponding checkboxes:

  1. All – averages based on the all intersections,
  2. 1.5s – averages based on the intersections lying within 1.5 of the MSD value,
  3. IR – averages based on the intersections of the linearly independent equilibria.

Their colors are taken from the common list. Change the Size parameter to set the point size in pixels (from 3 to 15). Check the Outline checkbox to show point outlines.

Simple averages
Options Show, Size and Outline are the same as for TWQ averages (see above).

Parameters
 You can change values for some kinds of diagrams by conversion of their units: check bar → kbar checkbox to divide Pressure values from plot-files by 1000, check Log(α) → α checkbox to plot activities instead of logarithmic values.

 Check the Numerate checkbox if you wish to numerate curves. Numbers are placed at the second or next to last nodes of each curve alternatively and may be invisible in the zoomed diagram only if all nodes of the curve lie outside diagram borders. You may also notice that the TWQ program plots curves from the maximum axes values (i.e. look for the odd numbers at the top and the right borders of diagrams and for the even numbers at the bottom and the left borders).

 Some curve nodes in TWQ plot-files lie extremely close to each other (at junctions?). This may cause artefacts in the exported graphics (looking like short strongly curved sections on curves). Therefore, it's a good idea to remove such unnecessary nodes from diagrams. Check the checkbox Remove close nodes to clean the curves at file loading. This operation utilizes a single adjustable parameter: minimum distance between curve nodes. This value depends on the axis range, therefore a fraction of axis range is used (parameter Div = Axis range / Minimum distance between nodes). 30-50 are good estimates for the most cases.

Show
 Use this 3 boxes to display or hide some elements of the diagram: Legend, Major grid and Minor grid.

 The program shows last visited directories at the bottom of the File menu. A maximum number of these directories is controlled by the Last dirs parameter. Allowed values lie within the range 3...30.

 Set values in editable fields: Titles – to set the font size for the axes' titles (in points), Labels – to set the font size for numerical values on the axes, Lines width – to set the width of all curves and axes (in pixels) within the range 1...4. You can specify the widths of individual curves in the Diagram window using the curve pop-up menu.


Lists of equilibria and components

 This window gives you access to individual equilibria by their equations and to the components taking part in the equations. You can move through the list of plot-files and browse only selected equilibria.

 Indexed equations appear in the list of equilibria. Numbers of plots precede indexes of equations if several plots are combined. You can use small check-boxes (placed at each equation) to show or hide their curves (or press the <Insert> key on the keyboard). Double clicking on an equation (or pressing the <Enter> key) makes nodes on its curve visible or invisible. The default node symbol is a circle. However, you can set another symbol and other curve parameters from the pop-up menu:

  1. Select – quick selection of equilibrium for its inspection (or cancel selection); selected equilibria are shown by bold magenta lines (irrespective of color settings);
  2. Change color – change color of the selected curve;
  3. Change width – change line width of the selected curve (within the range 1...4);
  4. Change symbol – change node symbols for the selected curve;
    Available symbols
    Circle – default
    Upright cross
    Diagonal cross
    Triangle (apex up)
    Triangle (apex down)
    Square
    Diamond
    Star (octactinal)
    Small dot (almost invisible in fact!)
  5. Save to a text file – save list of equilibria...
    • This plot – ...from the current plot to a text file EQ_???.TXT, where ??? is the name of TWQ file;
    • All plots – ...from all the listed TWQ files to a text file EQ_ALL.TXT.
  6. Save TWQ file as... – save the current TWQ file to a new file containing only checked equilibria.
 Use the Show all and Hide all buttons to switch on/off all equilibria, and the Invert button to show hidden curves and hide shown curves at once. Use the Show nodes and Hide nodes buttons to display or hide node symbols on each visible curve.

 With the list of components, you can hide equilibria containing specified components. For example, unchecking components A and B (by the mouse or by the <Insert> key) will hide all their equilibria, and the following pressing of the Invert button will show all equilibria containing these components. Double clicking on a component (or pressing the <Enter> key) will hide all equilibria without this component (that is equivalent to unchecking this component and pressing the Invert button). This list is sensible to the Show all, Hide all and Invert buttons, as well as to clicking on check-boxes at the equations.

 If some curves are hidden then the INTERSX.EXE program calculates averages only for shown equilibria. This feature is useful to exclude those sensitive curves that change their position dramatically even at minute variations of mineral compositions.


List of plot-files

 The Plot-files window has got two lists:

The list of plot-files
 The program fills this list with names of plot-files found in the current directory (to change the directory, you must load a plot-file from the Menu). You can easily move through this list (with the mouse or the keyboard) and browse highlighted files immediately plotted in the diagram window.

 Information lines from the loaded plot-files and average values (if available) are placed into the small window. The program can write there data from the compositional files if the Show CMP box is checked. Names of compositional files are stored in the plot-files. The program ignores paths of compositional files and tries to load them from the directory with plot-files.

 Numbers of plots precede the information blocks if several plot-files are combined. You can edit this text and copy/paste it (e.g. together with WMF graphics).

 Check the Combine box to overlay successively loading plot-files at browsing (up to 255 plots allowed), their information lines will be accumulated in the text window.

 The program applies the last used parameters of curves (set in the Diagram window and in the List of equilibria) to succesively loading plot-files (single or combined).

 Press the Refresh button to re-read the directory (e.g. if you calculated and added new files there while the TWQ_View program is working, or if you wish to restore the original scale of the Compositional diagram).

The list of extensions
 Use this list to add and remove the extensions of plot-files. Click on this list by the right mouse button to show the small pop-up menu: select the Add item in this menu (or double-click on the list) to add a new extension and the Delete) item to remove the selected extension. You can switch some of file types on/off temporarily (e.g. while browsing the results of the batch-mode calculations) with small check-boxes placed at each extension. All these actions cause refreshing of the file-list.


Compositional diagram (CMP-files)

 This diagram is the alternative to P-files generated by the CMP.EXE program from the TWQ package.

 TWQ_View searches for compositional files (e.g. CMP-files in the DOS versions of TWQ) in the directory with diagrams using the list of plot-files from the Plot-files window. The program re-plots this diagram after every refreshing of this list. Names of compositional files are stored in the plot-files. The program ignores paths of compositional files and tries to load them from the directory with plot-files. Each line in the list of plot-files has the corresponding column in the compositional diagram. These columns are labelled by the names of compositional files. If some of labelled columns are empty then file is expected but not present (in the current directory).

 The window consists of two parts:

Diagram
 You can zoom and drag this diagram like the main plot (however, only horizontal scrolling is allowed). The program applies cyclically colors specified in the Options window, or the standard 16 colors:

  1. Black
  2. Blue
  3. Green
  4. Cyan
  5. Red
  6. Magenta
  7. Brown
  8. Gray
  9. Dark Gray
  10. Light Blue
  11. Light Green
  12. Light Cyan
  13. Light Red
  14. Light Magenta
  15. Yellow
  16. White

 Symbols are taken from the list in the Diagram window. The program highlights columns of compositional files that correspond to the loaded plot-files by yellow bars.

Lists of phases and their variables
 In these two lists with check-boxes, you can select phases and their compositional variables (mole fractions of components or elements in the sites) to be displayed in the diagram. The program remember disabled variables (unchecked in the left list) in the TWQ_View.ini file. So, you can specify the permanent set of the most informative variables for each phase. Manipulations with whole phases in the right list has no influence on this set.

 The program removes square brackets and "minus" signs (-) from the names of variables recognized in the headers of compositional files. You can use your own names (for variables and for the phases): just edit the special file with replacements for abbreviations.

 There are three buttons below these lists. Press the Save X-scale button (after the zooming) to save the current horizontal scale. The program will use this value in the next runs (instead of automatic values). Press the Auto X-scale button to fit all the plotted files within the window (you can restore the manually selected scale by re-building of the list of plot-files: just press the Refresh button in the Plot-files window). Press the Reset colors button to re-assign colors and symbols ignoring disabled variables.


File with replacements for abbreviations (TWQ_VIEW.RPL)

 You may notice that many of abbreviations used in the TWQ package are not commonly accepted and even inappropriate (e.g. the symbol of the chemical element silicium "Si" is used for sillimanite). With TWQ_View, you can replace these abbreviations automatically: just edit the ASCII-text file TWQ_VIEW.RPL. This file is stored in the main program directory. It contains only the list of the replacements to be used instead of the abbreviations of substances and their compositional variables used in the TWQ package. Each line in TWQ_VIEW.RPL has the simple format:

n TWQ abbreviation=New abbreviation

where n is the variable code: 1 – solid solution name, 2 – component name, 3 - compositional variable.

 Length of new abbreviation must be no more than 6 characters.


Variables of the initialization file (TWQ_VIEW.INI)

 It's not necessary to edit this file in the most cases.
Variable | Meaning
PlotPath | The directory of plot-files, many lines may be present
LastDirs | Number of displayed last visited directories
Repository | The directory with commonly used diagrams
PathLength | The maximum length of the paths (to the TWQ directory and to your plot-files), commonly 20.
TWQDir | The path to the DOS version of the TWQ package
DOSBox | The directory with executable file DOSBox.exe (if this emulator has been installed, too)
ForceDB | Always use DOSBox emulator. Allowed values: "Y", "y", "1", "N", "n", "0"
TDB | The file name of the thermodynamic database, many definitions may be present
SLN | The name of the SLN-file (with the models of solid solutions) associated with the current TDB
CurrentTDB | The index of the current thermodynamic database
TWQPaused | Yes – don't close DOS-window after the INTERSX.EXE termination
ShowAVG | Yes – display averages on the diagram
xAll | Yes – display averages based on the intersections of the all equilibria
x15s | Yes – display averages based on the intersections lying within 1.5 sigma of their scatter
xIR | Yes – display averages based on the intersections in the set of the linearly independent equilibria
xCross | Yes – display averages as crosses (with MSD values), No – display averages as dots (or ellipses)
xEllipse | Yes – display averages as ellipses (with MSD values), No – display averages as dots (or crosses)
Extension | Extension of the plot-file, many lines may be present
AutoColor | Yes – assign curve colors automatically
Color | The curve color (a single-value representation of RGB triplet), many lines may be present
FillColor | The background color
PenColor | The color of drawings
GridColor | The grid color
MajorGrid | Yes – show the major grid
MinorGrid | Yes – show the minor grid
TitlesSize | The title font size
LabelsSize | The label font size
ShowLegend | Yes – show the legend
AutoAxes | Yes – estimate scales of the axes automatically
CleanClose | Yes – remove close nodes on the curves
MinDistDiv | Div parameter = Axis range / Minimum distance between nodes
LinesWidth | Width of all lines (and the default width of curves)
Bar2kbar | Yes – divide bars by 1000
Log2a | Yes – use activities instead of their logarithmic values
LabelSepX | Horizontal separation of labels (%)
LabelSepY | Verical separation of labels (%)
Numerate | Yes – numerate curves
AddCMP | Yes – add data from CMP files to the text information
CMPScale | The default scale of the horizontal (X) axis (0 – automatic)
dTRanges | Definitions of colors for averages with different MSD values on diagrams with horizontal temperature axis, pairs of integer maximum MSD values for temperature and color values separated by spaces
ColoredAvg | Yes – use different colors for averages on P-T diagrams (if all averages are shown)
WtSmpAvg | Yes – use weighting of distances at calculation of simple averages
AvgSize | Size of "Averages" points (integer from 3 to 15)
AvgOut | Yes – draw black outlines of "Averages" points
SmpAvgSize | Size of "Simple averages" points (integer from 3 to 15)
SmpAvgOut | Yes – draw black outlines of "Simple averages" points
AvgBW | Yes – use grayscale instead fullcolor palettes for averages
ChkUpdates | Yes – perform automatic checking for updates
CUPeriod | Period of auto-checking for updates (0 – daily, 1 – weekly, 2 – monthly)
LastUpdate | Date and time of the last checking for updates
Desktop | Saved positions and sizes of the program windows:
ShowEquil | Yes – show the "Equilibria" window at the start of the program
ShowFiles | Yes – show the "Plot-files" window at the start of the program
ShowCMP | Yes – show the "CMP-files" window at the start of the program
ShowOpt | Yes – show the "Options" window at the start of the program
MainTop | Main – the vertical coordinate of the top-left corner
MainLeft | Main – the horizontal coordinate of the top-left corner
MainHeight | Main – the height
MainWidth | Main – the width
FileTop | "Plot-files" – the vertical coordinate of the top-left corner
FileLeft | "Plot-files" – the horizontal coordinate of the top-left corner
FileHeight | "Plot-files" – the height
FileWidth | "Plot-files" – the width
OptTop | "Options" – the vertical coordinate of the top-left corner
OptLeft | "Options" – the horizontal coordinate of the top-left corner
EquTop | "Equilibria" – the vertical coordinate of the top-left corner
EquLeft | "Equilibria" – the horizontal coordinate of the top-left corner
EquHeight | "Equilibria" – the height
EquWidth | "Equilibria" – the width
CMPTop | "CMP-files" – the vertical coordinate of the top-left corner
CMPLeft | "CMP-files" – the horizontal coordinate of the top-left corner
CMPHeight | "CMP-files" – the height
CMPWidth | "CMP-files" – the width
AvgTop | "Averages" – the vertical coordinate of the top-left corner
AvgLeft | "Averages" – the horizontal coordinate of the top-left corner
AvgHeight | "Averages" – the height
AvgWidth | "Averages" – the width
FindTop | "Find" – the vertical coordinate of the top-left corner
FindLeft | "Find" – the horizontal coordinate of the top-left corner
Phase | Phase definition (abbreviation), many definitions may be present. You must check (and correct) the abbreviation if it was replaced in the TWQ_VIEW.RPL file.
Cfc | Phase variable definition (name of the coefficient) and its visibility, many definitions may be present. You must check (and correct) the name if it was replaced in the TWQ_VIEW.RPL file.


Restrictions and problems

 Restrictions in TWQ_View:

  1. You can run only the old DOS version of the INTERSX.EXE program from the program menu (this is especially important for the batch mode operations). However, you can also operate results produced by the Windows version of the TWQ package.
  2. Only short abbreviations (up to 6 characters) are allowed in equilibria equations, full names of components are prohibited.
  3. Compositional files, plot-files and averages must be in the same directory if you wish to use compositional diagrams and to plot averages.
  4. Lengths of paths to TWQ package and to user files should not exceed 20 characters (including terminating backslash "\") according to TWQ rules. However, this restriction does not apply if the DOSBox emulator is used.
  5. Curves in the diagrams are not labelled by their equations: it's very difficult to implement correct and nice automatic labelling for diagrams with many curves (without symbols in a terrible mess). So, the only way is to use an editor for vector graphics and type equations on the diagrams manually. Though, you can numerate the curves and access the equations of the certain curves by clicking on them (or find the curves of the certain equations from the List of equilibria as well); curves may have different colors, symbols and width; the legend is also provided.
  6. If Log(α)→α conversion is applied then only a single average MSD is typed in the information windows. Though, crosses on the diagram must be plotted correctly.

 I've encountered the next non-critical problems in TWQ_View (some of them are possibly relating to functionality of the used version of the TeeChart component that came with ©Borland Delphi 7 language):

  1. Sometimes minimum and maximum values of axes jump a little in the diagram after the editing in the Options window (re-enter values or press the Reset buttons in the Options window to correct this problem);
  2. Sometimes un-zooming with a mouse doesn't work properly (re-enter values or press the Reset buttons in the Options window to correct this problem);
  3. At integer minimum and maximum values of the X-axis (e.g. at xCO2=0.00–1.00 in corresponding diagrams) the labels arrange too densely and overlap. I've tried to fix this problem by subtraction/addition of 0.00001 from/to the minimum/maximum axis values;
  4. Lines behave very strangely (disappear and duplicate) at high zoom ratios: don't over-zoom diagrams!
  5. Two linearly independent equilibria and other curves that represent linearly dependent stoichiometric equations must intersect at a single point, theoretically. However, you'll see a noticeable scatter of such intersections in zoomed diagrams due to the next two reasons:
    1. The program approximates lines by straight segments between TWQ-calculated nodes instead of true curves (e.g. splines). By the way, smoothed curves will cause other problems: too slow output of diagrams and too complicated WMF-exported graphics.
    2. In general, nodes must be TWQ-recalculated on the spot and lie denser on a zoomed curve (to minimize approximation deviations from the true curve position). This is the problem of the whole TWQ package structure.
  6. The commands "pen up" and "pen down" in plot-files are not supported: TWQ_View always join separate parts of the broken curves.
  7. Problems in WMF-exported drawings:
    1. Ticks at the vertical axis are shifted a little to the left.
    2. For the ©CorelDRAW! users: unfortunately, curves are represented by separate lines instead of polylines. You may wish to combine them, join nodes manually, convert to smooth nodes and, finally, simplify the curves (to reduce dramatically the number of nodes). Besides, this operation may solve (partly) problem 5.1.
    3. Some curve nodes in TWQ plot-files lie extremely close to each other (at junctions?). This may cause artefacts in the exported WMF graphics (short strongly curved sections on the curves). I've solved this problem by removing extra-nodes (see description of the Options window).
    4. You can find that dense points in the exported and zoomed WMF-graphics follow some regular grid. This is not the bug but the intrinsic feature of the WMF graphics (its scale is very discrete and corresponds to positions of pixels on the screen). Expanding diagrams before copying should increase the precision.


References

The main TWQ publication:
Berman R.G., 1991. Thermobarometry using multiequilibrium calculations: a new technique with petrologic applications. Canadian Mineralogist, v. 29, pp. 833-855.

Links:
TWQ site


Simple averages

 "Simple averages" are the points with shortest root-mean-squared distances (or RMSD) to all the lines of reactions:

 "Simple average" resembles averages calculated by the INTERSX (or winTERSX) program from the TWQ package of R.G. Berman, T.H. Brown, E.H. Perkins and J. Ellwood, however these values have some important differences:

  1. "Simple average" is based on pure geometric considerations without any thermodynamic data while INTERSX (from the TWQ package) calculates averaged values with weighting of intersections relative to modified equilibrium constants, entropy and volume effects of reactions (and angles between reaction lines). NB! Ignoring the thermodynamic parameters makes "simple averages" less correct, especially if lines of reactions are poorly converged. Therefore it is worth to apply "simple averages" only if thermodynamic parameters of reactions unavailable, if you want to compare numerically the quality of results obtained by different methods, or just as express-method for checking the scatter of reaction lines.

  2. Evaluation of "simple average" includes calculation of distances on XY plane, therefore it uses scaling of axes and produces a single RMSD value (which should be regarded dimensionless). INTERSX calculates two separate values of mean square weighted deviations for the both axes. Though, INTERSX also performs scaling of axes, e.g. to estimate angles between lines (for filtering of intersections and for their weighting). Probably, scaling in INTERSX depends on particular ranges of the axes (you can find this by differences of results), while "simple averages" are based on fixed (user-specified) scaling allowing comparison of RMSD values for diagrams plotted with different ranges of axes. For example, you can select multiplier "50" for the "P,kbar" axis to make values uniform on typical PT diagrams used for crustal metamorphic conditions (e.g. 400-900°C and 1-11 kbars). This multiplier can also be justified more rigorously:

    • dividing of T and P values by typical uncertainties of their determination (say, 20° and 0.4 kbar for crustal rocks) will produce the same dimensionless axes;

    • ratios of V0f(J/bar) and S0f(J/K) parameters (used in the expression ΔG=ΔH-T×ΔS+(P-1)×ΔV) for the most of minerals have the same order of values 0.004-0.006 (or ≈50 after conversion to kilobars).

  3. Minimization of distances to reaction curves used for "simple averages" makes solutions more stable than averaging based on intersections. The program performs linear extrapolation of reaction curves outside XY window if necessary. RMSD values are easy to calculate, this function is strongly convex (in the most cases) and can be effectively minimized by commonly used algorithms: