TernAPI-C User Manual

Content

1. Introduction

2. Model description format

  2.1. General information

  2.2. Arithmetic expressions

  2.3. Anonymous functions

  2.4. Built-in functions call

  2.5. Using LaTeX in the text

  2.6. Experimental data description

3. Thermodynamic models examples

  3.1. Au-Pt-Pd system

  3.2. Mo-Hf-Re system

  3.3. Ga-In-Sb system

4. User interface

  4.1. The main window of the program

  4.2. A window with isobaric-isothermal section

5. Addition of custom functions

  5.1. Ruby scripts

  5.2. DLL with functions inside

  5.3. Functions written in MATLAB

6. Changelog

7. Bibliography


1. Introduction

TernAPI-C program has been developed in the Laboratory of Chemical Thermodynamics of Lomonosov MSU. It is designed for the ternary phase diagrams assessement on the basis of Gibbs energies (surfaces, curves, isolated values) of its constituent phases by means of the convex hull method. Its key features are:

Minimal system requirements:

This version of TernAPI-C is educational (demonstrational). Functional is non limited except for the impossibility of saving text descriptions of thermodynamic models. After the expiration of trial period the program should be repeatedly downloaded from the site of the laboratory.


2. Model description format

2.1. General information

In TernAPI-C program a thermodynamic model of a ternary system consists of the set of given Gibbs energies functions for all phases in it. Format of these functions depends on the type of phase (stoichiometric, quasibinary solution, ternary solution). Transformation of the model into the phase diagram consists of the next steps:

  1. Calculation of Gibbs energies of all phases in the required range of concentration on the given points grid.
  2. Concatenation of all Gibbs energies surfaces. During the process from several points with the same coordinates (x2,x3) the one with the lowest Gibbs energy value is selected.
  3. The convex hull lower part calculation bye means of qhull library.
  4. Geometry analysis of the obtained convex hull and the phase diagram construction.

Thermodynamic model of the ternary systems should be written in as the associative array in YAML format using Ruby programming language dialect for arithmetic expressions recording. Let's consider a very simple example:

---
name: Hello-world example
description: ! 'TERNAPI "hello-world" example. Taken from
  D.D.Lee. Computer Generation of Binary and Ternary Phase Diagrams
  via a Convex Hull method // J.Phase Equilibria.1992.V.13.N4.P.365'
components:
- {name: A, M: 100.0}
- {name: B, M: 100.0}
- {name: C, M: 100.0}
global:
- {name: t, value: '110'}
phases:
- type: PHASE_SOLUTION
  name: L
  model:
  - -@t*s_id +
  -   2510*(x1*x2+x2*x3+x3*x1)

Elements name and descripiton contain a brief information about the ternary system

Element components keeps the data about the components, i.e. its names (name) and molecular masses (M) in g/mol. These values will be used for the signatures on the phase diagram and for the transformation of mass fractions into molar respectively.

Element global contains model parameters that are common for all phases of the system. These parameters are calculated sequentally from the beginning to the end, i.e. previously calculated parameter can be used in the next parameters. For global parameter usage in a formula you should use the @ prefix before its name (e.g. t transforms into @t).

Element phases contains descriptions of thermodynamic properties of the phases. Let's consider each its field:

Let's consider several examples of thermodynamic model description in the case of all three types of phases.

Example 1. Melt in the Mo-Hf-Re ternary system [Kau72].

Gibbs energy of the melt in this system can be described as:

ΔmixG(x2,x3,T) = -TSid + 300x1x3 - 19264x2x3 - 10767x3x1, cal/(g·atom)

It can be written in the YAML format by the next way:

- name: L
  type: PHASE_SOLUTION
  model:
  - -s_id*@t/CAL + 300*x1*x2 - 19264*x2*x3 - 10767*x3*x1

Example 2. (Bi,Sb)2Au quasibinary solution in the Au(1)-Bi(2)-Sb(3) ternary system [Wan07].

Gibbs energy of mixing of the solution can be written as:

G = -2/3TSid + (1-y)GBi:Au + yGSb:Au

GBi:Au = 5500, J/(g·atom)

GSb:Au = -5450.31 + 12.8064T - 1.63691TlnT, J/(g·atom)

Corresponding text in YAML format:

- type: PHASE_LINE
  name: AuSb_2
  model:
  - g_AuBi2 = 5500.0
  - g_AuSb2 = -5450.31 + 12.8064*@t - 1.63691*@t*Math::log(@t)
  - (1-y)*g_AuBi2 + y*g_AuSb2 - 2.0/3.0*@t*s_id
  xv1: [2/3, 0]
  xv2: [0, 2/3]

Example 3. Mg2Zn3 stoichiometric phase [Lia97].

Gibbs energy of formation from solid components:

ΔfG0 Mg2Zn3 = -11014.5 + 3.67151T, J/(g·atom)

Corresponding associative array:

- name: Mg_2Zn_3
  type: PHASE_COMPOUND
  model:
  - -11014.5 + 3.67151*@t
  xv1: [0.4, 0.6]

2.2. Arithmetic expressions

For descripiton of arithmetic expressions (formulas) a subset of Ruby language extended with the matrix and vector operations subroutines is used in TernAPI program. The most significant differences from the original Ruby are:

The list of the most common operators is given in the Table 1 ordered by priority decreasing.

Table 1. Arithmetic operations
OperatorsDescription
() Arithmetic brackets
[] Brackets for matrix generation and matrix elements addressing
~,+ Matrix transposition and unary plus
** Exponentiation
- Unary minus
*,/,%Element-by-element matrices multiplication and division, algebraic matrices multiplication (i.e. using linear algebra)
+,- Addition and subtraction
& Element-by-element "AND" for logical matrices
|,^ Element-by-element "OR" and "XOR" for logical matrices
<=, =>, <, > Element-by-element matrices comparison (the result is MATLAB-style logical matrix)
==, != Element-by-element matrices comparison (the result is MATLAB-style logical matrix)
=Assignment operator

Sign of arithmetic expression final (as ; in C/C++) is absent but multiline arithmetic expressions are allowed. During its writing a correct line breaking should be taken into account. Let's consider the next expression as the example: ax3+bx2+cx+d.

Correct line breaking:

a*x**3 + b*x**2 +
  c*x + d

In this case the expression will be interpreted as the whole one, i.e. as ax3+bx2+cx+d

Incorrect line breaking:

a*x**3 + b*x**2 
 + c*x + d

In this case the text will be interpreted as two independent algebraic expressions: ax3+bx2 and cx+d (sign + before cx was interpreted as "unary plus").

It is possible to use the next predefined variables in arihmetic expressions:

Table 2. Predefined variables
Name Value Description
R 8.3144621 Universal gas constant
CAL 4.184 Number of joules in calorie
s_id Matrix Ideal entropy of mixing
x1,x2,x3 Matrix Molar fractions of first, second and third components of the solution
y Matrix Molar fraction of the second component of the quasibinary solution
SGTE_Unary Class Class for work with SGTE Unary DB

In addition to numbers the user can also input matrices of floating point numbers. The syntax used for the matrices is not standard for the Ruby language and implemented in TernAPI kernel directly.

Matrix writing example:

a = [[  0,       1216.745,  -1286.518],
     [-210.171,        0,  -1727.670],
     [-823.116, 2971.737,   0]].to_mat

Vector (particular case of matrix) writing example:

v = [[10, 20, 30, 40, 50]].to_mat

Matrices can be used as input parameters of some build-in functions - models implementations (NRTL, UNIQUAC, Redlich-Kister etc.). You can perform arithmetic operations over it. * and / mean element-by-element multiplication and division not operations of matrix multiplication and division from the linear algebra. If you wish to make matrices multiplication use % operator. Transposing is written as ~a.


2.3. Anonymous functions

In some situations it is necessary to either use one algebraic expression several times or pass it to some function (e.g. in Kohler and Muggianu methods). In this case you can create an anonymous function on its basis in the next way:

func = ->arg1,...,argn{expression}

Example of the anonymous function creation (variables a0_12, a1_12 and a2_12 should be defined before this expression):

g12_f = ->x{x*(1-x)*(a0_12 + a1_12*(2*x-1) + a2_12*(1-2*x)**2)}

Anonymous function call is made by the next way::

result = func.(arg1,...,argn)

An example of such call:

g = g12_f.(x1)

More detailed description of anonymous functions is given in lambda method Ruby language documentation


2.4. Built-in functions call

For the simplification of models programming TernAPI-C program contains built-in functions that significantly ease the programming of thermodynamic models. The particular cases are implementations of Redlich-Kister polynomial model, NRTL and UNIQUAC models and Kohler and Muggianu methods. In general case a function without names arguments called as:

output_value = function_name(arg1, arg2, ..., argN)
If the function has named argument (placed in the end and in the arbitrary order), it is called this way:
output_value = function_name(arg1, arg2, ..., :narg1_name => narg1, ..., :nargN_name=> nargN)

Table 3. Built-in functions
Name Noname arguments Named arguments Description
grt_nrtl x1,x2,x3 tau, alpha NRTL model (G/RT)
gadd_bonner x1,x2,x3 gAO_f, gBO_f, gAB_f, gex_f Bonnier method implementation
gadd_koh x1,x2,x3 g23_f, g13_f, g12_f, gex_f Kohler method implementation
gadd_mug x1,x2,x3 g23_f, g13_f, g12_f, gex_f Muggianu method implementation
poly_rkm x1,x2,x3,l2mat,l3func   Redlich-Kister model


2.5. Using LaTeX in the text

TernAPI-C program supports the using of LaTeX language subset in the components and phases names. This subset allows the usage of subscripts and superscripts, Greek letters and some another special symbols. Such subset is enough for the writing chemical formulas and phases name in the most cases Detailed description is given below.

Table 4. Formatting methods
In LaTeX Layout Description
H_2SO_4 H2SO4 Subscript (one symbol)
C_{60} C60 Subscript (many symbols)
x^2 x2 Superscript (one symbol)
A^{solid} Asolid Superscript (several symbols)

Table 5. Special characters
In LaTeX Layout In LaTeX Layout
\alpha α \Alpha Α
\beta β \Beta Β
\gamma γ \Gamma Γ
\delta δ \Delta Δ
\epsilon ε \Epsilon Ε
\lambda λ \Lambda Λ
\mu μ \Mu Μ
\xi ξ \Xi Ξ
\pi π \Pi Π
\rho ρ \Rho Ρ
\sigma σ \Sigma Σ
\tau τ \Tau Τ
\phi φ \Phi Φ
\psi ψ \Psi Ψ
\omega ω \Omega Ω
\cdot

Table 6. Formatting examples
In LaTeX Layout
CuSO_4\cdot5H2_O CuSO4⋅5H2O
\beta^{solid} βsolid


2.6. Experimental data description

TernAPI-C YAML files with thermodynamic models can also keep series of experimental points in the expdata element. This element must contain the next fields:

expdata element also can contain some optional fields:

An example of experimental data description in the Al-Si-C system (see the database):
expdata:
- name: 2000C
  selector: '@t == 2273.15'
  marker: o
  unit: UNIT_MOLAR
  percent: false
  type: EXP_DOTS
  x2_1: [1.0000, 0.8977, 0.7964, 0.7382, 0.6918, 0.5765, 0.4858, 0.4784, 0.3524, 0.2709, 0.2476,
         0.2264, 0.2132, 0.2167, 0.1830, 0.1521, 0.1341, 0.0924, 0.0797, 0.0401, 0.0039]
  x3_1: [0.0000, 0.0055, 0.0034, 0.0030, 0.0027, 0.0234, 0.0137, 0.0151, 0.0464, 0.0658, 0.0962,
         0.0960, 0.0960, 0.0838, 0.0820, 0.0987, 0.1184, 0.1197, 0.1104, 0.1178, 0.0946]

An example of experimental data description in the H2O-(CH3)2CO-NaCl system (see the database):
expdata:
- name: series1
  marker: o
  fillcolor: yellow
  linecolor: red
  type: EXP_TIELINES
  unit: UNIT_MASS
  percent: true
  x2_1: [39.2, 33.9, 30.7, 28.1, 24.4, 22.2, 21.6]
  x3_1: [9.24, 11.0, 12.1, 13.3, 15.1, 16.3, 16.9]
  x2_2: [66.2, 72.1, 74.9, 77.0, 81.0, 83.1, 83.8]
  x3_2: [2.45, 1.60, 1.26, 0.98, 0.70, 0.55, 0.51]

3. Thermodynamic models examples

3.1. Au-Pt-Pd system

According to the literature data [Kub71] the Au-Pt-Pd ternary system in a solid state contains the only one phase, i.e. a solid solution with an immiscibility gap. Its Gibbs energy of mixing can be written as:

ΔmixSex = 3xAxC + 2.9xC2xB + 1.7xCxB2 + 0.9xAxB2 + 3.5xA2xB - 9xAxBxC, cal·(K·g·atom)-1

ΔmixHex = xAxBxC3036-xAxC(11141xA+3065xC) - xBxC(5234xC+3021xB)- xAxB(634xA-5691xB), cal·(g·atom)-1

For this reason the model contains the only one phase — the ternary solid solution.

---
name: Au-Pt-Pd
description: ! "Au-Pt-Pd system at 1200 K"
components:
- {name: Au, M: 196.97}
- {name: Pt, M: 195.08}
- {name: Pd, M: 106.42}
global:
- {name: t, value: '1073'}
phases:
- type: PHASE_SOLUTION
  name: S
  model:
  - xA, xB, xC = x1, x2, x3
  - s = s_id/R - (3*xA*xC+2.9*xC**2*xB+1.7*xC*xB**2 +
  - 0.9*xA*xB**2 + 3.5*xA**2*xB - 9*xA*xB*xC)/(R/CAL)
  - h = (xA*xB*xC*3036-xA*xC*(11141*xA+3065*xC) -
  - xB*xC*(5234*xC+3021*xB)-
  - xA*xB*(634*xA-5691*xB))/(R/CAL)
  - h-@t*s


Fig. 1. The Au-Pt-Pd ternary system phase diagram at T=1073 K


3.2. Mo-Hf-Re system

Let's consider a simplified model of Mo-Hf-Re ternary system from [Kau72] and how to write it in TernAPI program. In contains the next phases:

Liquid phase (L):
GL = -TSid + 300x1x2 - 19264x2x3 - 10767x3x1 , cal·(g·atom)-1

β solid solution:
Gβ = -TSid + 4319x1x2 - 13931x2x3 - 10617x3x1 + x1GMo,β + x2GHf,β + x3GRe,β, cal·(g·atom)-1

ε solid solution:
Gε = -TSid + 6749x1x2 - 8601x2x3 - 10617x3x1 + x1GMo,ε + x2GHf,ε + x3GRe,ε, cal·(g·atom)-1

Solid quasibinary solution λ Hf(Mo,Re)2:
G = 2/3RT((1-y)ln(1-y) + ylny) -8273(1-y)-3929*y +2/3(1-y)GRe,ε + 1/3GHf,ε + 2/3*yGMo,ε, cal/(g*atom), where y - molar fraction of HfMo2

The assessment begins from the choice of components and reference level. In this case the components are Mo, Hf, Re and the reference level is the liquid phase. We begin the model input to the program from the minimal set of necessary data: components description, temperature and liquid phase model:

name: Mo-Hf-Re (Kaufman)
description: ! 'Mo-Hf-Re system At 2273 K Taken from: Kaufman L., Bernstein H. Computer
  calculation of phase diagrams Academic Press - New York and London. 1970. '
global:
- {name: t, value: 2273.0}
components:
- {name: Mo, M: 95.94}
- {name: Hf, M: 178.49}
- {name: Re, M: 186.207}
phases:
- name: L
  type: PHASE_SOLUTION
  model:
  - -s_id*@t/CAL + 300*x1*x2 - 19264*x2*x3 - 10767*x3*x1

The next step is addition of β and ε ternary solid solutions. It is necessary to add stability parameters of components in β and ε modifications to the global section after the parameter t (in this case it is Gibbs energy of a component transition from the liquid state to the corresponding crystallic modification):

- {name: dG_Mo_b, value: -(5800-2*@t)}
- {name: dG_Hf_b, value: -(4990-2*@t)}
- {name: dG_Re_b, value: -(6500-2.4*@t)}
- {name: dG_Mo_e, value: -(3800-2*@t)}
- {name: dG_Hf_e, value: -(6820-2.9*@t)}
- {name: dG_Re_e, value: -(6900-2.0*@t)}
Let's add Gibbs energies of β and ε phases formation to the phases section:
- name: \beta
  type: PHASE_SOLUTION
  model:
  - -s_id*@t/CAL + 4319*x1*x2 - 13931*x2*x3 - 10617*x3*x1 +
  - x1*@dG_Mo_b + x2*@dG_Hf_b + x3*@dG_Re_b
- name: \epsilon
  type: PHASE_SOLUTION
  model:
  - -s_id*@t/CAL + 6749*x1*x2 - 8601*x2*x3 - 10617*x3*x1 +
  - x1*@dG_Mo_e + x2*@dG_Hf_e + x3*@dG_Re_e

The resulting theoretical phase diagram is shown at the Fig. 2a.

Fig. 2. Phase diagram of the Mo-Hf-Re system at T=2273 K (a) without λ phase; (b) with λ phase

A slightly more complicated thing is the addition of the λ quasibinary solution. In addition of its thermodynamic model it is necessary to set the composition of the first and the second quasicomponents in the molar fractions of the second and the third components. The first quasicomponent HfRe2 corresponds to the (1/3, 2/3) composition, and the second quasicomponent HfMo2 - to the (1/3, 0) composition. Note that PHASE_LINE phase type corresponds to the quasibinary solution.

- name: \lambda
  type: PHASE_LINE
  xv1: [1/3, 2/3]
  xv2: [1/3, 0]
  model:
  - g_id = (2*(1-y)*@dG_Re_e + @dG_Hf_e + 2*y*@dG_Mo_e) / 3 - 2/3*s_id*@t/CAL
  - g_ex = -8273*(1-y)-3929*y
  - g_id + g_ex

The resulting theoretical phase diagram is shown at the Fig. 2b.


3.3. Ga-In-Sb system

The Ga-In-Sb ternary system [Jia94],[Bre83] is interesting as the example of coexistence of the all three types of phases (ternary and quasibinary solutions and also stoichiometric phases) and used some of TernAPI built-in functions. As in the previous examples we begin programming of the systems from the writing of global parameters and components properties:

---
name: Ga-In-Sb
description: ! "Ga-In-Sb Ternary Phase Diagram"
components:
- {name: Ga, M: 69.723}
- {name: In, M: 114.818}
- {name: Sb, M: 121.76}
global:
- {name: t, value: '800.0'}
- name: sgte
  value: SGTE_Unary.new

Pay attention to the sgte global parameter: it provides the loading of database with the stability parameters of the elements allotropic modifications.

Let's add thermodynamic models (stability parameters relative to liquid components) of the solid Ga, In and Sb:

phases:
- type: PHASE_COMPOUND
  name: Ga_s
  model:
  - ! '@sgte.calc_g(''Ga'', [''ORTHORHOMBIC_GA'',''LIQUID''], @t)'
  xv1: [0, 0]
- type: PHASE_COMPOUND
  name: In_s
  model:
  - g = @sgte.calc_g('In', ['TETRAGONAL_A6','LIQUID'], @t)
  xv1: [1, 0]
- type: PHASE_COMPOUND
  name: Sb_s
  model:
  - g = @sgte.calc_g('Sb', ['RHOMBOHEDRAL_A7','LIQUID'], @t)
  xv1: [0, 0]

The next step is the additions of liquid ternary solution. Excess Gibbs energies of its binary systems can be described as:

ΔmixG(InSb) = (1-xIn)xIn( (-25631.2+102.9324T-13.45816TlnT)+ (2xIn-1)(-2115.4-1.31907T) + 2908.9(2xIn-1)2), J·(g·atom)-1

ΔmixG(GaSb) = (1-xGa)xGa( (-13953.8+71.07866T-9.6232TlnT)+ (2xGa-1)(1722.9-1.92588T) + 2128.3(2xGa-1)2 ), J·(g·atom)-1

ΔmixG(GaIn) = (1-xGa)xGa( 0.25943T(2xGa-1) + (4450.0+1.19185T) ), J·(g·atom)-1

Excess Gibbs energy of the ternary solution can be described as:

ΔmixG(GaInSb) = xGaxInxSb(-5072.76-10.8842T) J·(g·atom)-1 Muggianu method is used to obtain Gibbs energy of the ternary solution on the basis of the Gibbs energies of its binary subsystems:

- type: PHASE_SOLUTION
  name: L
  model:
  - g23_f = ->x2{ (1-x2)*x2*(
  -   (-25631.2+102.9324*@t-13.45816*@t*ln(@t))+
  -   (2*x2-1)*(-2115.4-1.31907*@t) + (2*x2-1)**2 * 2908.9 ) }
  - g13_f = ->x1{ (1-x1)*x1*(
  -   (-13953.8+71.07866*@t-9.6232*@t*ln(@t))+
  -   (2*x1-1)*(1722.9-1.92588*@t) + (2*x1-1)**2 * 2128.3 ) }
  - g12_f = ->x1{ (1-x1)*x1*(
  -   (2*x1-1)*(0.25943*@t) + (4450.0+1.19185*@t)) }
  - gex_f = ->x2,x3 {(1-x2-x3)*x2*x3*(-5072.76-10.8842*@t) }
  - -@t*s_id + gadd_mug(x1,x2,x3, :g23_f=>g23_f, :g13_f=>g13_f, :g12_f=>g12_f,:gex_f=>gex_f)

(Ga,In)Sb quasibinary solution is written as:

- type: PHASE_LINE
  name: \alpha
  model:
  - 0.5 * (
  - (1-y)*CAL*(-16300+13.1*@t) + y*CAL*(-13270+11.53*@t) +
  - (1-y)*y*(9093.00-2.8698*@t) - @t*s_id )
  xv1: [0.0, 0.5]
  xv2: [0.5, 0.5]

On the Fig. 3. the calculated phase diagram of the Ga-In-Sb system is shown.


Fig. 3. The Ga-In-Sb system phase diagram at T=800 K


4. User interface

4.1. The main window of the program

On the Fig. 4 the main window of TernAPI program opening immediately after start is shown. It contains the list of systems in the database (left part), the field with the text description of the current system (right part), and the menu and toolbar (upper part).


Fig. 4. The program main menu

Menu items functions:

Menu item Function
File Thermodynamic models databases loading and saving
File-New Create a new empty database
File-Open Open database
File-Save Save database
File-Save as... Save database in the file with another name
File-Exit Finish the work
System Database records management
System-Create Create a new system
System-Rename Rename the current system
System-Delete Delete the current system
Diagram Phase diagram calculation management
Diagram-Calculate Calculate an isobaric-isothermal section of the current system
Diagram-Polythermal calculation Calculate a polythermal phase diagram of the current system
Diagram-Polythermal viewer Construction of polythermal sections of precalculated polythermal diagram from file
Diagram-Gibbs triangle settings Set the phase diagram calculation accuracy (in dots per axis, dnum) and parameters of Gibbs-Roozeboom triangle visualization
Help Documentation
Help-Help Show the detailed help (i.e. this document)
Help-About the program Show the information about the program version and active license

4.2. A window with isobaric-isothermal section

This window is showed when the calculation of p-T—section of phase diagram is finished. Besides menu items and toolbar buttons a mouse can be used for diagram layout control. The next operations are supported:
Mouse event Executed operation
Right button click Show composition and list of phases
Scroll whell Change a scale
Drag-and-Drop Change (shift) viewed part of the diagram

5. Addition of custom functions

It is typical for Gibbs energy function to have a complex analytical layout that can make it difficult to write it entirely inside a YAML file. To solve this problem TernAPI supports three types of user's functions: Ruby scripts, functions inside DLL and MATLAB functions.

To load Ruby scripts or DLL with function it is necessary to add them into functions.cfg file. The format of the file is described just inside it (in comments). Examples are provided (see plugins directory) for each of three user's functions types that were mentioned above.

Warning! The loading of all plugins is disabled in the functions.cfg file by default. If you wish to work with the examples uncomment corresponding lines of the file.

5.1. Ruby scripts

These scripts are text files with programs written in Ruby (without usage of YAML markup language). They can contain functions and classes definitions, initialization procedures etc. An example of scripts in Ruby can be found in the plugins folder.

Besides text files in Ruby it is possible to load Ruby C extensions. During writing of their code it should be taken into account that TernAPI kernel uses its own MLSMatrix class for the representation of matrices. Some important properties of this class are:

If you wish to use a function written in C, Fortran or another compiled languages it is preferrable to write DLL with that function(см. раздел 5.2) not Ruby C extension.

5.2. DLL with functions inside

This method is designed for writing functions using compiled languages (such as C, Fortran etc.) suitable for calling from TernAPI scripts. An example of such DLL written in C language is in the plugins/customBinFunc.c file. The DLL must contain the next functions:

extern const char *name() Returns a pointer to the function name
extern void *body(int argc, void **argv, void *context) The function implementation. Input and output arguments are Ruby objects

Use tapi_rbvar_*** functions of libtapikernel.dll library to work with Ruby objects. You can find prototypes of these functions in C inside plugins/tapigate.h file

5.3. Functions written in MATLAB

TernAPI kernel supports calling MATLAB functions by means of MATLAB Engine. This feature requires installed MATLAB. The next data types are supported: 2-dimensional real numbers matrices, strings, structs. MATLAB struct matches Ruby Hash (associative array).

To activate this feature the plugins/mateng.rb extension must be loaded and pathes to the MATLAB libraries be present in the PATH environment variable (see gui_with_matlab.vbs as an example).


6. Changelog

26.01.2016TernAPI-C 1.4
 
  • Possibility of composition exploration at polythermal sections
  • p,T-sections internal viewer has been improved
  • Command-line version
  • Experimental x64 version (uses Ruby 2.2)
  • Call of external functions and MATLAB interface
11.02.2015TernAPI-C 1.3
 
  • Interface has been slightly improved
  • Bug in polythermal sections construction bug has been fixed: in some cases swapping of left and right sides of the diagram in some cases
  • Simplified structure of the distribution, the kernel has been packed into libtapikernel.dll
  • Initial Wine support
  • Ruby 1.9.3 has been updated to the build p551
15.08.2014TernAPI-C 1.2
  Bugfix: problem with running from folder with cyrillic name.
12.08.2014TernAPI-C 1.1
 
  • Extension of supported LaTeX symbols subset
  • Bonnier-Caboz model and new examples added
  • Experimental data selectors
  • Bugfixes
27.03.2014TernAPI-C 1.0
  Russian and English versions of the program. Bugfixes.
12.01.2014TernAPI-C 1.0b
  First public version of the program.

7. Bibliography

[Kau72] L. Kaufman and H. Bernstein, Computer Calculation of Phase Diagrams. Academic, New York, 1970.
[Wan07] Wang J., Meng F.G., Liu H.S., Liu L.B., Zin Z.P. Thermodynamic modeling of the Au-Bi-Sb ternary system // J. Electron. Mater. 2007. V.36(5). P.568-77.
[Lia97] Liang H., Chen S.-L., Chang Y.A. A thermodynamic description of the Al-Mg-Zn system // Met. Mater. Trans. A. 1997. V.28A. P.1725-1734.
[Kub71] Kubaschewski O., Counsell J.F. Thermodynamische eigenschaften des systems Gold-Platin-Palladium // Monatshefte fur Chemie. 1971. B. 102. N 6. S. 1724-1728.
[Jia94] Jianrong Y., Watson. A. An assesment of phase diagram and thermodynamic properties of the Gallium-Indium-Antimony system // Calphad.1994. V.18.N2.P.165-175.
[Din91] Dinsdale A.T. SGTE Data for pure elements // Calphad. 1991. V.15(4). P.317-425.
[Bre83] Brebrick R.F., Ching-Hua-Su and Liao Pok-Kai. Associated Solution Model for 'Ga-In-Sb' and 'Hg-Cd-Te'. // Semiconductors and Semimetals, Academic Press, Chap.3. N.-Y. 1983
[Мор03]Морачевский А.Г., Воронин Г.Ф., Гейдерих В.А., Куценок И.Б. Электрохимические методы исследования в термодинамике металлических систем. Москва, ИКЦ "Академкнига", 2003. 334 с.
[Landolt] Landolt-Bornstein. Numerical Data and Functional Relationships in Science and Technology (Editor in Chief: W.Martienssen. Group IV: Physical Chemistry V.11. Ternary Alloy Systems. Subvolume C. Part 1.