Chemical Equilibrium
LMA – Law of Mass Action & Equilibrium Constant K
Consider the chemical reaction between ‘reactants’ A, B and ‘products’ C, D:
(1)  aA + bB = cC + dD 
with a, b, c and d as the stoichiometric coefficients. The equal sign tells us that the reaction proceeds in both directions: forward and backward.
When equilibrium is reached the forward rate and the backward rate become equal, and the amount of reactants and products obeys the fundamental Law of Mass Action:
(2)  (Law of Mass Action) 
K is called the equilibrium constant (which depends on temperature). This law is so simple, 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’s not surprising that the massaction law forms the backbone of many geo/hydrochemistry approaches – including PhreeqC and aqion.
The ratio in 2 is often interpreted as a ratio of molar or molal concentrations. This, however, holds for infinitely dilute systems only. In case of real solutions the molar or molal concentrations should be replaced by activities. We emphasize this by using curly braces {} for activities in 2, while square brackets [] are reserved for molar concentrations.
In chemical thermodynamics, it is more convenient to work with the logarithm of K rather than with K itself. 2 then becomes
(3)  log K = c log {C} + d log {D} – a log {A} – b log {B} 
Here log K abbreviates the base10 logarithm, log_{10} K (in contrast to ‘ln’ as the natural logarithm). Often log K is further abbreviated by
(4)  pK = – log K 
which parallels the definition of pH as log {H^{+}}.
Thermodynamic Data (log K Values)
Two things are necessary to perform an equilibrium calculation:
• the model:  LMA algorithm  (e.g. PhreeqC, aqion) 
• thermodynamic data:  log K’s  (e.g. wateq4f^{1}) 
The role of the thermodynamic database cannot be overestimated. Models are empty shells unless thermodynamic data breathes life into them.
The thermodynamic database^{2} comprises at least two items for each species: the reaction formula (stoichiometry) and the log K value. Example: The 1^{st} dissociation step of sulfuric acid (at 25 °C) is defined by the entry:
H+ + SO42 = HSO4
log_k 1.988
Note 1. The log K value is only meaningful in context with the chemical reaction formula (1). For example, if you reverse the order in 1 to cC + dD = aA + bB, then the log K value changes its sign (from log K to log K).
Note 2. The log K value depends on temperature. Conversion of log K from standard temperature (25) to other temperatures is described here.
Conditional Equilibrium Constant
There is some relaxed version of the massaction law based on concentrations alone (rather then activities). In contrast to 2 it relies on the conditional or apparent equilibrium constant:
(5) 
Since concentrations are converted to activities by {i} = γ_{i} [i], the conditional equilibrium constant ^{c}K is related to the thermodynamic equilibrium constant K by
(6) 
For sufficiently dilute solutions, i.e. when activity coefficients are γ_{i} = 1, both equilibrium constants become equal: ^{c}K = K.
The conditional equilibrium constant ^{c}K can also be abbreviated by p^{c}K = – log ^{c}K, which yields the relation
(7)  p^{c}K = pK – ( log γ_{a} + log γ_{b} – log γ_{c} – log γ_{d} ) 
Gibbs Free Energy
There is a fundamental link between the equilibrium constant K and the Gibbs free energy change:
(8)  ΔG^{0} = – RT ln K 
where R = 8.314 J mol^{1}K^{1} is the gas constant and T the temperature in K. This equation can be rearranged to log K:
(9) 
The temperature dependence of ΔG^{0} and log K is discussed here.
Remarks & References

Ball J.W. and D.K. 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
. ↩