This page illustrates the use of the Equilibria package and the ChemEquilibria applet in solving equilibrium problems.
Each instance of the ChemEquilibria applet (a web page may contain multiple applets) describes a chemical system. The chemical system has several properties (e.g., temperature) and contains one or more phases. Each phase contains one or more chemical species (the same chemical species can exist in multiple phases). Each chemical species is described by a charge and a formula weight. A reaction consists of a set of chemical species with associated stoichiometric coefficients and an equilibrium constant. Once the chemical system is defined, the equilibrium problem may be solved and the equilibrium concentrations and partial pressures may be retrieved.
To illustrate the use of this software, consider the dissolution of solid calcium carbonate in pure water in contact with the atmosphere, which contains 390 ppm carbon dioxide. In solving any equilibrium problem, one must (1) identify all chemical species involved in the problem, (2) identify the analytical amounts of each species, and (3) write all relevant chemical reactions involving these species.
Use the createChemSpecies method to create the following chemical species:
|Chemical Species||Label||Charge||Formula Weight||Ion-Size Parameter
|hydrogen carbonate ion||HCO3-||-1||61.017||4.5|
The ion-size parameter is used in the extended Debye-Huckel equation to calculate the activity coefficient of a solute. The hydrogen ion (H+), hydroxide ion (OH-), and water (H2O) are automatically created by ChemEquilibria. In this example, carbonic acid represents the sum of both carbonic acid itself and dissolved carbon dioxide, as is the usual practice. If one desired, the equilibrium between dissolved carbon dioxide and carbonic acid could be explicitly modeled.
The chemical species are simply a description of a basic chemical entity and do not actually exist in the chemical system until they are explicitly added. A chemical species is always part of a specific phase; thus it is necessary to first create the phase and then add the species to the phase.
document.chemEquilibria.createChemSpecies("CaCO3",0.0,100.087); document.chemEquilibria.createChemSpecies("Ca+2",2.0,40.087); document.chemEquilibria.createChemSpecies("H2CO3",0.0,62.025); document.chemEquilibria.createChemSpecies("HCO3-",-1.0,61.017); document.chemEquilibria.createChemSpecies("CO3-2",-2.0,60.009); document.chemEquilibria.createChemSpecies("CO2",0.0,44.010); document.chemEquilibria.setIonSize("Ca+2",6.0); document.chemEquilibria.setIonSize("HCO3-",4.5); document.chemEquilibria.setIonSize("CO3-2",4.5);
A useful feature of the ChemEquilibria applet is the ability to read a text file that defines chemical species. (See the loadLibrary method for ChemEquilibria in the documentation.) Such files are easy to create (one such file is inorganic.library, which defines various inorganic species).
Phases are created using the appropriate create method. This chemical system has three phases: solid calcium carbonate, an aqueous phase, and a gas phase. The following instructions can be used to create these phases.
document.chemEquilibria.createSolidPhase("s","CaCO3",0.010); document.chemEquilibria.createAqueousPhase("aq",1.000); document.chemEquilibria.createGasPhase("g",1000.0); document.chemEquilibria.setPressure(0.000390); document.chemEquilibria.setIsIsobaric(true);
In the createSolidPhase method, the first label is the name of the phase, the second label is the name of the chemical species that makes up the solid, and the third value is the analytical moles. It is important that an excess of calcium carbonate be present, or the solubility reaction (yet to be defined) will not be at equilibrium and it will not be possible to solve the equilibrium problem.
In the createAqueousPhase method, the label is the label of the aqueous phase and the second term is the volume of the aqueous solution in liters. This method automatically sets the analytical amount of water, adds the hydrogen and hydroxide ions to the solution, and defines the autodissociation reaction.
In the createGasPhase method, the label is the label of the gas phase and the second term is the volume of the phase in liters. At this point, no species have been added to the gas phase, so it is essentially a vacuum. This hypothetical chemical system will not significantly deplete carbon dioxide from the atmosphere, thus we set the system to be isobaric at 0.000390 atm (390 ppm) of pure carbon dioxide (to be added in the next step) and make sure the volume of the gas phase is sufficiently large that the carbon dioxide will not be completely consumed. It would also be perfectly acceptable to create nitrogen and oxygen species and add those to the gas and set the pressure at 1 atm. Note that the setPressure and setIsIsobaric instructions may be omitted if these values are properly set by the PARAM options in the APPLET tag.
It is now necessary to add the appropriate analytical amount of each species to the appropriate phase. The calcium carbonate solid has already been correctly defined, as have the water, hydrogen ion, and hydroxide ion species in the aqueous solution. The carbon dioxide must also be added to the gas phase. The following instructions perform this step.
document.chemEquilibria.addSpecies("Ca+2","aq",0.0); document.chemEquilibria.addSpecies("H2CO3","aq",0.0); document.chemEquilibria.addSpecies("HCO3-","aq",0.0); document.chemEquilibria.addSpecies("CO3-2","aq",0.0); document.chemEquilibria.addSpecies("CO2","g", 0.014714);
The first four instructions add species to the aqueous phase. Because the water is initially pure, the analytical amount of each species is zero. The 0.014714 moles of carbon dioxide will produce a partial pressure of 0.000390 atm when it expands to occupy 1000.0 liters are 298.15 K. Regardless of the amount of carbon dioxide specified, the volume of the gas phase will shrink or expand until the target system pressure of 0.000390 atm is reached, because the isIsobaric property is true.
Now that all chemical species and phases have been created, it is time to define the chemical reactions. The reactions are defined by submitting a string containing the chemical equation. " = " represents the equilibrium arrows. Species on the same side of the equilibrium arrows are separated by " + ".
document.chemEquilibria.addReaction("solubility","CaCO3 (s) = Ca+2 (aq) + CO3-2 (aq)", 4.5E-9); document.chemEquilibria.addReaction("first acid dissociation step","H2CO3 (aq) = H+ (aq) + HCO3- (aq)", 4.45E-7); document.chemEquilibria.addReaction("second acid dissociation step","HCO3- (aq) = H+ (aq) + CO3-2 (aq)", 4.69E-11); document.chemEquilibria.addReaction("carbon dioxide dissolution", "CO2 (g) + H2O (aq) = H2CO3 (aq)", 0.0344);
Bear in mind that the autodissociation reaction for water was automatically created when the aqueous phase was create; thus there is no need to create that reaction at this point. Note that each reaction also has a descriptive label.
It is good practice to explicitly include the phase, using the exact phase label used in the creation of the phase, but this is not strictly necessary. It is only necessary if the same chemical species exists in more than one phase.
The software checks to make sure each reaction is balanced with respect to charge, but there is no way to check whether the atoms are balanced, because the labels do not necessarily contain the molecular formula. Thus the equation "CO2 (g) + H2O (aq) = H2CO3 (aq)" could be replaced with "CO2 (g) = H2CO3 (aq)". The only difference is that the first reaction will consume some of the water in the aqueous solution while the second will not. Because the amount of water consumed is negligible, the same results are obtained in both cases.
Notice that the last reaction specifies "H2O (aq)". This notation is different from the usual chemical notation and does not indicate that water is a solute rather than a pure liquid (essentially). When defining chemical reactions for this software, the phase is the label that defines the phase and is not a physical state. Thus the water is in the phase named "aq" and thus "H2O (aq)" must be used rather than "H2O (l)", because there is no phase named "l".
Before solving the equilibrium problem, one must decide whether the system behaves ideally or not. In this calculation, nonideal behavior will be assumed. (It is not necessary to explicitly change this setting, if it is correctly set in the PARAM option in the APPLET tag.)
document.chemEquilibria.setIsIdeal(false); var solveState = document.chemEquilibria.solve();
The solve method first parses the chemical system to ensure certain types of errors do not exist. The problem is then solved. The solve method returns true if the solution was obtained and false if no solution was found. In the event no solution was found, check the Java console for information on the nature of the problem.
After the problem has been solved, the equilibrium properties of the various chemical species and phases can be obtained using the appropriate method. Examples are shown below. Concentrations are molar concentrations, but these values have been scaled to mmole/L for easy of reading.