Chemical Equilibrium
LMA — Law of Mass Action
Consider the chemical reaction between educts A, B and products C, D:
(1.1)  a A + b B ⟷ c C + d D 
with a, b, c, and d as stoichiometric coefficients. The leftright arrow tells us that the reaction proceeds in both directions: forwards and backwards. It is quite common to replace the leftright arrow with an equals sign.
When equilibrium is reached, the forward and the backward rates become equal, and the amount of educts and products obeys the fundamental law of mass action:
(1.2)  \(K \ = \ \dfrac{\{C\}^c\{D\}^d}{\{A\}^a\{B\}^b}\)  (Law of Mass Action) 
K is called the equilibrium constant. This law is simple and yet universal and powerful. It describes aqueous speciation (including acidbase and redox reactions), solid phase and gas equilibria, ion exchange, surface complexation, and other phenomena. Thus, it is not surprising that the massaction law forms the backbone of many approaches in hydrochemistry — including PhreeqC and aqion.
The ratio in 1.2 is often interpreted as a ratio of molar (mol/L) or molal (mol/kg) concentrations. This, however, only applies to infinitely diluted systems. In the case of real solutions, the concentrations should be replaced by activities. We emphasize this by using curly brackets {..} for activities in 1.2, while square brackets [..] are reserved for molar concentrations.
Equilibrium Constants
Our central quantity is the equilibrium constant K. Its value describes something like the degree of completeness of the reaction when equilibrium is established:
K  K  

1  0  ½ of the educts have changed into products (50 of the reaction is complete)  
10^{10}  10  reaction is very incomplete  
10^{10}  10  reaction is almost complete 
Since K varies over several orders of magnitude, it is more convenient to work with the decadic logarithm of K, K, rather than with K itself. Equation (1.2) then becomes:^{1}
(2.1)  lg K = c · lg {C} + d · lg {D} – a · lg {A} – b · lg {B} 
Instead of K, the pK value is also often used:
(2.2)  pK = – K 
which parallels the definition of pH as – {H^{+}}.
Simple Rules. The reaction formula in 1.1 determines the form of 1.2. Other reactions with more or with less educts and/or products lead to other formulas of K. Let’s consider the most simple reaction type A ⟷ B with K = {B}/{A} and what happens when we manipulate it:
(2.3a)  reaction  A ⟷ B  K  K  
(2.3b)  reverse reaction  B ⟷ A  1/K  – K  
(2.3c)  multiplication by 2  2 A ⟷ 2 B  K^{2}  2 K  
(2.3d)  division by 2  ½ A ⟷ ½ B  K^{½}  ½ K  
(2.3e)  twostep reaction  A ⟷ B (with K_{1})  K_{1} · K_{2}  K_{1} + K_{2}  
B ⟷ C (with K_{2}) 
Thermodynamic Data (log K Values)
Two things are necessary to perform an equilibrium calculation:
• the model:  LMA algorithm  (e.g. PhreeqC, aqion, …) 
• thermodynamic data:  lg K values  (e.g. wateq4f^{2}, …) 
The role of the thermodynamic data cannot be overestimated. Models are empty shells unless thermodynamic data breathes life into them.
Today there are dozens of software tools in hydrochemistry. The vast majority of them are LMAbased and of high numerical accuracy. Using the same input water and the same thermodynamic data the calculations will lead to the same results. In practice, however, each software has its own thdyn database, so the same input can lead to different results (i.e. speciation, saturation indices, etc.).
Extensive model calculations (and comparisons) have shown that the cause of different results almost always lies in the differences between the thdyn data used. The question, “Which software was used?” is incomplete. One should always ask additionally: “Which database was used?”
Inside the Database. The thdyn database^{3} comprises at least two items for each species:
 the reaction formula (stoichiometry)
 the K value
Example. The 1^{st} dissociation step of sulfuric acid (at 25) is defined by the entry:
H+ + SO42 = HSO4
log_k 1.988
Note 1. The K value is only meaningful in context with the chemical reaction formula (1.1). For example, if you reverse the order in 1.1 to cC + dD ⟷ aA + bB, then K changes its sign from K to – K.
Note 2. The K is temperature dependent. The conversion of K from standard temperature (25) to other temperatures is described here.
Stoichiometric Coefficients
As we have learned above, the K value and the reaction formula are inseparable things. It is a good idea to always take and write both together (in one line):
(3.1)  a A + b B ⟷ c C + d D  lg K 
This line contains three pieces of information:
 the stoichiometric coefficients (a, b, c, d)
 the names of the constituents (A, B, C, D)
 the equilibrium constant (in form of K)
To emphasize the similarity with an algebraic equation, we replace the rightleft arrow in the reaction formula by an equals sign and move all terms to the right side of the equation:
(3.2)  0 = c C + d D – a A – b B 
or, more generally:
(3.3)  \(0\ =\ \sum\limits_i \, \nu_i A_i\) 
where A_{i} (= A, B, C, D) denotes the i^{th} chemical constituent and the small Greek letter \(\nu_i\) symbolizes the corresponding stoichiometric coefficient with the convention: \(\nu_i>0\) for products and \(\nu_i<0\) for educts. Stoichiometric coefficients are often overlooked, but they play an important role (along with the sign convention for educts and products).
Conditional Equilibrium Constants
There is some relaxed version of the massaction law based on concentrations alone (rather then activities). In contrast to 1.2, it relies on a socalled conditional or apparent equilibrium constant:
(4.1)  \(^cK \ =\ \dfrac{[C\,]^c \,[D\,]^d}{[A\,]^a \,[B\,]^b}\) 
Since concentrations are converted to activities by \(\{i\} = \gamma_i\, [i]\), the conditional equilibrium constant ^{c}K is related to the thermodynamic equilibrium constant K by
(4.2)  \(^cK \ =\ \left[ \dfrac{\gamma_c \,\gamma_d}{\gamma_a \, \gamma_b} \right]^{1} \ K\) 
For sufficiently dilute solutions, i.e. when activity coefficients are \(\gamma_i = 1\), both equilibrium constants become equal: ^{c}K = K.
Again, the conditional equilibrium constant ^{c}K can be abbreviated by p^{c}K = – ^{c}K, which yields the relation:
(4.3)  \(p\,^cK \,=\, pK  (\lg\gamma_a + \lg\gamma_b  \lg\gamma_c  \lg\gamma_d)\) 
log K as an “Energy”
There is a fundamental relationship between the equilibrium constant K and the Gibbs energy change:^{4}
(5.1)  ΔG^{0} = – RT ln K 
where R = 8.314 J mol^{1 }K^{1} is the gas constant and T the absolute temperature in Kelvin. This equation can be rearranged to:^{5}
(5.2)  \(\lg K = \dfrac{\Delta G^{0}}{\ln 10 \,\cdot RT} \, = \dfrac{\Delta G^{0}}{2.3 \,\cdot RT}\) 
These equations only apply to the thermodynamic equilibrium constant K (and not to ^{c}K). And, the log K value — in contrast to K itself — behaves like an “energy”, which according to (2.3e) is also additive.
The temperature dependence of ΔG^{0} and K is discussed here.
Gibbs Energy. Beginners sometimes have trouble with the notation “ΔG^{0}”. There are at least three questions.
 Question 1: Why ΔG and not G itself?
A fundamental property of energy is that there is no absolute energy; only differences in energy are meaningful (which are measurable quantities). In our case, ΔG is the difference between the energies of the products and the educts. Infinitesimally small changes are abbreviated by dG.
 Question 2: Why this Gibbs energy?
Of all energy types (internal energy U, enthalpy H, Helmholtz free energy A), the Gibbs energy is tailored for chemical reactions in which the particle numbers change, i.e. dn_{i} ≠ 0. Under typical lab conditions (i.e. constant temperature and constant pressure), dG or ΔG are associated with the chemical potential μ_{i} of the species i:
(5.3)  dG = Σ_{i} μ_{i} dn_{i}  or  ΔG = Σ_{i} μ_{i} \(\nu_i\) 
The first equation is the GibbsDuhem relation; the second equation is obtained after integration of the first one.^{6} In the last equation, the particle change dn_{i} is replaced by the stoichiometric coefficients \(\nu_i\) (which are wellknown quantities taken from the reaction formula).
 Question 3: What is the meaning of the superscript “0” in ΔG^{0}?
ΔG is the Gibbs energy change of any state, which may be a nonequilibrium or an equilibrium state; ΔG^{0} refers exclusively to the equilibrium state. Both are related by:
(5.4)  ΔG = ΔG^{0} + RT ln Q  with  \(Q \ = \ \dfrac{\{C\}^c\{D\}^d}{\{A\}^a\{B\}^b}\) 
Here, Q is the reaction quotient — a sort of “nonequilibrium constant”. In the special case ΔG = 0, Q becomes the equilibrium constant K in 1.2 and 5.3 reduces to:
(5.5)  ΔG^{0} = Σ_{i} μ^{0}_{i} ν_{i} 
where μ^{0}_{i} is the standard chemical potential of the species i (that can be looked up in tables).
Chemical Equilibrium from Two Perspectives
The concept of chemical equilibrium seems simple and obvious to us today. The way to understand this phenomenon, however, was long. Historically, there are two approaches to chemical equilibrium that came from opposite sides: from reaction kinetics and from classical thermodynamics.
From Reaction Kinetics. The kinetic approach relies on the temporal changes of educts and products. Experiments have shown that a forward reaction A ⟶ B is always accompanied by a backward reaction B ⟶ A. The velocity of the forward (backward) reaction depends on the concentration of educts (products):^{7}
(6.1a)  v_{f} = k_{f} · [educts]  
(6.1b)  v_{b} = k_{b} · [products] 
where the proportionality constants are the rates: k_{f} and k_{b}. During the reaction, the amount of educts shrinks and the v_{f} decreases; vice versa, the amount of products rises and v_{b} increases. Over time, the forward and backward velocities converge.^{8} The chemical equilibrium is established when they become equal: v_{f} = v_{b}.
Since v_{f} and v_{b} are always nonzero, the reactions do not stop, but come to equilibrium (which then lasts forever if it is not disturbed).
From Thermodynamics. The second approach was a physicomath approach. In 1873, Josiah Willard Gibbs introduced the idea of the chemical potential μ and its relationship to the free energy ΔG. It was the marriage of chemistry with classical thermodynamics.
Equilibrium is attained when the Gibbs energy is at its minimum value.
In fact, the first approach is easier to understand; it observes how educts and products evolve over time. In contrast, thermodynamics doesn’t know what “time” is. In thermodynamics, the physical quantity “time” is replaced by the abstract term “energy”.
Effect of Temperature T and Pressure P
At this point a short but important statement: The K value is (strongly) Tdependent, but not dependent on pressure P.
In the thermodynamic jargon, it is expressed in this way:
The insensitivity of K to pressure results from the fact that the overall volume change ΔV^{0} of liquids and solids is negligible in typical hydrochemical applications — in quite contrast to gases.
Remarks & References

Outside the Englishspeaking world, the term “K” is used instead of K. In the following, we will treat K and K as synonyms. ↩

JW Ball and DK Nordstrom: WATEQ4F – User’s manual with revised thermodynamic data base and test cases for calculating speciation of major, trace and redox elements in natural waters, USGS OpenFile Report 90129, 185 p, 1991. ↩

The thermodynamic database wate4f is a plaintext file (with about 3800 lines) located in the program’s subdirectory
LIB
. ↩ 
“Gibbs energy” is the recommended name; it should replace the old name “Gibbs free energy”. ↩

ln x is the abbreviation for the natural logarithm log_{e} x. ↩

The integration variable dn_{i} is replaced by \(\nu_i\) dξ. Then, the socalled advancement variable ξ is integrated from ξ=0 to 1. ↩

To be more precise: the velocities depend on the activities (“effective concentrations”). ↩

This timespan can vary between a few milliseconds (in acidbase reactions) or many years (in redox reactions or mineral precipitation). ↩