This page illustrates the use of the Equilibria package and the ChemEquilibria applet in solving equilibrium problems.
The ChemEquilibria applet will be used to model the following electrochemical cell
Hg | Hg2Cl2 | KCl (10.00 mM) | AgCl | Ag
This cell employs a silver-silver chloride electrode and a calomel electrode.
Use the createChemSpecies method to create the following chemical species:
|Chemical Species||Label||Charge||Formula Weight|
document.chemEquilibria.createChemSpecies("Hg",0.0,200.59); document.chemEquilibria.createChemSpecies("Hg2Cl2",0.0,472.085); document.chemEquilibria.createChemSpecies("AgCl",0.0,143.321); document.chemEquilibria.createChemSpecies("Ag",0.0,107.868); document.chemEquilibria.createChemSpecies("Hg2+2",+2.0,401.18); document.chemEquilibria.createChemSpecies("Ag+",+1.0,107.868); document.chemEquilibria.createChemSpecies("K+",+1.0,39.098); document.chemEquilibria.createChemSpecies("Cl-",-1.0,35.453);
Potassium chloride does not appear in the species list, because there is no potassium chloride in the chemical system; there are only potassium ions and chloride ions, because potassium chloride is a strong electrolyte. There are also hydrogen ions, hydroxide ions, and water in the aqueous solution; the equilibria package will create these species automatically.
In this chemical system, the potassium ion is simply a counter-ion; it does not participate in any reaction but its charge is necessary to maintain electroneutrality. In this example the counter-ion is explicitly added. An alternative is to set the autoChargeBalance property for each solution. When this property is true, the Equilibria object will automatically balance the charge in the solution by adding a generic monovalent counter-ion, X+ or X-. This feature is useful if activity corrections are not being performed or if the actual counter-ions are indeed monovalent. (See the setAutoChargeBalance method for ChemEquilibria in the documentation.)
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).
Each solid is a separate phase. The exact amounts of the electrodes (Hg and Ag) are unimportant, because they do not react (it is assumed no current is passed through the cell). There must be sufficient amounts of the ionic solids that excess solid remains.
document.chemEquilibria.createSolidPhase("s1","Hg",1.0); document.chemEquilibria.createSolidPhase("s2","Hg2Cl2",1.0); document.chemEquilibria.createSolidPhase("s3","AgCl",1.0); document.chemEquilibria.createSolidPhase("s4","Ag",1.0); document.chemEquilibria.createAqueousPhase("aq",0.050);
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.
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.
The solids are all regarded as pure solids, and in creating the solid phase itself the chemical species making up the solid and the analytical amount of the solid are already defined. It is only necessary to add the aqueous solutes to the aqueous phase.
document.chemEquilibria.addSpecies("Hg2+2","aq",0.0); document.chemEquilibria.addSpecies("Ag+","aq",0.0); document.chemEquilibria.addSpecies("K+","aq",5.0E-4); document.chemEquilibria.addSpecies("Cl-","aq",5.0E-4); document.chemEquilibria.setIonSize("K+",3.0); document.chemEquilibria.setIonSize("Cl-",3.0);
The last two lines set the ion-size parameter used in the Extended Debye-Huckel Equation to calculate the activity coefficient.
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("Hg2Cl2 solubility","Hg2Cl2 (s2) = Hg2+2 (aq) + 2 Cl- (aq)", 1.4E-18); document.chemEquilibria.addReaction("AgCl solubility","AgCl (s3) = Ag+ (aq) + Cl- (aq)", 1.8E-10);
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 solubility reactions defined above are the only reactions (in addition to the autodissociation of water) that affect the equilibrium concentrations of species. No redox reactions occur to any measurable extent. The half-reactions for each electrode (defined below) are useful only for predicting the potential of the cell.
document.chemEquilibria.addHalfReaction("Ag/AgCl","Ag+ (aq) + e- (s4) = Ag (s4)", 0.7993); document.chemEquilibria.addHalfReaction("calomel","Hg2+2 (aq) + 2 e- (s1) = 2 Hg (s1)", 0.796);
The equations for the half-reactions are written using the same rules as those for chemical reactions. The only unique feature is the "e-" term, which represents an electron. The phase of the electron identifies the electrode. For the reduction of silver chloride, the electrode is the silver metal, which is phase s4. The phase of the electron is optional, but the absence of the phase prevents the program from returning the potential of the electrode based upon its phase label.
The half-reaction may be written as either a reduction or an oxidation, but it is important that the potential (the third parameter in the method) be consistent with the half-reaction as written (a reduction potential for a reduction or an oxidation potential for an oxidation). The reference electrode is arbitrary; the values used above are vs. NHE.
Also be aware than any half-reaction may be written, provided the species and phases involved in the half-cell reaction are defined and the program can solve for their equilibrium properties.
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();
An alternative, and perhaps more accurate, strategy for solving this problem is to specify ideal behavior, setIsIdeal(true). The solubility products would then be set to the concentration-based equilibrium constants appropriate for the system conditions. Formal potentials would be supplied instead of standard potentials for the half-reactions. This approach would be preferred if the ionic strength of the solution were too high for the Extended Debye-Huckel Equation to provide accurate activity coefficients.
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. The getConc method returns concentrations in mole/L; these values have been changed to mmole/L for display purposes.