COMPUTER MIXTURES
(Rcccivd
CALCULATION IN SOLUTION
4th February
OF THE
COMPOSITION
OF
EQUILIBRIUM
1974)
The calculation of the equilibrium concentrations of species in chemical systems involving several interacting reactions is gcncrally difficult; graphicit methods’ have been used with SUCCC’SS. but for more complicittd CLLSCSiterative methods. carried out with the itid of a digital computer, ilre mot-c suitilblc. Computer programs have been written to perform calculations of the above sort, notiibly HALTAFALL’ and COMICS3. Both these programs have a wide applicability extending to calculations in multi-metal-multi-ligand i\nd (HALTAFALL) multiphase systems. For many purposes. the chemist does not require a program of such a comprchcnsive nature, but one dealing with reactions between two components and their side-reactionswith hydrogen or hydroxide ions. The present paper describes an ALGOL program for calculating the concentrations of spccics in the following systems: (i) metal-ligand equilibria, including protonatcd and hydrolysed spccics; (ii) lYICtill hydrolysis equilibria involving one or two metals; (iii) weak acid equilibria involving one or two polybasic iicids and including weak acid-weak base equilibria. The program allows for the presence of iI strong itcid or it strong base in all the above instances. METHOD
x1. TA and 7;, rcprcsent the total metal. total l&and and ilnalyticill hydrogen ion concentrations. respectively. T, iind r, arc total concentrations of strong acid and strong base added. The general stability con?;tant Knlho is defined by cqn. ( I): K
[Mm hA,l
“VhU =
[M)"'[H-,h[A]U
(1)
(For hydroxy complexes see note (vi) below). The concentration, c,&,,, of any species is given by eqn. (2) iind the calculated total metal, (L’~,), total ligand. ((a,,), and analytical hydrogen, (c.,,), by eqns. (3)-(5), respectively. cmhu =
Km,,,,CMl”CHlhCA1” m-/I
CM
= [M J +
c t?tc&, n,= 1
H. S. DUNSMORE.
122 0
(‘A
=
CA1+
=
D. MIDGLEY
r
c
(4)
(lc,,,/,cr
,I’,
/I =
=
=tt
[HI - [OHI +
r,
c
k,,w
(5)
h = I
where
p, (1 and I* arc the maximum values of ))I. II and WC can now define the following functions:
(I. respectively.
Fst = r., - cil . F,, = T, - c,\ .
IT the stability
constants arc known. by substituting values of [Ml, [H] and [A] in the functions &,. FA and F,, can be evaluated. The correct values of the concentrations are those for which i;;, = FA = F,,=O. If a set of estimates of [Ml, [A] and [H] lcads to non-zero values FL,. Fi. F;,. the shifts (X,, X,,. XI,) in the concentrations that will simultaneously minimize the three functions can be CalculiItcd from eqns. (6)-(8) iti which FM. F,, and F,, arc expanded in Taylor’s series as far as the lirst order terms.
cqns. (2)<5),
F~,=F,;+G~:X,,+G~X,+G:lX,,=O F,, = Fi+@:X.s,+
G;X,,+
(6) G,HX,, =0
Ft, = F;,+~:X~,+G;:X~+GI:X,,
=0
(7) (8)
where G:
=
&
Vi,)
l
Gti =
&,
(/;h(), etc.
using the cstimatcs of [Ml, The functions G:i. Gc etc. can be quantified [A] and [HI, and cqns. (6)-(8) can be solved simultaneously for the shifts. The procedure is repeated with the new estimates of the concentrations and so on until the functions FI,, FA and Ft, arc all satisfied within a specified convergence Ii&t. Equations (6)-(8) are solved by means of a matrix inversion procedure used by Blackburn4. The above type of procedure has been used (without the proton function) in SCOGS’ and GAUSS G”, which arc FORTRAN programs for calculating equilibrium constants from pH data. Starting from a similar mathematical basis, Ting-Po I and Nancollas’ have written a more complicated general program which also incorporates activity coefficient corrections.
(i) Calculations can bc pcrformcd for systems involving several equilibria. (ii) At the end of calculations with one set of equilibrium constants, any or all of these constants can be changed, or others added, and the calculations repeated with starting values of concentrations equal to the equilibrium values obtained with the lirst set.
COMPUTATION
FOR
EQUILIBRIUM
123
MIXTURES
(iii) The convergence parameter is normally set to 10 -*. i.e. 0.1’2; error, but is adjustable. (iv) Allowance is made for the presence of strong acid and/or strong base. (v) Initial estimates of the free concentrations of one or both of the ligands TABLE
I
INPUT
FOR
P
n ni mt limit EXI EX2 EX3 ihs il bil ckwl ivx itx mm mn ml C
Cl
bb u ch hcl Cl
THE
PROGRAM
--An intcgcr indicating 1hc type of input ( = 5 if both mcral and lignnd prcscnt. 6 for lig:ond only. 4 for two ligands) An intcgcr cquol to 1hc number of equilibrium constants. excluding the autoprotolysis constant. IO bc used in ;I particular trial An intcgcr. used only for sc11ing array dimensions. equal to 1hc largest number of cuns1an1s IO bc used in any trial of one inpu1 An intcgcr equal to the number of data points in 1hc calculation An intcgcr cquill to the maximum number of itcrutions allowed Convcrgcncc p;ir;lmctcr in lhc lOtill mclal conccntralion Convcrgcncc parnmctcr in the total l&and conccnlration Convcrgcncc pitrilmctcr in 1hc nnulyticnl hydrogen conccnlration An inrcgcr. indicarcs prcscncc of strong acid if ihs = 2 An intcgcr equal to the number of protons per lig.nnd molcculc An inrcgcr cqunl IO the number of protons on the second ligand “M” (rcild in only if p=4) Autoprololysis constant for WiltCr An intcgcr. indiciltcs thilt cstimatcs of [M] arc to bc supplied if ivx== 1 An intcgcr. indicates that cstimnrcs of [A] arc to bc supplied if itx= I An intcgcr equal IO the numbcr of mc1;ll ions An intcgcr cqunl to the numbcr of protons in An intcgcr equal lo the number of lignnds in the number of hydroxide ions Logarithm of the overall stitbility constant of Total ligand conccnlration Total metal conccntra1ion Estimntc of pH Concentration of strong bilsc Concentration of strong acid (read
hcl
Total lignnd conccnlrcltion Conccntrirtion of strong base Estimate of pH Concentration of s1rong acid (read
vvx ttx
Estimate Estimate
ch U
n j
in the complex
the complex Ihc complex.
I
1hc complex
Read only if p=4 or 5 ml sets only
if ihs=
I
2)
Read only ml sets only
if ihs=
2)
I
If last basic symbol was ;I colon, rcdd in a new vclluc for The number of equilibrium constants followed by an intcgcr. the index the jth complex. then rcild in values of ml. mm. mn nnd c for the jth complex was un ustcrisk.
return
IO
if p=G
1
of [M] (read only if ivx = I) of [A] (rend only if itx = 1)
If the last basic symbol fresh batch of dtitil
n sets
or minus
the start
;lnd tiwitit
m1 sets
Up to ni scls
1.1.S. DUNSMORE.
124
D. MIDGLEY
or metals participating in tho equilibriu may bc supplied to the program, otherwise the free concentrations ;Irt’ initially set equal to the total concentrations. (vi) Equilibrium constants. including those relating to acid dissociittion reactions, ilre supplied to the program in the form of the logarithms of the over:tII stability constants. Hydroxide-containing cornplexcs arc characterized by a negative proton index. thus it complex M(OH)A with iI stability constant /I=[M(OH)A]/ ils MH _ I A with a constant K = : [M(OH)AJ[H] )/ : [WCOHI~N 1 is cntcred where K,,. is thr: autoprotolysis constilnt for water. I [MJ[A]: =ljh’,,. (vii) The program calculates the sum of the squares of the deviations bctwecn the input and ciIlculiltcd pH V:I~UCS.thus providing u check on the goodness of fit when cxpcrimental pH datil arc processed with different sets of equilibrium constants. (viii) No iIllowiInCC is made for activity coefficient effects. (ix) As filr us possible, ALGOL identifiers in the program correspond to FORTRAN \‘itriilblcs in the program GAUSS G. (x) A limit to the number of iterations to be pcrformcd is supplied to the program. If this limit is reached the results are printed with the label *FALSE. (xi) The concentrations of M. A. and H arc calculated simultaneously. which should take less computing time than the consecutive calculiltion used in HALTAFALL i\nd COMICS. The full program is ;tvilililble 011 request.. The input for the program is outlined in Tnble I. This input scheme relates to the normal modes of operation systems and weak acid-proton systems. of the program. i.c.. metal-proton-ligand For mixtures of two wcuk acids or in weak ilcid plus ~1 weilk bilsc. the symbols characteristic of the metal (EX 1. ivx. mm. bb, vvx) bccomc the property of the second acid or weak base. togcthcr with the IICW symbol, bit. For hydrolysis reactions of one metal, the program is entered with p=6 ilnd the symbols churilcteristic of the weilk acid are trunsferrcd to the tnctal (EX2, it. itx, ml, cl, ttx), with mm=ivx=O. For hydrolysis equilibria in mixtures of two metals. the symbols
TABLE
II
DATA FOR A SYSTEM OF DIL)AStC WEAK OF DIFFERENT AMOUNTS OF SODIUM
ACID-METAL HYDROXIDE
COMPLEXING
(log iiO,) =J.O. log h’,*a = 7.0. log h’,o, =3.0. log A: ,oz=6.0, .-- _._.._------__.-.-. . ._-.. -_-_--____--.._-_-._-_ IO" 7;, ( tttol I - ’ ) ___._.-___-_____.-.-
lo’ [ NctOli] 1iP 7A ( IflO/ I ‘. ’ ) (Wl I- ‘) ..__ __. - ________ __.
I 2 3
5.0 5.0 5.0
5.0 5.0 5.0
P&c
Io.‘[Hn ( tml -_-
2.6263 3.2077 4.0130 --
I.241 1 I .7054 0.6324
Poitcl
-___-_-----.I 2 3
J I - ’ ) _.__ -.--.----_-
_------__-
IN THE
tog A,. , , =6.0. log h’, = _....-.___-- .._..____
P II,” _. ___- --._. -----------_----.
Io’[.M (Wd
J I-‘)
PRESENCE
14.0) .---’ I(p[A] (tlWl I - ’ )
0.0 5.0 9.0
2.5 3.0 4.0
4.2396 3.2865 2.3373
0.5250 2.7514 6.5154
10’[11~AJ ( W~l I - ’ )
lO”MA] (wol I - ’ ) --------..-.--._--
IO’[MA~/ ( m>l I - ’ )
lO’[MIIA] (twl I - ’ )
2.9343 1.0571 0.0614
’ 7757 _.L_. 9.0424 15.229
0.1 I 68 2.4879 9.9220
5.26!9 5.6049 I .4780
--_-_-------.-----
.-
COMPUTATION TABLE
FOR
EQUlLlBRllJM
MIXTURES
125
111
NUMBER OF ITERATIONS --_--_-..--_-~.__-__--_---_____-_~ P0iIll
REQUIRED
FOR
DIFFERENT
INITIAL
ESTIMATES
7;r”
Ed, b
r,l
E.,,
-4,
0.1 E,,,
Lnb
E,
T,
0.1 E,
$1
0. I t<, 0. I E,
0.9 E.,, 0.9 E,,
1.1 .k&,
TAu
I
x
z 3 ---
8 7 -----_
4 4 2
4 4 3
8 7 6
5 6 5
7 7 7
6 5 7
4 4 4
4 4 3
-
_---
1.1 E”
--
and T, arc the total metal and ligand concentrations. rcspcctivcly. h E3, and E,, arc the quilibrium free metal and free ligand conccntr;ltions.
a x,
normally associated ml. cl. ttx).
with
the ligand
are attached
to the second
metal
(EX2,
a. itx,
DISCUSSION
The program has been run successfully on an English Electric-Leo-Marconi KDF.9 computer in all the modes referred to above. The effect of the accuracy of the initial cstimatcs of the concentrations on run-time was tcstcd as follows. The equilibrium concentrations of all the species present in mixtures of a dibasic weak acid with a metal ion with which it forms complexes were calculated for different pH values. The input data and equilibrium concentrations for three points arc given in Table II. The calculations were carried out with different initial estimates for the fret metal and free l&and concentrations, and the number of iterations mxcssary in each case is shown in Table III for the three points. Regardless of the initial estimates, the equilibrium concentrations were reproduced with differences no greater than 1 in the fifth significant figure. illthough the convergence parameters were 0.1 ‘x, of each of the total concentrations. Such accuracy should bc adequate for most purposes. It can bc seen from Table III that, as expected, the more the free concentrations differ from the total concentrations, the more economical it is to USC good initial estimates. Even estimates in error by a factor of ten may be better than the total concentrations. Since the same approximate input pH values were used each time, the calculations never stopped after only one cycle, even when equilibrium values of free metal and free ligand concentrations were supplied to the program. SUMMARY
A computer program has been written to the species in the following systems: (1) metal-ligand equilibria involving one or two metals; (3) weak two polybnsic acids and including weak acid-weak protonatcd species arc ailowed for. The necessary of the components, the equilibrium constants and
calculate the concentrations of equilibria; (2) metal hydrolysis acid equilibria involving one or base equilibria. Hydrolysed and data are the total concetitrations an estimate of the pH.
126
l-i. S. DUNSMORE.
D. MIDGLEY
REFERENCES I L. G. Silltin in I. M. Koithoff and P. J. Elving (Eds.). Tm~~risr O)I Atco/j.ricxtl Clrr~~r~srr~. Part Vol. IB. Intcrscicncc. New York, 1959. 2 N. Ingri. W. Kakolowicr. L. G. Sillen and B. W;lrnqvist. Tttlmrtr. I4 (1967) 1261. 3 D. D. Pcrrin and I. G. S;cycc. Taltrj~rcc. I4 (1967) 833. 4 J. A. Blackburn. Amt/. Cl~em.. 37 (1965) 1000. 5 1. G. Suycc. Ttilu~tftr. 15 (1968) 1397. 6 R. S. Tobias and M. Ytisudu. f~torg. Cltsttt.. 2 ( 1963) 1307. 7 Ting-Po I and G. H. Nancollas. Atto/. Chrm. 44 ( 1971) 1940.
I.