The Thermodynamics of Phase and Reaction Equilibria