As always, we begin by loading the Chemistry Package:

Single Aqueous Equilibrium

The general procedure for solving equilibrium problems is to define the species involved in the equilibria, define the equilibria, create a virtual sample, and allow the sample to react. We’ll start with a simple example, the autodissociation of water. Here are the species we need to define:

Next we define the equilibrium. Because we will eventually be solving problems with multiple simultaneous equilibria, we put the equilibrium expression in a Mathematica™ list. The equilibrium constant goes above the equilibrium arrow (<Ctrl>&), complete with units.

Numerous aspects about an equilibrium can be queried. Notice here that the function EqConst returns the equilibrium constant value that was entered, while the function Keq returns the functional form of the equilibrium constant. Notice as well that this latter expression includes concentrations that are in standard chemistry notation (states of matter are not included, since the state has to be aq or sol for a concentration to make sense).

You can enter concentrations yourself using the palettes.

Now we create a virtual sample using the function CreateSample. In this case, we are starting with just water… lets say 100 mL.

Notice that the parameter passed to CreateSample is a list of lists. This is of the form {{species1, amount1}, {species2, amount2},…}. Since we only have one species we are starting with, we only have one entry: {{species, amount}}. Internally, the sample (here named “Water”) is represented as a pair of lists: {{{species1, amount1}, {species2, amount2},…}, {list of conditions}}. You should never need to manipulate this structure directly, but some understanding of how it functions is useful. In particular, the way amounts of species are represented internally depends on the state of matter:

  • Liquids (specified as “l”) are considered to be the solvent, and so as to be able to calculate concentrations easily, the amount of liquids are represented internally as volumes. This means that if you pass a liquid amount to CreateSample as something other than a volume, extra information is needed to convert that amount to a volume (e.g., densities if you specify the mass of the liquid, and both densities and molar masses if you specify the number of moles of the liquid). It is assumed in the equilibrium calculations that the amount of liquid is effectively unchanging (if your system has equilibria that significantly modify the amount of solvent present in the system, then other assumptions break down too, so this eventuality is not handled by the ChemistryPackage). Even if your equilibria do not alter the amount of liquid present, you must specify a solvent if you have solutes present so that concentrations can be calculated.
  • Aqueous (“aq”) or solute (“sol”) species are internally represented as a number of moles. This information will be combined with the amount of liquid present to determine concentrations for use in equilibrium expressions. You can specify the amount of the solute as a number of moles, a concentration, or a mass (if you have assigned molar masses).
  • Solids (“s”) are internally represented as a number of moles present. Each specified solid is considered to be a separate phase. You can specify the amount of the solid as a number of moles or a mass (if you have assigned molar masses).
  • Gases (“g”) are internally represented as a pressure to ease their use in equilibrium expressions. You can specify the amount of a gas as a pressure, a number of moles, or a mass. In the latter two cases, in order to convert the amount of gas to a pressure, gas conditions are needed (temperature, volume, and the equation-of-state to use); this will be discussed in more detail below.

Next, the virtual sample needs to equilibrate. We do that using the React function. Notice that an ICE table is printed illustrating the equilibration process. If you are not interested in seeing ICE tables, you can turn them off using the ShowICE->False option.

The return-value of the React function is another sample-type structure, which you can query concerning its composition:

And if you let the ChemistryPackage know which of your species correspond to hydronium and hydroxide, you can even directly query the pH and pOH:

Internally, the extent-of-reaction is treated as the number of moles. It is more common, however, to show ICE tables with the extent of reaction as concentration or (for gas-phase reactions) as partial pressure. The default for the React function is to display the extent of reaction as converted to concentration, but you can choose a different option (choices are “concentration”, “moles”, and “pressure”).

Single Gas-Phase Equilibrium

Just to keep things clean, I tend to restart the Mathematica™ kernel when starting a new problem.

Now let’s take a look at a gas-phase equilibrium, the dissociation of dinitrogen tetroxide into nitrogen dioxide. First we set up the species.

Then we set up the equilibrium.

As before, we can query the equilibrium for a variety of details. In particular, the equilibrium constant expression is in terms of partial pressures instead of concentrations. As was true for the concentrations, pressure expressions can be entered using the provided palettes.

Gas-phase samples are created in an analogous manner to the solution-phase samples discussed above. Notice in the examples below that mass, moles, and pressure are all acceptable methods to specify the amount of gas. To convert into a pressure, the ideal gas law is assumed (there is a mechanism in place to change to a different equation-of-state, but it has not been tested/debugged, and if you are operating at pressures where other gas laws are needed, then it is probably important to take into account issues such as fugacity, which are beyond the scope of this package). Unless otherwise specified, as illustrated in the last example, a temperature of 298.15 K is assumed, as is a volume equal to the molar volume of an ideal gas. Finally, an option gasEffectivelyInfinite is specified as False in these examples. The use of this option will be discussed in a later example.

Performing the equilibration and querying the result for its properties follow the same model as above. Generally, specifying that the ICE table extent-of-reaction should be represented as a pressure is a good idea for such problems.

Seven Simultaneous Equilibria Across Four Phases

Using Mathematica™ to solve single-equilibrium problems is probably overkill. But the ability of this package to solve complex simultaneous equilibria illustrates its value. We will take as our model system water exposed to gaseous carbon dioxide and potentially interacting with two solid phases, calcium hydroxide and calcium carbonate. As before, we start by assigning the species we need.

Next we define our equilibria, including the equilibrium constants. Notice in particular the last one, which is in the form of a Henry’s constant.

Now we need to define our sample. You can, if you wish, define the sample in one statement, but here let us illustrate another approach, where we define separate samples and then mix them together using the Mix function.

The resulting sample combines all of the individual components from the individual samples, assuming that for the same solid or solution species the number of moles are additive, for the same liquid species the volumes are additive, and for the same gaseous species the partial pressures are additive. Gas-phase conditions (temperature, pressure, equation-of-state, and the gasEffectivelyInfinite option) are taken from the first sample in the list. In this specific case, we are looking at a 100 mL aqueous sample to which 0.1 mol of solid calcium hydroxide has been added, and which is open to the air, and so the partial pressure of carbon dioxide above the sample is that of the atmosphere. Here, because the sample is open to the air and is being allowed to equilibrate for as long as necessary, we leave the gasEffectivelyInfinite option set to its default value of True, meaning that the dissolution of carbon dioxide into the sample from the air does not deplete the ambient amount of the gas.

In this case, we have four equilibria (the first four) that only involve concentrations. The next two concern the dissolution of a solid, so it would be reasonable to express the extent-of-reaction for those two in either concentration units or mole units. In this case, we will chose moles, because we will be looking primarily at the amount of solid present. The final equilibrium is the dissolution of a gas into the solvent, and so the extent of reaction could reasonably be expressed in either concentration or pressure units. To illustrate the pressure option, we will choose that here. For convenience, let’s define a variable we can use later to specify this list of extent-of-reaction types.

Allowing the sample to equilibrate is just as easy for this system as it was for the single-equilibrium systems described above. As you can see below, separate ICE tables are generated for each of the equilibria, and the extent-of-reaction variables are separately specified in the appropriate units. Notice that the “Change” lines will frequently include conversion factors necessary to convert one type of extent-of-reaction variable into the units appropriate for the species in question. The result of this calculation shows that quite a bit of carbonate came from the atmospheric carbon dioxide, all of the calcium hydroxide dissolved, and a precipitate of calcium carbonate formed, removing most of the calcium from solution. Notice that the ChemistryPackage correctly identifies that when a solid completely dissolves, its equilibrium expression no longer has to hold.

Now let’s ask a different question using a related sample. Suppose that this sample, made from NanoPure water that has been rigorously degassed, is placed in a 250 mL, sealed flask, so that the head-space is 150 mL of air. In this situation, the carbon dioxide, which only comes from the head-space, can get depleted significantly. We specify these conditions by setting the gasEffectivelyInfinite option to False and setting the gas volume to be 150 mL. By creating a sample with those conditions and ensuring that it is the first sample in the Mix function call, those parameters get set for the overall sample. As expected, much less carbonate forms. A result of this is that less calcium is removed from solution by the precipitation of calcium carbonate, and thus much less of the calcium hydroxide dissolves.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s