Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ îðèãèíàëüíîãî äîêóìåíòà : http://www.geol.msu.ru/deps/geochems/soft/en/Main.doc
Äàòà èçìåíåíèÿ: Tue Feb 11 19:24:55 2014
Äàòà èíäåêñèðîâàíèÿ: Thu Feb 27 23:32:03 2014
Êîäèðîâêà:


HCh for Windows (version 4.5). Program Main

Contents

General comments 2

The purpose of the program Main 2
Main for Windows compared to Main for DOS 2
Changes in Main functioning 2
New functionality of Main for Windows 2
Localization 3
Folders used by Main 3

Graphical user interface of Main for Windows 3

The main window 3
Controlling the program using keyboard and mouse 4

Working with Main for Windows 6

Versions of the program, data bases, and Files 6
File Menu 6
Gibbs Menu 7
Gibbs options available from Main 8
Options Menu 10

Preparation of the source files for Gibbs 11

System files 12
Blank files 15
Input files 18
Control files 21

Working with calculation results 24

Result files 24
ASCII files (text files) 27

General comments

The package HCh for Windows is an analogue of HCh for DOS. HCh for Windows
supports almost all the features offered by its DOS prototype. In
developing this package we strived to preserve compatibility of the two
package versions in terms of the data files and their formats, as well as
the program user interface. This should ease your upgrading from the DOS
version of the program. When migrating to the Win32 platform, you should
remember that HCh for windows is completely backwards compatible with the
previous versions of the package in terms of the data files; thus, you can
re-use all the files created with the DOS versions of the package. The only
limitation is that all the files of your specific project must be located
in the same folder.


The purpose of the program Main

The program Main integrates the rest of the HCh components (the Unitherm
database system and the Gibbs program for calculation of chemical
equilibria) into a unified software package. It allows you to calculate
equilibrium states of physico-chemical systems and complete equilibrium
thermodynamic modelling of chemical processes, including irreversible ones.
Proper calculations of chemical equilibria are completed by the program
Gibbs which is called by the program Main when required, and all the
thermodynamic properties of substances that are necessary for these
calculations, come from the Unitherm database. Thus, for the normal
functioning, the program Main requires both mentioned components.

The program Main is used in an interactive mode. The main functions of Main
are as follows
1. Preparation of the files describing the physico-chemical system and the
modelled processes
2. Calling Gibbs for completing thermodynamic calculations
3. Examination and processing of the results of calculations completed by
Gibbs


Main for Windows compared to Main for DOS



Changes in Main functioning

1. The command-line options of Main have been abandoned. All the
functionality previously offered by these options is now implemented via
the program menu and can be accessed without the necessity to restart
Main. In particular, you can intermittently work with different projects
during the same program session.
2. The user interface of the program has been somewhat changed. Instead of
separate menus intended for work with different file types of the program
Gibbs (System, Blank, Input, Control, Result), there is now one common
menu File that allows choosing the necessary file type. Buttons located
within the main program window launch the commands executing operations
with these files.
3. All the files relevant to the same project can now be kept only in the
same folder relevant to the project. In other words, the option CDir
Request of the DOS version is abandoned. Also, the program does not
support the following options of the DOS version: Set Shown Files, Set
Delay Times, Set Paths, Set Colors, Set Defaults - as they are not needed
any more.
4. You can launch HCh from the Windows Start menu, using the command Run,
or with a shortcut placed on your Desktop or in any other location. In
any case, the startup folder is always the folder containing the Main
program (and other program components of the HCh package). Upon the
normal completion of the program session, Main automatically writes the
initialisation file Main.ini into the startup folder; this file contains
the path to the Working folder. Thus, the next Main session starts from
the same project that was used on the completion of the last program
session.


New functionality of Main for Windows

1. A new option for creating source files for program Gibbs (System, Blank,
Input, Control). This kind of creating is invoked by the Rebuid command.
The Rebuid command allows you to use any of the existing files of the
chosen type as a template for creating a new file. You can use this
command to delete or add chemical elements, phases, or solution
components. Note that to edit the properties of the system components (in
particular, non-ideality models), you must use the command Edit.
2. An option to specify several copies of the same solid or liquid
solution, and a gas phase is introduced. This option allows explicit
modelling of immiscibility phenomena in non-ideal solutions.
3. Another type of a diagonal cross-section for the analysis of the result
files (Result) that might be required for some non-standard models has
been added.
4. The command Export for the Result files that allows to import a whole
result file by the Excel program, compared to importing selected cross-
sections.


Localization

The HCh package, including the Unitherm program, is not "international
software". There are no provisions for language customisation of the
graphical interface and data formats. The language of the GUI is English.
It was assumed by the developer that English would be used for recording
the rest of the necessary textual information as well, as the English
alphabet (ASCII) is present in most locales. However, the programs of the
package can run on localized computers if the local language uses recording
from the left to the right and is coded by one byte per symbol.
If you are a user of a localized computer, you might want to enter text
information (e.g., names of the solutions, systems, and models) in your own
language. However, this is advisable only if you are sure that you will not
exchange your data with owners of computers with other localizations. In
the latter case, maintain your database(s) in English. This restriction
stems from the fact that the files of the HCh package do not store
information about the language in use, text encoding (beyond ASCII), and
other details of your localization.


Folders used by Main

Program Main uses files that reside in three folders. The graphical user
interface (GUI) of Main and this manual refer to these folders as follows.
1. The Startup folder. This folder contains the program Main and the rest
of the HCh program components. This folder is defined during HCh
installation and cannot be changed by the user. As a rule, you do not
need to touch these files.
2. A Working folder. Within this folder, you will create the files defining
systems and processes for your project. The same folder will contain the
calculation results produced by Gibbs for the current project. This
folder is defined by the user at his own discretion with one exception:
you should not use the Startup folder as your working one. When working
with Main, you can change your Working folder at any moment, switching
from one project to another.
3. A Unitherm folder. This folder contains your current database of
thermodynamic properties of substances. This database is created and
maintained by the Unitherm program. The database is used by Main to
define a set of accessible chemical elements and the basic properties of
the substances (including their stoichiometry) available for the current
project. The program Gibbs uses this database to obtain thermodynamic
properties of the system substances that are used for calculation of
chemical equilibria. Working with Main, you can change a Unitherm folder
at any time, switching from one database to another. However, you should
remember that the program does not necessarily correctly interpret files
created on the basis of a particular database when you use another
database (e.g., you can have non-matching list of available substances or
even chemical elements). Thus we recommend binding each project (each
Working folder) to its particular thermodynamic database (its particular
Unitherm folder) using the Save Settings command from the Options menu.
If a project is not bound to its own database, Main uses the standard
Unitherm database as the default one.


Graphical user interface of Main for Windows



The main window

During the whole working session with Main, you are displayed with the Main
program window that contains the Menu bar, the line of the current paths to
the Working folder (left) and to the Unitherm database (right), the list of
files of the current type, the working pane, and the program status line.
You can enlarge the size of the Main window if you like, but you cannot
make it less than the original default size.
Main has the following menus.

|Menu |Scope |
|File |Commands to open files or specify file types for |
| |immediate work |
|Gibbs |Commands to launch modelling (the Gibbs program) |
|Options|Setting folders and modes for program Main |
|Help |Information about the program |

The access to the menu items is conventional (i.e., using the mouse or
keyboard). To use the keyboard, press the Alt (or F10) key followed by
arrow keys or designated "hot" keys (or, as usual, you can use
Alt+Spacebar). If you have activated a menu, but do not need it, press Esc
or F10 to return to the normal mode.
Note: In specific cases, the Alt key is reserved by the program for other
purposes (see the tips in the program status line). In this case, to
activate the menu use F10.
Immediately below the menu bar there is a line displaying the current paths
to the Working folder (left) and to the current Unitherm database (right).
You can change these paths either (1) via the appropriate command of the
Options menu, or (2) by double-clicking the appropriate part of the line of
the current paths.
The left part of the main window of the program Main displays the list of
the currently accessible files of the current Working folder. The displayed
files are filtered for a specified file type that is checked in the Files
menu and is also displayed in the first field of the program status bar
(the bottom line of the Main window). You can make a file active by
clicking it, and open a file by double-clicking it. An active file is
highlighted by a colour bar plus, when the file list has focus, by a dashed
frame. In the latter case you can navigate within the file list using the
keyboard. Arrow Up and Down keys (as well as the mouse wheel) will allow
you to navigate within the file list, and Arrow Left and Right keys -
within the list of the file types (from System to ASCII). Pressing Enter
will open an active file and pass the focus to the working pane.
Below the file list there is a set of buttons to activate commands
permissible for a current file. A command is disabled if, for the current
status of the file, the operation is not possible. For example, you can
print only an open file; thus, this command is disabled till you open the
active file. The current status of the file is displayed in the second
field of the program status bar.
The right principal part of the window contains the main working area of
the program (the working pane). It displays either (1) the metadata for the
active file, or (2) the content of the active file. The working pane can
contain a significant volume of data and has scroll bars to facilitate the
data examination and editing. The work mode for the working pane depends on
the currently chosen command and is described in detail in the appropriate
sections below.
The bottom of the Main window contains the program status bar. Its first
field displays the current type of an active file, the second field - the
current mode of the work window that depends on the chosen command, the
third (the widest) field - tips on additional options for controlling the
current command. These options are described in detail in appropriate
sections below. The last field of the status bar ("Ins") shows the current
mode of the keyboard: the black colour indicates the insert mode, and the
grey colour indicates the replacement mode.
Information on other windows of Main or other modes of the Main working
pane is provided for the description of the appropriate commands.


Controlling the program using keyboard and mouse

Whenever possible, the principles of Main for Windows were kept close to
the principles implemented in Main for DOS. This includes the sequences of
actions required to complete a particular task, the forms of the dialogs,
and their responses to keys pressed by the user. Besides the keyboard, you
can control the program using the mouse (in some cases this may be more
convenient). Below we list the main rules for usage of the keyboard, mouse,
and graphical user interface as adopted in Main for Windows.
1. Windows with the title bar containing the Close button can be closed by
clicking this button with the mouse (the keyboard shortcut is Alt+F4). In
this case, the window will be closed without additional dialogs (closing
the main window will terminate the program session). If you close an
editing window this way, all the changes you have made while editing will
be lost (this is a "quick" way to cancel editing).
2. If you want to close the window and save the changes, you should use the
Esc key. In the subsequent confirmation dialog you will also be able to
cancel the results of editing - this is the "normal" way to close an
editing window. If, when using the Close button, you close a message that
has only the OK button, then closing the window will be equivalent to
clicking the OK button (i.e., in this case Alt+F4 = Esc = Enter =
Spacebar). If the window being closed is a dialog-question that has
several conventional buttons for different responses, then a forced
closing of this window will be equivalent to clicking the Cancel button
or pressing the Esc key (i.e. in this case Alt+F4 = Esc).
3. When editing files, there are cases when you must fill in or change
several entry fields. For editing any input field, you can use the
following keys: Backspace, Delete, Insert, Home, End, and Left and Right
arrows. You can use standard Windows tools for selecting, cutting,
copying, and inserting text (you can do the same by using the mouse, for
example, by activating the local menu). A specific feature of HCh is the
Backspace key: if you press it in the first position of the input field,
it will clear the whole field; the Ctrl+Backspace combination will clear
the input field starting from the current position. To finish editing of
the current field and move to the next field (in the logical order),
press Enter; the editing window will remain open. You can use the Up and
Down arrows and PageUp and PageDown keys to change vertically aligned
input fields within the same editing window. If the input fields are
arranged in several columns, you can use the Tab (to move to the right)
and Shift+Tab (to move to the left) keys to change the columns. You can
use the mouse to change an editing field - just click a required field.
4. When completing the New and Rebuild commands for the files of the System
type, you will be presented with lists of components of the Unitherm
database in the Selection mode. In this mode, the current item list is
marked with a dotted frame, and the colour highlights the selected list
items. In this mode, changing of the current list item using the keyboard
is completed as usual; using the mouse, you should click a new item with
the right button. The left mouse button is used for highlighting
(selecting) an item, or removing it from the selected set; the left
button will not change the position of the current item. Using the
keyboard, you can highlight the current item list by pressing the Insert
or Spacebar keys. Highlighting any of the items will not change the
status of the previously selected items. Unitherm works in the same way
as standard Windows programs when holding the Ctrl key. If it is
necessary to select a number of the list elements in an immediate
sequence, you can select the first one and then the last one with the
Shift key. When you select elements of the lists or the whole groups, a
selection inversion always takes place (i.e., the selection of the
previously selected elements within the new group will be cancelled). You
can use the following keys for additional options:
. Ctrl+A - allows selection of the whole list disregarding its previous
state and the position of the current element
. Pressing "+", "-" and "*" allow to simultaneously change the state of
the all the list elements from the current element to the end of the
list (e.g., "+" - select all, "-" - deselect all, "*" - invert all)
Details on controlling other elements of the GUI are discussed in sections
on particular program functions.


Working with Main for Windows



Versions of the program, data bases, and Files

From time to time, in the process of the ongoing HCh development, formats
of the Unitherm database records and of the files containing the initial
data and the Gibbs calculation results are changed. Any version of the HCh
package is backward compatible with the earlier versions of the database.
At the same time, it is not possible to predict future changes in the
format of the database records. Thus, no version of the Main program is
allowed to use the data written by a program with a higher version number.
To ensure the correct compatibility between the versions of the programs of
the HCh package, the following rules are adopted:
1. Each database and each data file has the version number matching the
version number of the program that created this file.
2. Main (as well the other programs of the package) can read any databases
with a version number not exceeding its own, but it can create files only
with its own version number.




File Menu


|Command |Description |
|Open. |Opens the HCh file specified in the subsequent dialog. The |
| |content of the opened file is displayed in the working pane,|
| |and the keyboard focus is set on the working pane. This |
| |command is the only one that allows you to choose the file |
| |from the folder other than the Working folder. This command |
| |combines the functions of changing the Working folder, the |
| |current database, the program working modes (if the new |
| |Working folder contains the initialisation file Main.ini), |
| |the current type of the files, and of the opening of the |
| |specified file. The rest of the commands of the File menu |
| |(except for the last one, Exit) only change the current type|
| |of files, keeping the Working folder and the program working|
| |modes unchanged. |
|System |The commands of this group change the types of the files |
|Blank |accessible via the displayed file list. The new file type is|
|Input |displayed in the first field of the status bar at the bottom|
|Control |of the Main window. The keyboard focus is set on the list of|
|Result |files. None of the files from the list is open. The working |
|ASCII |pane displays brief information about the current file from |
| |the list (the second field of the status bar displays the |
| |"Info" flag). The set of the buttons below the file list |
| |displays the commands appropriate for the chosen file type. |
| |When you change the type of the files, this set is modified |
| |accordingly. The default command is the Open button; thus, |
| |the current file is opened by pressing Enter (or, by double |
| |clicking the filename). The details on working with the |
| |particular file types are provided in the specific sections.|
| | |
| |When the file list gets the focus, you can also change the |
| |file type by pressing the Arrow Left or Arrow Right keys. |
|Exit |Completes the working session without confirmation. You will|
| |get the same result by clicking the Close button of the |
| |Title Bar of the program window, or by pressing Alt+F4. |


Gibbs Menu


|Command |Description |
|Source |This command opens the dialog for choosing the file that |
|file. |will be passed to the Gibbs program at its launch. This file|
| |can be chosen only from the Working folder. There are three |
| |possible source files: Blank (*.bl), Input (*.in), and |
| |Control (*.ct). If you have not specified the source file |
| |before, the Run Gibbs command from the same menu is dimmed |
| |(not accessible). If the Run Gibbs command is accessible, |
| |than the source file has been already specified (either |
| |earlier in your working session, or from the Main.ini file).|
| | |
| |If you need to check the name of the previously specified |
| |source file, you can use the same command - the current file|
| |will be offered as a source file by default. The name of the|
| |source file set by this command can be included in the |
| |Main.ini file of the given Working folder (see the Save |
| |Settings command from the Options menu). |
|Gibbs |This sub-menu contains two commands that allow you to set |
|options |options of the program Gibbs that will be used on the |
| |subsequent Gibbs launches using source files of the Blank |
| |and Input types. There are two groups of Gibbs options: (1) |
| |the options setting the computation modes (Computing.) and |
| |(2) the options setting the content of the output data |
| |(Listing.). Options of the each group are displayed in their|
| |own dialogue window convenient for browsing and |
| |modification. Options of the other group, not presented in |
| |the current dialogue in the detailed view, are summarised in|
| |the bottom line of the dialogue for your information. The |
| |complete list and description of all the computing options |
| |are provided in the documentation for the program Gibbs. The|
| |subset of Gibbs options available from the Gibbs Options |
| |menu of Main is described below. |
| |The set of the Gibbs options specified by these commands can|
| |be included in the Main.ini file of the given Working folder|
| |(see the Save settings command of the Options menu). |
|Run Gibbs |This command is accessible if you have specified the source |
| |file for the Gibbs program (see above). The command launches|
| |Gibbs, passing to Gibbs the input file set by the Source |
| |file command; the program modes are specified according to |
| |the Gibbs options commands. After launching Gibbs and till |
| |the completion of the Gibbs session, you will interact with |
| |the program via its own interface that is not considered in |
| |this document. Gibbs will write the results of its |
| |calculations in the same folder that contains the input |
| |files (i.e., in the current Working folder). Thus, to avoid |
| |conflicts, the Main program is blocked till Gibbs completes |
| |its work and returns control to Main. On completing the |
| |Gibbs calculations, Main updates the list of the files of |
| |the Working folder, and you can continue working with Main. |
| | |
| |Note: You can use an alternative way of launching Gibbs; |
| |this way does not require initial setting of the source |
| |file. In this case, Gibbs can be launched by double-clicking|
| |the open source file displayed in the working pane. Main |
| |will retain the name of the source file as if it was set by |
| |the Source file command. |



Gibbs options available from Main


|Option |Description |
|Computing options |
|Compute |Sets the mode of sequential computing. When you set this |
|sequentially |option, the program uses the equilibrium composition |
|(/s) |obtained at the previous step as an initial approximation|
| |for the next step. This makes computations faster if the |
| |differences between total system compositions are small. |
| |Without this option all the compositions are processed |
| |independently. Do not set this option if the |
| |compositional differences between computation steps are |
| |significant. |
|Substitute |Sets the mode of substitution of the internally |
|energy/act.coe|calculated free energies and/or activity coefficients of |
|f. (/g) |specified components by the values specified in an *.stg |
| |file. If the *.stg file is not found in the same |
| |directory as the corresponding *.st file, the /g option |
| |will be ignored without any warning messages. |
|Attach |Specifies that the program must use external modules for |
|external |calculation of activity coefficients for some of the |
|modules (/em) |solutions of your chemical system. |
|Calculate |Requires calculation of the volume of the entire system |
|system volume |in its equilibrium state. This option will be set |
|(/v) |automatically if you set the option "Add phase volumes to|
| |the listing" in the Listing options (see below). |
|Compute |Sets the mode for calculation of the saturation indecies |
|saturation |of undersaturated individual phases. The saturation |
|indexes (/si) |indecies will be represented on a logarithmic scale. |
| |Thus, they are identified by their negative values. |
|Ignore T-P-D |Allows you to ignore the T-P-( limits for aqueous species|
|restrictions |imposed by the HKF model. |
|(/ie) | |
|Wagner-Pruss |Forces usage of the Wagner-Pruss model for the pure water|
|model (H2O) |properties instead of the Haar-Gallagher-Kell (default) |
|(/wp) |model. |
|Bandera-Lvov |Forces usage of the Bandera-Lvov model for the water |
|model (OH-) |dissociation constant instead of the Marshall-Franck |
|(/bl) |(default) model. |
|Fernandez & |Forces usage of the Fernandez et al. model for the |
|al. model |dielectric constant of water instead of the |
|(eps) (/ew) |Johnson-Norton (default) model. |
|b-gamma value |Sets the extended parameter of the Debye-HÝckel equation |
|or electrolyte|equal to . |
|number |Alternatively, sets the extended term parameter of the |
|(/c= or|Debye-HÝckel equation equal to b-gamma value for the |
|/c=#{1|2|3|4})|specified background electrolyte (Oelkers and Helgeson, |
| |1990) (1=NaCl, 2=NaOH, 3=KOH, 4=KCl) and to replace all |
| |the default ion size parameters (Å) with the ion size |
| |parameters calculated for the given electrolyte (Shock et|
| |al., 1992). See Appendix 3 of the initial (DOS) |
| |documentation for details. |
|Setchenow |Sets the same SetchÈnow coefficient for all the neutral |
|coef. or |species equal to . |
|scheme number |Alternatively, specifies the algorithm for reading and/or|
|(/b= or|calculation of SetchÈnow coefficients of neutral aqueous |
|/b=#{0|1|2|3})|species. See Appendix 3 of the initial (DOS) |
| |documentation for details. Setting /b=#0 specifies |
| |b-SetchÈnow = b-dot. |
|Number of |Specifies the number of digits of the required accuracy |
|digits |of calculations (the value is used by the program as a |
|(/{3|4|5|6|7|8|control condition to terminate iterations). The default |
||9}) |value is 6. Use this option only if the default setting |
| |causes calculation problems. |
|Low accuracy |Sets the Low accuracy mode. |
|(/la) |Use this option only for experimentation when you have |
| |convergence (calculation time) problems. |
|Listing options |
|Print list of |Prints list of options used in the current run in the |
|options (/i) |last listing line. |
|Print time |Prints the computation time in the last listing line. |
|elapsed (/t) | |
|Add phase volumes|Prints volume of each phase at equilibrium. |
|(/pv) | |
|Exclude |Limits the program output only to bulk compositions of|
|speciation (/x) |equilibrium solutions. |
|Full species |Prints full names of species from the Unitherm |
|names (/fn) |database including comments. |
|Print lg(act.) |Outputs logarithms of activities instead of activity |
|(/lga) |coefficients. |
|Units used for |Specifies a unit for output of bulk compositions: mol |
|bulk comp (/o=.) |(default), mmol, kg, g, mg, mkg. |
|Represent |Represents elements in bulk compositions as absolute |
|elements in. |quantities (default) or concentrations: weight |
|(/o=@.) |fractions for weight units (see immediately above), |
| |molar fractions for molar units (all phases except for|
| |the aqueous solution), and specified units per 1 kg of|
| |water for the aqueous solution. |
Options Menu


|Command |Description |
|Working |Allows you to change the Working folder (the folder |
|directory... |containing all the files relevant to the given project).|
| |In other words, this command allows you to change your |
| |projects. On choosing the command, the Change working |
| |directory dialogue is displayed; its right pane lists |
| |all the HCh files from the folder that is defined by the|
| |two left fields - lists of disks and folders. The right |
| |pane is not intended for choosing files; it is shown |
| |only for the convenience of navigation. The change of |
| |the Working folder takes place only by clicking |
| |(pressing) the OK button; the Working folder is not |
| |changed if you close the dialogue by the Close or Cancel|
| |buttons (or by pressing Esc). After changing the Working|
| |folder, the program will check the new folder for the |
| |presence of the Main.ini file. If this file is found, |
| |the program reads its content and sets the appropriate |
| |modes (in particular, sets the new path to the Unitherm |
| |database). If this file is missing, the program sets the|
| |default modes (in particular, it will use for the |
| |project the default thermodynamic database). The new |
| |paths for the Working folder and the database are |
| |displayed in the paths line located immediately below |
| |the menu line. |
| |Note: Also, you can invoke this command by |
| |double-clicking the name of the Working folder in the |
| |left part of the paths line. |
|Unitherm |Allows you to change the Unitherm database used for |
|database... |calculations and preparation of the files for the |
| |current project. After the launch of the command, the |
| |Change Unitherm directory dialogue is open; its right |
| |pane lists all the Unitherm files from the folder that |
| |is defined by the two left fields - lists of disks and |
| |folders. The right pane is not intended for choosing |
| |files; it is shown only for the convenience of |
| |navigation. The change of the database takes place only |
| |by clicking (pressing) the OK button; the Unitherm |
| |folder is not changed if you close the dialogue by the |
| |Close or Cancel buttons (or by pressing Esc). The new |
| |path to the database is displayed in the paths line |
| |located immediately below the menu line. If you choose |
| |the folder that does not contain a Unitherm database, |
| |the program will display an error message, the specified|
| |path in the paths line will be greyed, and all the |
| |commands of he Main program that require the use of the |
| |database will be disabled. |
| |Note: Also, you can invoke this command by |
| |double-clicking the name of the Unitherm folder in the |
| |right part of the paths line. |
|Print to file |Sets and cancels the mode when all the program output |
| |invoked by the Print command is directed not to the |
| |printer, but into the HCh.prn text file located in the |
| |Working folder. This mode is identified by the check |
| |mark next to the command name. To cancel this mode (to |
| |restore the default printing), choose this command again|
| |(i.e., remove the check mark). |
| |Note: As the HCh.prn file is appended, you should |
| |monitor the size of this file if you use the Print to |
| |file option permanently. |
|Save settings |Writes the Main.ini initialisation file into the Working|
| |folder, including in it the following current |
| |information: the path to the Unitherm database used for |
| |the given project; the mode of printing to file; the |
| |source file and the line of options set by the |
| |appropriate commands of the Gibbs menu. In further runs,|
| |this information will be automatically used for |
| |tuning-up the project each time you open this Working |
| |folder. |
|Restore |"Manually" restores the project modes previously saved |
|settings |by the Save settings command. This is useful when you |
| |change the project modes only temporarily (e.g., |
| |experimenting with an alternative database). The command|
| |is not accessible (dimmed) if the Main.ini file is |
| |missing from your Working folder. |


Preparation of the source files for Gibbs

The key purpose of the Main program is to create and maintain files
containing the information required by Gibbs for completing thermodynamic
calculations. There are four types of these files, describing the modelled
chemical system or the modelling process itself: System, Blank, Input, and
Control files. All of these files are input files for Gibbs.

The following table describes the files required for modelling.

|File |Extensio|Purpose |
|type |n | |
|System |*.st |Definition of a physico-chemical system in terms of |
| | |independent and dependent components of the system, a |
| | |set of possible phases, and some of their thermodynamic|
| | |properties. These files contain stoichiometric data for|
| | |all possible components of the system and some |
| | |additional data such as ion charges and ion size |
| | |parameters, SetchÈnow coefficients for neutral aqueous |
| | |species, and parameters for gaseous, liquid and solid |
| | |solution models. |
|Blank |*.bl |Definition of the input data and their formats for a |
| | |system specified by a System file. These files define |
| | |the substances used for the description of the total |
| | |system composition(s) and the corresponding measurement|
| | |units, and methods to define the fugacities of the |
| | |perfectly mobile components in the case of open |
| | |systems. |
|Input |*.in |Definition of the particular total system |
| | |composition(s). You can specify up to 9 system |
| | |compositions according to the format defined in a *.bl |
| | |file. |
|Control|*.ct |Definition of the modelling algorithm. These files |
| | |contain the information necessary for automated |
| | |equilibrium calculations for a number of particular |
| | |system compositions specified in a *.in file. |

Each of the listed files can be used by Gibbs as a source file for
modeling, but Main can launch Gibbs only with files of the last three
types. Gibbs can be launched with the source file of the System type, but
only from other programs (e.g., written by you) if these programs support
the Automation (former OLE Automation) technology (see more details under
the description of Gibbs).


System files

In Main, the following commands are applied to the files of the type
System: Open, New., Edit, Rebuild., Print, and Export.

|Command |Description |
|Open |Opens an existing System file and displays its content |
| |in the working pane. The mode is identified by the word |
| |"View" in the second field of the status bar. |
| |Note: If you have opened the System file without |
| |specifying the database associated with the current |
| |project (or with an invalid database reference), the |
| |file will be shown without specifying the chemical |
| |elements that compose the system. In this case, all the |
| |other commands for working with the System file are not |
| |accessible. |
| |The HCh package adopts the following sequence of the |
| |groups of components and phases: the perfectly mobile |
| |components (p.m.c.); phases of constant composition |
| |(usually, minerals); solid solutions; liquid |
| |(non-aqueous) solutions; a gas mixture; an aqueous |
| |solution. None of these groups and phases is mandatory. |
| |The components (substances, species) within each group |
| |or phase are usually numbered independently; thus, by |
| |default the program uses relative numbering of the |
| |components. In some cases you might want to know the |
| |absolute (throughout) numbering of the components. To |
| |accommodate this need, there is an option for changing |
| |the type of numbering of the components for their |
| |display in the working pane. You can change the |
| |numbering type by pressing A. The third field of the |
| |status bar contains a permanent tip on this hot key |
| |option (A=Abs/Rel). |
| |Note: When printing the System file by the Print |
| |command, the program uses the current type of the |
| |numbering of the system components. |
| |The working pane displays the complete information on |
| |the component composition of the system, including the |
| |stoichiometry of the species. Usually, the |
| |stoichiometric coefficients are integers; thus, the |
| |program uses an appropriate "compact" format for the |
| |presentation of the stoichiometric matrix. However, |
| |sometimes the compositions of the natural minerals are |
| |expressed by fractional numbers. In this case, the |
| |stoichiometric matrix is displayed in the working pane |
| |inaccurately (the fractional coefficients are rounded to|
| |integers). The real presence of the fractional |
| |coefficients in the stoichiometric matrix is identified |
| |by a tip in the third field of the status bar; this tip |
| |shows what keys can be used to look up the exact values |
| |of the fractional coefficients: Alt=Fractions, |
| |Alt+arrow=Show. Pressing Alt will identify all the |
| |rounded coefficients in the visible part of the file by |
| |the red colour. Subsequently pressing the arrow keys |
| |while keeping the Alt key pressed will cyclically |
| |display the exact values of all the fractional |
| |coefficients within the visible part of the file. |
| |Note: When printing the System file by the Print |
| |command, the format of the stoichiometric matrix will |
| |remain the same as the format displayed on the screen; |
| |however, the exact values of all the fractional |
| |stoichiometric coefficients will be automatically |
| |printed out in a special additional table. |
| |Some models of real solutions (MOS, NRTL, PRSV, |
| |Subregular, Redlich-Kister) require setting additional |
| |parameters of non-ideality, which are also present in |
| |the files of the System type. Such parameters are shown |
| |by Main in the working pane as separate tables below the|
| |stoichiometric matrix. |
|New. |Creates a new file defining a chemical system. This |
| |command is accessible only if you have specified the |
| |current thermodynamic database. Creation of the new file|
| |is facilitated by a wizard that splits your task into |
| |several subsequent steps: |
| |Definition of the general structure of the model of the |
| |chemical system. At this step you should specify whether|
| |your system is closed or open (i.e., contains perfectly |
| |mobile components); whether it contains phases of |
| |constant composition; the number of possible solid |
| |and/or non-aqueous liquid solutions; the names of these |
| |solutions; possibilities of gaseous and aqueous phases |
| |in your system |
| |Note: The particular feature of this step is the |
| |possibility to duplicate the description of a solution |
| |phase (solid, liquid, or gas) if you want to model the |
| |immiscibility phenomena. |
| |Definition of the set of the chemical elements composing|
| |the system. The choice of the chemical elements is |
| |limited by the set of components held by the current |
| |Unitherm database. The number of the chemical elements |
| |comprising your system is limited by 30. |
| |Choosing components that form the phases of the system. |
| |The list of the possible components for each type of |
| |phases is created by the program from the components |
| |held by the current Unitherm database. |
| |Subsequent steps are similar to step 3. |
| |The final step (when the component compositions of all |
| |the phases are defined), you must specify the name of |
| |the system and proceed to the file editing (see below). |
| |At each step of the outlined workflow, you can return to|
| |the preceding step and change your choices by clicking |
| |the Back button or by pressing Backspace. Transition to |
| |the next step is allowed only if the program has not |
| |identified any errors within the current step. You can |
| |cancel your job at any time by clicking the Close button|
| |in the window header or by pressing Esc. |
| |Note: Important! This workflow does not automatically |
| |result in creating of a new file on your disk. The file |
| |will be saved only upon the completion of its editing. |
|Edit |This command can be completed only for an open file when|
| |the content of the System file is displayed in the |
| |working pane. The editing mode is identified in the |
| |second field of the status bar and by a |
| |colour-highlighted line within the working pane. |
| |When editing, all the functions of Main, including the |
| |Main menu, are blocked. The list of commands accessible |
| |for editing is listed in the third field of the status |
| |bar. This list depends on the position of the |
| |highlighted current line that you can move within the |
| |file by the mouse or keyboard. As a rule, the editing |
| |commands are started by pressing the appropriate keys. |
| |Editing of the system title (Title) is accessible at any|
| |position of the current line and is activated by |
| |pressing the T key or by double-clicking the system |
| |title within the working pane. |
| |When the current line is within the solid or liquid |
| |solution, you can change the name (Name) of that |
| |solution. The change of the name will automatically |
| |occur in all the copies of the solutions-duplicates. |
| |If the current line is within the solid, liquid, or gas |
| |solution, you can change the non-ideality model for this|
| |solution (or edit its parameters). To this end, press |
| |the M or Enter keys, or double click any component of |
| |the solution. The change of the non-ideality model will |
| |automatically occur in all the copies of the |
| |solutions-duplicates. |
| |Within the limits of the aqueous solution, you can |
| |change the ion-size parameter Å (Size) for any component|
| |of the solution. Pressing S or Enter, or double-clicking|
| |the appropriate component of the solution will display |
| |the entry field for editing the current value. Pressing |
| |Enter completes editing, and pressing Esc cancels it. |
| |These commands limit the options of editing the System |
| |file. To change the component composition of the system |
| |you must use the Rebuild command (see below). To |
| |complete the file editing, press Esc (as an exception, |
| |if you use the mouse, you can click the Close button in |
| |the header of the window (exit from the editing mode); |
| |this is the only case when the Close button does not |
| |close the application - please be careful!). The |
| |subsequent dialog allows you either to save the modified|
| |file to the disk (if Main has not identified any errors)|
| |or cancel saving your changes. |
|Rebuild |Allows to change the component composition of an open |
| |System file. The command operates using the same wizard |
| |that is used to create a new System file. Compared to |
| |the New command, compositions of the system and its |
| |phases are defined by an existing file. However, this |
| |template does not put any limits on modifying the file. |
| |You can make any changes to the system and even create a|
| |new file that is completely different from the source |
| |one. |
|Print |Allows to save the contents of the open file in the text|
| |form. If the Main mode "Print to file" is switched on, |
| |the text will be appended to the contents of the HCh.prn|
| |file located in the Working folder; alternatively, it |
| |will be sent to the default printer. |
|Export |Creates a special text file for specifying custom |
| |user-defined values of standard free energies of species|
| |and/or their activity coefficients that can replace the |
| |default values during thermodynamic calculations. This |
| |file represents an empty table that contains the names |
| |of all the inert components of the system. When created,|
| |the file is automatically named after the current source|
| |System file with the fixed *.stg extension. The |
| |particular fields of this table can be filled with the |
| |Edit command for the ASCII files. See the "ASCII files |
| |(text files)" and "Gibbs options" sections for more |
| |details. |


Blank files

In Main, the following commands are applied to the files of the type Blank:
Open, New., Edit, Rebuild., Print, and Export.
|Command |Description |
|Open |Opens an existing Blank file and displays its content in|
| |the working pane. The viewing mode is identified by the |
| |word "View" in the second field of the status bar. |
| |Note: If you have opened the Blank file without |
| |specifying the database associated with the current |
| |project (or with an invalid database reference), the |
| |file will be shown without specifying the chemical |
| |elements that compose the system. In this case, all the |
| |other commands for working with the Blank file are not |
| |accessible. |
|New. |Creates a new file defining the format of input data to |
| |specify the bulk chemical compositions of the system. |
| |This command is accessible only if you have specified |
| |the current thermodynamic database. Creation of the new |
| |Blank file consists of two subsequent steps: |
| |Definition of the main parameters of the format. |
| |Adding details of the above parameters via editing (see |
| |the Edit command). |
| |There are only a few main parameters. They are presented|
| |in the special dialog "Description of system |
| |compositions". Firstly, you must specify the "parental" |
| |file of the System type that serves as a basis (and |
| |client) for the current Blank file (the System file must|
| |be located within the Working folder). To choose the |
| |parental file you can use the Browse button. When you |
| |have specified the parental file, the other elements of |
| |the form become accessible for setting the required |
| |values. If your system is open (i.e., contains perfectly|
| |mobile components) you must specify the units for their |
| |fugacities (by default, decimal logarithms of pressure).|
| |Further, you should specify the components |
| |(stoichiometric units) that will define the bulk |
| |compositions of the system. There are only three allowed|
| |options: (1) "Chemical elements" (not recommended for |
| |routine usage), (2) "Ions and complexes" (useful for |
| |processing of analyses of natural waters), and (3) |
| |"Other substances" (the recommended choice offered by |
| |default). The last parameter - the number of components |
| |- should be specified very carefully, as this value can |
| |be subsequently changed only by the Rebuild command (see|
| |below). Please remember that if your system contains the|
| |aqueous solution, then for any choice of the components |
| |the first one will be represented by water (H2O). The |
| |water is set automatically and cannot be excluded by the|
| |user. You should take it into account when you specify |
| |the complete number of the components. |
| |After setting the discussed parameters you can proceed |
| |to editing of the new Blank file by clicking the Edit |
| |button. |
| |Note: While setting the parameters, a new template is |
| |created within the Main working pane. You can use it for|
| |the visual control of your actions. Besides, if you have|
| |chosen chemical elements as components, all the chosen |
| |earlier components of the Blank files will be |
| |immediately filled with chemical elements. |
|Edit |This command allows you to enter or change parameters of|
| |the Blank file. It is accessible if this file is open |
| |and you have specified the current project database. You|
| |can edit only some of the component properties; number |
| |of them can be changed only by the Rebuild command (see |
| |below). The editing mode is identified in the second |
| |field of the status bar and by a colour-highlighted line|
| |within the working pane. |
| |When editing, all the functions of Main, including the |
| |Main menu, are blocked. The list of commands accessible |
| |for editing is listed in the third field of the status |
| |bar. This list depends on the position of the |
| |highlighted current line that you can move within the |
| |file by the mouse or keyboard. As a rule, the editing |
| |commands are started by pressing the appropriate keys. |
| |If the parental file contains perfectly mobile |
| |components (i.e., defines an open system), then you can |
| |specify the type of the each p.m.c. (the number of the |
| |p.m.c. and their names are defined within the parental |
| |System file and cannot be modified in the Blank file). |
| |The types of the p.m.c. define the ways to set their |
| |fugacities and can have one of three values: (1) |
| |"constant" (the fugacity is set within the Blank file |
| |itself and will not subsequently change), (2) "variable"|
| |(the fugacity value is not specified at this stage, but |
| |should be specified later either within an Input file or|
| |in interactive mode in the process of calculations), and|
| |(3) "computed" (the fugacity values will be calculated |
| |by Gibbs according to the formula specified in the |
| |Control file). By default, all the p.m.c. are of the |
| |"variable" type. You can change the type of the p.m.c. |
| |when this component is located within the current |
| |(colour-highlighted) line. In this case, pressing Tab |
| |activates the table of the types and allows you to make |
| |a choice. "Up" and "Down" arrows allow you to move |
| |within the table, Enter - to set the current type. If |
| |you want to return to editing of the Blank file without |
| |changing the p.m.c. type, press Tab or Esc. To change |
| |the p.m.c. type, you can also use the mouse - just |
| |double click the required type in the selection table. |
| |If you have specified the "constant" type of the p.m.c.,|
| |you should also enter an appropriate value into the |
| |offered field. If the p.m.c. is already of the |
| |"constant" type and you just want to change the constant|
| |value, you can accomplish it by the repetitive choice of|
| |the type as described earlier. |
| |Note: The specified fugacity units are the same for all |
| |p.m.c. and cannot be changed by the Blank file editing. |
| |You can change them only via the Rebuild command. |
| |If your Blank file contains components of the |
| |"Ion/Complex" or "Substance" type, you must specify the |
| |chemical formulas for each of the components (except for|
| |the automatically included water that will always be |
| |enumerated 0). Entering or editing the formula of the |
| |current component is possible by pressing Enter (or |
| |double-clicking by mouse). If the component is present |
| |in the project database, you can enter its database name|
| |instead of its chemical formula. The formulas or the |
| |names must be specified for all the components, but it |
| |is not required that all of them should have different |
| |formulas. After entering or editing the chemical formula|
| |you can press Enter to complete the entry or "Down" or |
| |"Up" keys to go to entering or editing the formula of |
| |the subsequent or preceding components, respectively. |
| |The entered formula will be kept in the program memory |
| |only if the program has not identified any errors. |
| |Otherwise, the program will display a diagnostic message|
| |and will offer you the option to edit the erroneous |
| |entry. Pressing Esc cancels editing. In this case, the |
| |program will revert to the initial formula that was kept|
| |prior to the field editing. |
| |After all the formulas (or names) of the components are |
| |defined, you can specify the measurement units for their|
| |quantities. The list of the possible units is provided |
| |in the additional table to the right of the list of |
| |components. By default, the quantities of all the |
| |components are defined in moles (for the exception of |
| |the "zero" water where the default unit is kg). You can |
| |specify its own eligible unit for each of the components|
| |in the same manner as it is completed for the p.m.c. |
| |(see above). If all of your components should have the |
| |same measurement unit, you can accelerate their |
| |specification by pressing the Ctrl+Down key combination.|
| |In this case, the measurement unit for the current |
| |component will be copied for all the subsequent |
| |components. |
| |Note: You can move the position of the components within|
| |the blank files. Look for the tips in the Main status |
| |bar. |
| |These commands limit the options of editing the Blank |
| |files. To change the type of the components that defines|
| |the bulk chemical composition of the system, or their |
| |number, and for editing measurement units of the p.m.c. |
| |fugacities, use the Rebuild command (see below). |
| |To complete the file editing (exit from the editing |
| |mode), press Esc (as an exception, if you use the mouse,|
| |you can click the Close button in the header of the |
| |window; this is the only case when the Close button does|
| |not close the application - please be careful!). The |
| |subsequent dialog allows you either to save the modified|
| |file to the disk (if Main has not identified any errors)|
| |or cancel saving your changes. |
|Rebuild |Allows to create a new Blank file following the template|
| |of an existing (currently open) file. When completing |
| |this task, you follow the subsequent steps described |
| |above for the New command. Compared to the New command, |
| |all the parameters of the template offered for change |
| |are defined by an already existing file. However, this |
| |template does not put any limits on modifying the file. |
| |You can make any changes to the system and even create a|
| |new file that is completely different from the source |
| |one. |
| |This command is especially useful by the option to |
| |change the name of the parental System file. Thus, you |
| |can apply the existing blank file to a different system.|
| |Usage of this command in conjunction with conventional |
| |Windows tools of copying and renaming files (e.g., |
| |accessible from Main via the Open file dialog) allows |
| |you easily and quickly generate template-based sets of |
| |HCh files for modelling different systems. |
|Print |Allows to save the contents of the open file in the text|
| |form. If the Main mode "Print to file" is switched on, |
| |the text will be appended to the contents of the HCh.prn|
| |file located in the Working folder; alternatively, it |
| |will be sent to the default printer. |
|Export |Within the Working folder, creates a special text file |
| |with the name of the currently open Blank file and the |
| |fixed *.blk extension. This file represents an empty |
| |table that contains fields that can be filled by values |
| |according to the parameters defined within the source |
| |Blank file. It is assumed that this table is filled |
| |externally to the HCh package (see also the Import |
| |command for the files of the Input type). |


Input files

In Main, the following commands are applied to the files of the type Input:
Open, New., Edit, Rebuild., Print, and Import.
|Command |Description |
|Open |Opens an existing Input file and displays its content in|
| |the working pane. The viewing mode is identified by the |
| |word "View" in the second field of the status bar. |
| |Note: If you have opened the Input file without |
| |specifying the database associated with the current |
| |project (or with an invalid database reference), all the|
| |other commands for working with the Input file are not |
| |accessible. |
|New. |Creates a new file of the bulk chemical compositions of |
| |the system specified according to the format defined by |
| |a Blank file. This command is accessible only if you |
| |have specified the current thermodynamic database. |
| |Creation of the new Input file consists of two |
| |subsequent steps: |
| |Definition of the main parameters of the format. |
| |Detailisation of the above via editing (see the Edit |
| |command). |
| |There are only a few main parameters. They are presented|
| |in the special dialog "Total system compositions". |
| |Firstly, you must specify the "parental" file of the |
| |Blank type that serves as a basis for the current Input |
| |file (the Blank file must be located within the Working |
| |folder). To choose the parental file, you can use the |
| |Browse button. When you have specified the parental |
| |file, the other elements of the form become accessible |
| |for setting the required values. In particular, you can |
| |set a few options that modify the rules of usage of the |
| |Input file you are creating. |
| |If the system for which you create the current Input |
| |file is open and the parental Blank file defines the |
| |p.m.c. type as constant, you can allow Main to change |
| |the values of these constants directly within the Input |
| |file, as if they were of the "variable" type (this |
| |option was not available in the preceding versions). The|
| |same refers to the p.m.c. type initially specified as |
| |"computed" (i.e., you can treat them as "variable" as |
| |well). Finally, you can use a flag that allows you to |
| |omit otherwise compulsory naming of the particular |
| |compositions kept in your Input file. The final and the |
| |main parameter of the Input file is the number of the |
| |chemical compositions of the system (from 1 to 9). After|
| |you have set the discussed parameters, you can proceed |
| |to editing the new Input file by clicking the Edit |
| |button. |
| |Note: While setting the parameters, a new Input file is |
| |created within the Main working pane. You can use it for|
| |the visual control of your actions. |
|Edit |Allows you to enter or edit the bulk chemical |
| |compositions of your system, and, optionally, fugacity |
| |values of the perfectly mobile components. It is |
| |accessible if this file is open and you have specified |
| |the current project database. |
| |You can edit only the parameters listed above. To change|
| |the number of the compositions or the modes of the |
| |p.m.c. usage, you must use the Rebuild command (see |
| |below). |
| |The editing mode is identified in the second field of |
| |the status bar and by a colour-highlighted line within |
| |the working pane. |
| |When editing, all the functions of Main, including the |
| |Main menu, are blocked. The scroll bars are blocked as |
| |well, however you can still change the size of the Main |
| |window. During editing the Input file, you are presented|
| |with an entry field located in the current line; it |
| |always stays visible. You can navigate within the file |
| |using Up and Down arrows (moving the current line in the|
| |vertical direction), and Tab/Shift+Tab keys (moving the|
| |entry field in the horizontal direction). You can also |
| |move the entry field within the visible part of the file|
| |by double-clicking the required element of the table. On|
| |completion of the editing of a table element, you can |
| |move the entry field to a new location by any possible |
| |means - the edited data will be kept. The normal way to |
| |complete the editing of any element is achieved by |
| |pressing Enter. In this case, the entry field will |
| |automatically move to the next (in the logical order) |
| |element of the composition table. |
| |The list of two additional commands accessible for |
| |editing is listed in the third field of the status bar. |
| |The first one allows to copy the current value of the |
| |entry field into an adjacent cell of the same line. |
| |Depending on the desired direction, you can press |
| |Ctrl+Left or Ctrl+Right, appropriately. The second |
| |command enables you to copy the whole column. Depending|
| |on the desired direction, you can press Alt+Left or |
| |Alt+Right, appropriately. Upon the completion of both |
| |commands, the location of the entry field within the |
| |file does not change. |
| |To complete the file editing (exit from the editing |
| |mode), press Esc (as an exception, if you use the mouse,|
| |you can click the Close button in the header of the |
| |window; this is the only case when the Close button does|
| |not close the application - please be careful!). The |
| |subsequent dialog allows you either to save the modified|
| |file to the disk (if Main has not identified any errors)|
| |or cancel saving your changes. |
| |Note: A serious error that prevents saving data into the|
| |Input file is the charge disbalance for any of the |
| |compositions. The charge disbalance can be identified by|
| |Main when the components are represented by ions and |
| |complexes (i.e., charged species). If Main identifies |
| |this error, it offers a special dialog with three |
| |options to rectify the problem: (1) a manual one (simple|
| |return to editing), (2) an automatic one (the program |
| |will complete the minimal quantitative adjustments for |
| |the charged species to eliminate the disbalance), and |
| |(3) a mixed one (you will be offered to specify the |
| |component which quantity can be adjusted to eliminate |
| |the disbalance). If you choose the second or third |
| |option, the program will return to the editing mode |
| |after the necessary corrections; you will be able to |
| |examine the results and make the decision on saving the |
| |data. At this step, you can cancel the suggested |
| |correction by pressing Ctr+Z (the Undo command). If |
| |during the automatic correction you set the option |
| |"apply to all columns", the mentioned dialog will not be|
| |displayed for the current Input file. Nevertheless, even|
| |in this case you will be shown the results of the |
| |correction (if any) for each column to control the |
| |completed compositional adjustments. |
|Rebuild |Allows to create a new Input file following the template|
| |of an existing (currently open) file. When completing |
| |this task, you follow the subsequent steps described |
| |above for the New command. Compared to the New command, |
| |all the parameters of the template offered for change |
| |are defined by an already existing file. However, this |
| |template does not put any limits on modifying the file. |
| |You can make any changes to the system and even create a|
| |new file that is completely different from the source |
| |one. |
| |This command is especially useful by the option to |
| |change the name of the parental Blank file. Usage of |
| |this command in conjunction with conventional Windows |
| |tools of copying and renaming files (e.g., accessible |
| |from Main via the Open file dialog) allows you easily |
| |and quickly generate template-based sets of HCh files |
| |for modelling different systems. |
|Print |Allows to save the contents of the open file in the text|
| |form. If the Main mode "Print to file" is switched on, |
| |the text will be appended to the contents of the HCh.prn|
| |file located in the Working folder; alternatively, it |
| |will be sent to the default printer. |
|Import |Reads a text file with the *.inp extension from the |
| |current Working folder and creates on its basis a new |
| |Input file that is subsequently transferred to an |
| |editing mode. It is assumed that this *.inp file is |
| |created externally to the HCh package by editing |
| |(filling in) the table of the *.blk file and its |
| |subsequent renaming (also see the Export command for the|
| |files of the Blank type). |



Control files

In Main, the following commands are applied to the files of the type
Control: Open, New., Edit, Rebuild., Print, and Execute.
|Command |Description |
|Open |Opens an existing Control file and displays its content |
| |in the working pane. The viewing mode is identified by |
| |the word "View" in the second field of the status bar. |
| |Note: If you have opened the Control file without |
| |specifying the database associated with the current |
| |project (or with an invalid database reference), all the|
| |other commands for working with the Control file are not|
| |accessible. |
|New. |Creates a new file defining a modeling algorithm that |
| |uses particular system compositions specified within an |
| |Input file. This command is accessible only if you have |
| |specified the current thermodynamic database. |
| |In HCh, the term modelling implies subsequent |
| |calculations of equilibria completed in a loop. In other|
| |words, definition of the modelling algorithm is |
| |equivalent to the definition of the structure of loops |
| |of calculations of chemical equilibria. The simplest |
| |model comprises the only loop; this model can be |
| |described as one-dimensional. The more advanced type of |
| |the models supported by HCh is two-dimensional, |
| |representing the double loop (i.e., one loop is |
| |completed within the other). Both types of the models |
| |can be completely defined by the Control file. For |
| |visual clarity, the calculation loops are graphically |
| |represented by Main with a special form with the "Wave |
| |definition" header (in HCh models, a calculation point |
| |is called "step", and one calculation loop - the |
| |sequence of the calculation steps - is called "wave"). |
| |Within the form, each element of the loop definition is |
| |represented by a button; pressing a button invokes an |
| |appropriate dialog. |
| |Prior to the definition of the initial loop (or, the |
| |Primary Wave, N=0), you should specify the parental |
| |Input file that contains the compositions of the modeled|
| |system (the file must reside in the Working folder). To |
| |choose the parental file, you can use the Browse button.|
| |After you have specified the parental file, the |
| |remaining form elements become accessible for usage. |
| |The "Set Initial Composition (i=0)" button calls the |
| |dialog of setting parameters of the initial loop step. |
| |You should specify expressions (the calculation |
| |formulas) that will define calculation of temperature, |
| |pressure, and fugacities of the perfectly mobile |
| |components (if the system is open). Setting the initial |
| |loop step is not mandatory; if omitted, the loop will |
| |start from a "general step" at i=1. |
| |The "Recalculate Composition (i=1,2,.)" button calls the|
| |dialog of setting parameters of the general loop step. |
| |This definition is mandatory. You should specify the |
| |same parameters of equilibrium as above; however the |
| |formulas that specify the algorithms to calculate these |
| |parameters can be recurrent. In other words, they can |
| |define changes of the parameters relative to the |
| |preceding step. The recurrent setting of the parameters |
| |is possible only when the definition of the initial step|
| |has not been omitted. |
| |The "Calculate Equilibrium (run Gibbs)" button serves |
| |for setting the Gibbs options that must be used for all|
| |the equilibrium calculations within the given model. The|
| |dialog called by this button is exactly the same as the |
| |dialog called from the main Gibbs menu (Gibbs - Gibbs |
| |options - Computing). It should be remembered though |
| |that options set with the latter are used only with |
| |Gibbs calls using Blank and Input source files; within |
| |each Control file, they must be set individually. |
| |Setting Gibbs options is optional. The only option set |
| |by default is /s (Compute sequentially). |
| |The "Test Finish Condition (continue?)" button calls the|
| |mandatory dialog that allows you to set the conditions |
| |of the loop termination. This condition can be expressed|
| |via the step number, temperature, pressure, water |
| |density or its quantity in the system, or some |
| |combination of these parameters. |
| |Upon definition of all the parameters of the primary |
| |wave, you should decide whether your model must contain |
| |the definition of a secondary wave (i.e., whether your |
| |model is going to two-dimensional). When you open the |
| |"Primary Wave definition" dialog for the first time, the|
| |mode of creating the two-dimensional model is switched |
| |off. If you do not want to limit yourself by a |
| |one-dimensional model, you can switch this mode on by |
| |checking the "Define Secondary Wave also" box |
| |(otherwise, you should press the Edit button; see |
| |below). After choosing the two-dimensional model, the |
| |Edit button will be replaced by the Next button that |
| |allows you to continue the definition of your model. In |
| |this case the current dialog will be replaced by the |
| |dialog of the definition of the "secondary" wave |
| |(Secondary Wave, N=1,2,.). |
| |The secondary wave is a "repetitive" loop that will be |
| |completed immediately after the completion of the first |
| |one. The number of the repetitive loops (i.e., secondary|
| |waves) can be arbitrary, though they all have the same |
| |definition. The dialog for the definition of the |
| |secondary wave is similar to the primary one, with a |
| |number of differences: (1) it is not possible to change |
| |the name of the parental file; (2) in the calculation |
| |formulas it is possible to include recurrent references |
| |not only to the preceding step, but to the preceding |
| |wave as well; (3) the formulas and conditions can |
| |include an additional parameter, N - the current wave |
| |number; (4) the form has an additional button that calls|
| |the mandatory dialog to set the number of the secondary |
| |waves (more precisely, the conditions of the termination|
| |of the "external loop" defined by N). Upon setting all |
| |the parameters of the secondary waves and pressing Edit |
| |the created Control file is transferred to editing mode.|
| | |
| |Note: While setting the parameters, a new Control file |
| |is created within the Main working pane. You can use it |
| |for the visual control of your actions. |
| |Note: Formulas used for the calculation of the |
| |parameters (temperatures, pressures, fugacities of the |
| |p.m.c., bulk compositions) can be supplemented by |
| |comments to ease further interpretation and model |
| |debugging. A comment is represented by an arbitrary text|
| |string that follows the formula and is separated from it|
| |by the apostrophe ('). |
| |Note: More information on the ways of definition of |
| |equilibrium models can be found in the paper: Yu. V. |
| |Shvarov (1999), Algorithmization of the numerical |
| |equilibrium modelling of dynamic geochemical processes |
| |// Geochemistry International, vol. 37, no. 6, pp. |
| |571-576. |
|Edit |This command allows you to change Control file formulas,|
| |conditions, and other parameters of the model. It is |
| |accessible if this file is open and you have specified |
| |the current project database. You can edit only the |
| |lines that are already saved in the file; to change |
| |their number (e.g., to add the omitted initial step of |
| |the loop) you should use the Rebuild command (see |
| |below). The editing mode is identified in the second |
| |field of the status bar and by a colour-highlighted line|
| |within the working pane. |
| |For editing formulas and conditions in the description |
| |of the algorithm you should move the current line to the|
| |element that requires modification, and press Enter (the|
| |same result is achieved by double-clicking the element).|
| |You will be displayed with the same dialog that was used|
| |for the initial data entry - the element can be edited. |
| |If you have to edit a text line - description (title) of|
| |the model or Gibbs options, you can activate the |
| |appropriate dialog by pressing the "T" or "O" keys, |
| |respectively. You can achieve the same result by |
| |double-clicking the model title or the options line. |
| |To complete the file editing (exit from the editing |
| |mode), press Esc (as an exception, if you use the mouse,|
| |you can click the Close button in the header of the |
| |window; this is the only case when the Close button does|
| |not close the application - please be careful!). The |
| |subsequent dialog allows you either to save the modified|
| |file to the disk (if Main has not identified any errors)|
| |or cancel saving your changes. |
|Rebuild |Allows to create a new Control file following the |
| |template of an existing (currently open) file. When |
| |completing this task, you follow the subsequent steps |
| |described above for the New command. Compared to the New|
| |command, all the parameters of the template offered for |
| |change are defined by an already existing file. However,|
| |this template does not put any limits on modifying the |
| |file. You can make any changes to the system and even |
| |create a new file that is completely different from the |
| |source one. |
| |This command is especially useful by the option to |
| |change the name of the parental Input file. Usage of |
| |this command in conjunction with conventional Windows |
| |tools of copying and renaming files (e.g., accessible |
| |from Main via the Open file dialog) allows you easily |
| |and quickly generate template-based sets of HCh files |
| |for modelling different systems. |
|Print |Allows to save the contents of the open file in the text|
| |form. If the Main mode "Print to file" is switched on, |
| |the text will be appended to the contents of the HCh.prn|
| |file located in the Working folder; alternatively, it |
| |will be sent to the default printer. |
|Execute |Launches Gibbs with the currently open Control file as a|
| |source. |
| |Note: You can achieve the same result by double-clicking|
| |the open Control file in the working pane. The presence |
| |of the special button for this operation only stresses |
| |that the only purpose of the Control files is their |
| |usage by the Gibbs program. |
Working with calculation results

Depending on the type of the problem being solved, Gibbs outputs results
into files of two types:
1. Text files with the *.lst extension (standard or reduced listings).
2. Binary files with the *.re extension (files of the results that are
output when modelling using Control files).

You can use Gibbs listings as any other text files using appropriate
Windows utilities and applications. The binary files can be examined and
processed only using Main.


Result files

In Main, the following commands are applied to the files of the type Result
(*.re): Open, Cross section., Show, CutOff, and Export...
Note: If you have opened the Result file without specifying the
database associated with the current project, the above-listed commands
remain accessible as, as a rule, they do not require the database. A
partial exception is the Export command that uses the database for
reading chemical formulas and, optionally, molecular weights and molar
volumes of the components (see below).
|Command |Description |
|Open |Opens an existing Result file and displays its content |
| |in the working pane. The viewing mode is identified by |
| |the word "View" in the second field of the status bar. |
| |Usually a Result file contains results of calculations |
| |for numerous points defined by a single calculation |
| |"wave" (a one-dimensional model), or by multiple "waves"|
| |(a two-dimensional model). When you open this file, the |
| |working pane displays not the numerical results of the |
| |modelling, but a one- or two-dimensional chart of the |
| |model. Every point of this chart, displayed in the |
| |Wave-Step coordinates, represents a block of data that |
| |describe the equilibrium composition of the chemical |
| |system calculated at the given stage of the modelling. |
| |Further work with the open Result file may comprise |
| |selective examination of these compositions and/or their|
| |conversion into formats appropriate for subsequent |
| |processing. |
| |On opening the Result file, Main automatically sets the |
| |viewing mode to "Point", where you can choose any point |
| |within the model chart using the conventional keyboard |
| |or mouse navigation. Pressing Enter, double-clicking the|
| |point, or clicking the Show button will display the |
| |equilibrium composition of the current point in a |
| |special window (for details, see the Show command |
| |below). |
|Cross section. |Enables examination of changing equilibrium values of |
| |components of the system along the defined direction in |
| |model coordinates. Main supports four types of sections:|
| |1) "horizontal", comprising all the calculation points |
| |belonging to the same wave (the W-E orientation); 2) |
| |"vertical", comprising all the calculation points |
| |belonging to the same step (the N-S orientation); 3) |
| |"forward diagonal", comprising points for which the sum |
| |of the numbers of the wave and the step is constant (the|
| |SW-NE orientation); 4) "reverse diagonal", comprising |
| |points for which the difference of the numbers of the |
| |wave and the step is constant (the NW-SE orientation). |
| |You can choose the required type of the section using |
| |the Cross section command or using the local menu |
| |displayed by the right click within the working pane |
| |with the model chart. |
| |Note: Physical interpretation of the data represented by|
| |a section of the particular type depends on the |
| |modelling algorithm defined by the appropriate Control |
| |file. |
| |After you have chosen the type of the section, it is |
| |immediately displayed on the model chart. The section is|
| |always drawn through the last current point, with the |
| |current point identified by the mouse cursor (even if |
| |you use the keyboard navigation). You can move the |
| |section to the desired location in the same way as you |
| |can move the point, using the mouse or the keyboard. |
|Show |Outputs data for the current point in the Point mode; |
| |outputs graphs in the Cross section mode. |
| |In the Point display mode, clicking the Show button, |
| |pressing Enter, or double-clicking a point will display |
| |a Point window showing the equilibrium composition of |
| |the current point. Representation of the results is |
| |similar to Gibbs listings (in particular, it lists |
| |concentrations, but not the quantities of the solution |
| |components). Compared to Gibbs listings, it displays |
| |less details of the equilibrium state (e.g., it does not|
| |list the activity coefficients). You can open up to ten |
| |such windows; this enables you to immediately compare |
| |equilibrium compositions for different model points. |
| |Each of this windows is provided with command buttons |
| |that allow you to independently print out the window |
| |data (the "Print" button) or save the data into a text |
| |file with an arbitrary name and the fixed extension |
| |*.res (the "Save." button). You can save the data from |
| |different points in the same file - in this case, they |
| |will be appended. You can close the data windows |
| |individually using the Close button of each window, but |
| |you can close them all simultaneously using the special |
| |command from the Window menu that will be displayed in |
| |the main window of Main. |
| |Note: You can change the size of any of these windows - |
| |enlarge their height and/or decrease their width. |
| |Note: You can copy the content of these windows into the|
| |Clipboard (with the standard Ctrl+C or Ctrl+Insert key |
| |combinations) - just define the rectangular area for |
| |copying first. Selection of a part of the text within |
| |the window can be achieved with the mouse. Just press |
| |the left mouse button in the required location, and |
| |holding it enlarge the selection to the required size |
| |(the keyboard equivalent is to press Enter to switch on |
| |the selection mode, and use the arrows to move the |
| |initial point to the desired location; the enlargement |
| |of the selection is completed by using arrows while |
| |holding the Shift key). To select the whole content of |
| |the window, click within the rectangle defined by the |
| |scroll bars (or press the Ctrl+A key combination). |
| |In the Section display mode, clicking the Show button, |
| |pressing Enter, or double-clicking the cross section |
| |will display the Cross section window (if it has not |
| |been displayed already). This window represents the |
| |section data graphically. The units for the X-axis for |
| |all the sections but the vertical one are represented by|
| |the model steps; for the vertical sections they are |
| |represented by model waves. The Y-axis shows the molar |
| |quantities of the components - intrinsic units for Gibbs|
| |that represent all the data in the Result files. After |
| |the display of the graph in the Cross section window, |
| |the focus remains within the working pane; this allows |
| |you to monitor changes in the graph in real time while |
| |moving the section within the model chart. |
| |The Cross section window has three buttons that allow |
| |you to control the graph options. |
| |? The "Axis" button calls the dialog for changing the |
| |scales of the graph axes. Most of the axes parameters |
| |are set by the program automatically, but optionally you|
| |can manually set the range of the displayed values (Min |
| |and Max), the interval between the labelled ticks |
| |(Unit), the number of unlabelled ticks between digital |
| |labels (Minor ticks), or the number of digits in digital|
| |labels (Dec. places). Besides, you can specify |
| |logarithmic scale instead of the standard one. If the |
| |latter, the rest of the axis parameters will be set |
| |automatically. |
| |Note: If you specified a logarithmic scale for the |
| |Y-axis, you can display pH and Eh plots for aqueous |
| |solutions. |
| |? The "Species." button enables you to specify the |
| |components to plot on the graph. For the initial |
| |(automatic) plotting, the program displays the data for |
| |the first group of the system species according to the |
| |following list: solid substances, non-aqueous liquids, |
| |gases, water and aqueous species, pH and Eh (a specific |
| |group because of different units; displayed only for |
| |logarithmic plots). You can merge selected groups and |
| |choose any number of components from each of the |
| |selected groups. To accelerate work, you can use the |
| |same "hot" keys that are used within HCh to work with |
| |all the lists: "+", "-", "*", Ctrl+A. |
| |Note: If you change the species list, all the automatic |
| |parameters of the Y-axis will be re-calculated for |
| |optimal display of the new set of data. |
| |? The "Save." button enables you to export the whole |
| |section into a text file with an arbitrary name but with|
| |the fixed extension *.rex. The appropriate dialog allows|
| |you to set some parameters of this file. The first |
| |option allows you to specify whether you want to output |
| |all the species from the Result file or only the species|
| |currently displayed in the graph. The second option |
| |defines the format of the generated table: the names of |
| |the species can be listed in the first column (the |
| |vertical table), or in the first row (the horizontal |
| |table). This option might be essential for subsequent |
| |importing of the data into spreadsheet programs (e.g., |
| |MS Excel; see the ASCII files section). |
| |Note: The solution components in *.rex files are |
| |represented in concentrations. To ensure optional |
| |back-conversion into moles, for each solution the output|
| |will include the bulk molal quantity of its components |
| |(independently from how many components of this solution|
| |occur in the output file). |
|CutOff |Trims the size of the open Result file by deleting some |
| |of its points. The command is available only in the |
| |Cross section mode and can be accessed only from the |
| |keyboard by pressing the O key. The points to delete are|
| |specified by the current position of the section and its|
| |type. For the vertical sections and forward diagonals, |
| |you can delete all the points to the right from the |
| |current section; for the reverse diagonals, you can |
| |delete only the points above the current section; for |
| |the horizontal sections you can delete either the points|
| |above or below the current section. If after trimming |
| |the Result file you want to continue calculations for |
| |the given model, you might find it necessary to correct |
| |the source Control file to take into account the change |
| |in the "structure" of the model (e.g., waves/point |
| |numbers). |
|Export |Exports the complete Result file into a text file. The |
| |name of the text file will be the same as the name of |
| |the source Result file, with the fixed *.txt extension. |
| |Prior to saving this file in the Working folder, you can|
| |set some of the optional parameters. Firstly, you can |
| |choose the format of the file ("tab-delimited" vs |
| |"comma-delimited"). The default value is the |
| |"tab-delimited" output that is most suitable for |
| |importing data into spreadsheet programs (e.g., MS |
| |Excel). Secondly, you can append the data with the |
| |values of molal volumes and molecular weights that will |
| |be extracted by Main from the Unitherm database (if the |
| |database for the project is not specified, the |
| |appropriate output fields will remain blank). Finally, |
| |you can opt to include in the output all the components |
| |from the source System file even if some of them are |
| |never formed in the current model (by default, this |
| |option is switched off). The main purpose of the *.txt |
| |files generated from the Result files is usage outside |
| |of the HCh package (e.g., in MS Excel and other |
| |numerical and graphical applications). |
| |Note: In this type of text file all the components are |
| |presented in moles and none of the phase sums are |
| |calculated. |


ASCII files (text files)

Main (along with Gibbs) generates numerous text files intended for
miscellaneous purposes. Thus, they have different extensions (you can use a
mnemonic rule that all the binary files used by Main have two-letter
extensions, and all the text files have three-letter extensions).
All the text files can be open, read, and printed out by Main tools when
you choose the ASCII file type command. Another command common for all the
text files is "Convert". The latter was introduced to ensure compatibility
with earlier versions of HCh for DOS. The files generated in DOS for
localized computers where users used a local language on top of English,
were encoded in a different way compared to Windows. The text files do not
contain any information on the platform of their creation, thus the
differences in the text encoding can be identified only after the file is
open. The purpose of the Convert command is to account for such encoding
incompatibilities. As a result pressing the Convert button recodes the text
file displayed in the working pane from the DOS encoding into Windows
encoding and back.
With particular types of ASCII files you can complete some specific
operations. Below all the types of the text files supported by Main are
listed and discussed.

|Extension |Purpose |
|*.ini |Setting Main modes on starting or on change of the |
| |Working folder. You can use this files only via the Save|
| |settings and Restore settings commands (see the Options |
| |menu). |
|*.prn |Created by Main by the Print command when you set the |
| |mode "Print to file" (see the Options menu). Further |
| |usage of these files by HCh is not envisaged. |
|*.stg |Provide an option for replacing the default standard |
| |free energies of selected species (in kJ/mol) and/or |
| |their activity coefficients by custom user-defined |
| |values during Gibbs calculations. These files are |
| |created from System files by the Export command; they |
| |are the only ASCII files that can be modified with the |
| |Edit command. Main provides an option to insert the |
| |necessary values in the appropriate positions of the |
| |species table. If you insert simple numerical values |
| |into the *.stg-table, the editing does not require |
| |further explanations. However, Main allows you to enter |
| |formulas that express the free energy as a function of |
| |temperature, pressure, and water density. The input mode|
| |is set by the Alt+F key combination. It is identified by|
| |doubling the length of the entry field and by displaying|
| |the list of the allowed variables (T in œC, P in bars, |
| |and D in g/cm3) in the third field of the status bar. As|
| |the calculation formulas can be quite long, they are not|
| |inserted by Main in the *.stg-table, but placed into the|
| |free field to the right of the table. The presence of |
| |the formula in the free energy field is identified by |
| |the "=>" symbol (an arrow pointing to the formula). To |
| |activate usage of this file during Gibbs calculations |
| |you must launch Gibbs with the /g option (Substitute |
| |energy/act.coef.). |
|*.blk |Represent files intended for input of the bulk |
| |compositions of the system externally to the HCh |
| |package. These files are created from specified Blank |
| |files by the Export command and have the names of the |
| |source files. Main does not use these files. |
|*.inp |A text analogue of an Input file. These files are used |
| |to create the latter with the Import command. These |
| |files are created externally to the HCh package by |
| |filling in the tables of the *.blk files and their |
| |subsequent renaming. |
|*.lst |Created by Main when saving the results of the |
| |calculations in the interactive mode (standard listing),|
| |or, optionally, for calculations of one-dimensional |
| |models (reduced listing). This type of file is |
| |convenient for visual examination of the modelling |
| |results. However, the formatting of *.lst files is |
| |simplified when they are exported into the MS Excel |
| |program. |
|*.res |Created by Main when saving calculation results from the|
| |specified model points. The data are extracted from the |
| |Result files. HCh does not assume any special usage of |
| |these files as all the data from the Result files can be|
| |efficiently imported into Excel by other means (see |
| |below). |
|*.rex |Created by Main when saving calculation results from the|
| |specified model cross-sections. The data are extracted |
| |from the Result files. The data are represented as |
| |tables convenient for reading in simple text-processing |
| |programs as they are formatted using spaces. These files|
| |can be easily imported into Excel (see below) for |
| |subsequent processing or visualisation. |
|*.txt |Created by Main by the Export command for the Result |
| |files and contain the full text representation of their |
| |content. You can specify the type of the delimiter. |
| |However, if you intend to import these data into Excel, |
| |it is recommend to use the tab-delimited format, as in |
| |this case the import into Excel can be completed |
| |straight from Main. |
| |Note: *.txt files are the only ASCII files generated by |
| |Main where quantities of all the components are |
| |represented in moles (namely, in the internal format of |
| |Gibbs). In all the other text files containing |
| |equilibrium values, the solution components are |
| |represented by concentrations (in molalities for aqueous|
| |species and molar fractions for the rest of components).|

The "MS Excel" command becomes accessible each time when the working pane
of Main contains an open file suitable for data export to Excel (*.lst,
*.tab, *.rex, *.txt). Upon invoking this command, Main calls Excel and
passes to it the data from the open text file. After that, it offers to
save the new Excel workbook with the name of the source file and the fixed
*.xls extension. If you decline this option, the new workbook will not be
saved, and will retain the name ascribed to it by Excel by default
(Sheet1.xls, Sheet2.xls and so on). After Main passes the data to Excel,
Main leaves Excel open along with all the created workbooks, leaving the
decision on the subsequent work with the Excel file to the user.
Note: *.txt is a common Windows extension for many types of text files. For
example, you can have a Modules.txt file in your Working folder (see
GibbsExt.doc). However, this file (and similar) will not be passed to Excel
as it is not intended for this purpose.