This is the program chemeq. BACKGROUND INFO ================ Chemeq is a chemical reaction equation balancer. It allows the use of all known elements in any formula and it allows the use of charge. The program looks at a reaction equation as a set of reactants and a set of products, at both sides of the equation. A possible equation is: 2H2 + O2 = 2H2O Chemeq does not know anything about the formulas entered, so any compound, which syntactically forms a formula is accepted. Whether the compound is meaningful or not is not of importance for chemeq. Chemeq is just a calculator tool, which can be useful if the reaction products are known. Chemeq also does not have any sense of direction of a reaction, e.g. 2H2O --> 2H2 + O2 is equally valid as 2H2 + O2 --> 2H2O. The program chemeq does not take into account directions of reactions, it simply expects all compounds at one side of the arrow to be entered and the compounds at the other side of the arrow. Chemeq then computes coefficients such that the equation is balanced. A reaction equation is not uniquely determined. Balancing of reaction equations is nothing more than finding the null-space of a homogeneous matrix equation in the coefficients of the equation. Chemeq determines an integer basis for the coefficients of the equation and any linear combination of the basis vectors is a solution of the equation. FORMAT OF INPUT DATA FOR INPUT FILES ===================================== Input must be given in the form of a set of formulas, separated by spaces, tabs or newlines. The first single dot specifies the end of the set of reactants. The second single dot specifies the end of the set of reaction products. For the reaction between hydrogen and oxygen the following input can be given: H2 O2 . H2O . The following also is OK: H2 O2 . H2O . And the following is OK as well. H2 O2 . H2O . The only important thing is that all reactants and reaction products are mentioned, at the right side of the eqaution. Both the set of reactants and the set of reaction products must be terminated with a dot. The following input is not OK: H2 O2 .H2O . Here the dot, ending the set of reactants is connected to the formula for one of the reaction products. The following also is wrong: H2 O2 . H2O. EXAMPLE 1: Hydration of copper sulfate ======================================= A simple reaction is the formation of copper sulfate hydrate from water and white copper sulfate. The reactants are CuSO4 and H2O. The reaction product is CuSO4.5H2O. Valid input for this is: CuSO4 H2O . CuSO4.5H2O . Here one sees that in the formula for hydrated copper sulfate there also is a dot. Such dots may not have a space, neither at the left, nor at the right. The output of the program is: CuSO4 : 1 H2O : 5 CuSO4.5H2O : 1 This gives a basis (1 5 1) for the coefficients. This means that the solution space is 1-dimensional and any scalar, multiplied with this vector is a solution, i.e. 0.333*(1 5 1) = (0.33 1.65 0.33) is a solution, but 2*(1 5 1) = (2 10 2) also is a solution. Example 2: Oxidation of copper by nitric acid ============================================== Now suppose we have some copper and add this to nitric acid. Then we have the following reactants: Cu and HNO3. The following reaction products can occur: Cu(2+) NO3(-) H2O NO NO2. We supply the following input: Cu HNO3 . Cu(2+) NO3(-) H2O NO NO2 . Now the program gives the following output: Cu : 3 1 HNO3 : 8 4 Cu(2+) : 3 1 NO3(-) : 6 2 H2O : 4 2 NO : 2 0 NO2 : 0 2 Now we see that there are two base vectors. This means that any linear combination of these two is a valid reaction. Mathematically the solution is of the form a*(3 8 3 6 4 2 0) + b*(1 4 1 2 2 0 2). Examples of solutions are: a=1, b=0: 3Cu + 8HNO3 --> 3Cu(2+) + 6NO3(-) + 4H2O + 2NO a=1/2, b=1/2: 2Cu + 6HNO3 --> 2Cu(2+) + 4NO3(-) + 3H2O + NO + NO2 a=0, b=1: Cu + 4HNO3 --> Cu(2+) + 2NO3(-) + 2H2O + 2NO2 In fact, the set of solutions is infinitely large in this case and no precise stoichiometric ratio can be given. The 2-dimensional basis of the solution space, however does put constraints on the solution. VALID FORMULAS =============== The following are valid formulas for reactants or reaction products: Simple atoms: Fe Cu S Ions: sulfide : S(2-) sulfate : SO4(2-) nitrate : NO3(-) aq. chrome: [Cr(H2O)6](3+) or (Cr(H2O)6)(3+) copper II : Cu(2+) dichromate: Cr2O7(2-) ammonium : NH4(+) mercuro : Hg2(2+) or incorrectly: Hg(+) mercuri : Hg(2+) Molecules or complete compounds: water : H2O butane : C4H10 Mohr's salt: Fe(NH4)2(SO4)2.6H2O alum : KAl(SO4)2.12H2O alum : K2SO4.Al2(SO4)3.24H2O Salts, with ionic properties made explicit Na(+)Cl(-) is equivalent to NaCl (Na(+))2SO4(2-) is equivalent to Na2SO4 Free electrons can be denoted by a single 'e'. E.g. when one wants to determine half reactions, then free electrons may be used as reactant or as reaction product. E.g. the following is valid input: S2O8(2-) H(+) e . HSO4(-) . Charges on ions should be between parentheses, but how they are represented is a matter of taste. E.g. the iron (III) ion can be written as Fe(3+) Fe(+3) Fe(+++) All of these are OK and have the same meaning. If no parentheses around charges are used, then unexpected results may be obtained: NO3- is nitrate, but Cu2+ is not copper (II), but it is the nonexistent (Cu2)+ ion. The two is for the copper atom, not for the charge. A copper (II) ion should have parentheses around the charge, as in Cu(2+). FORMAT OF INPUT IN WINDOWS USER INTERFACE ========================================== In the user interface, the input format is even simper than in the input files for the program. At the left of the window, the reactants are mentioned, one in each textbox. At the right of the window, the products need to be mentioned, also one in each textbox. Textboxes may be left open if there are less reactants and/or products.