chemmisol 0.1
|
#include <reaction.h>
Public Member Functions | |
Reaction (const std::string &name, std::size_t index, double log_K, const std::vector< Reagent > &reagents) | |
const std::string & | getName () const |
std::size_t | getIndex () const |
double | getK () const |
double | getLogK () const |
const std::vector< Reagent > & | getReagents () const |
A chemical reaction is a process that transforms reactants into products.
A reaction can be fully described by:
Let's consider the following example reaction:
n A + m B <-> k C + l D
A and B are reactants, C and D are products and n, m, k and l are corresponding stoichiometric coefficients.
By convention, the reaction is rewritten as
n A + m B - k C - l D <-> 0
so that stoichiometric coefficients of reactants are positive and stoichiometric coefficients of products are negative.
The equilibrium constant K is then defined according to the law of mass action as:
([C]^k * [D]^l) / ([A]^n * [B]^m) = K
where the bracket notation denotes the activity of each component at equilibrium. By convention, the products form the numerator.
This is compliant with the conventions used by the reference VMinteq software, so that values used in the VMinteq database can be reused as is in Chemmisol.
Within this same software, the name of each reaction also defines its produced species, to which a coefficient of -1 is associated. This convention comes from the idea that a species is actually a compound of base species ("components"), that corresponds to the reactants of the reaction that form the produced species. For example, in VMinteq, to define the Na+ + Cl- <-> NaCl reaction, you only need to create a reaction called "NaCl" with two components, Na+ and Cl-, both with a coefficient of +1, in the idea that NaCl is compound by the basic Na+ and Cl- ions.
In Chemmisol the produced species must be specified explicitly as a reagent, and the name of each reaction is arbitraty, even if we recommend to stick with the VMinteq convention to name reactions. The name of each reaction must also be unique within a ChemicalSystem.
Reactions must be specified so that all reagents are defined in the chemical system as components, except one reagent, that represents the produced species of the reaction. If those conditions are not met, InvalidReaction exceptions might be thrown by the ChemicalSystem.
// H2O <-> OH- + H+ Reaction oh("OH-", -13.997 // log K value, with H+ and OH- as products { // Reactives {"OH-", -1}, // Product {"H+", -1}, // Product {"H2O", 1} // Reactant }); // Na+ + Cl- <-> NaCl Reaction nacl("NaCl", -0.3 // log K value, with NaCl as product { // Reactives {"NaCl", -1}, // Product {"Na+", -1}, // Reactant {"Cl-", 1} // Reactant });
|
inline |
Defines a new reaction.
name | Name of the reaction |
index | Index used to retrieve the reaction in data structures used internally by the ChemicalSystem. The index can also be used to uniquely identify each reaction of a system. |
log_K | Base 10 logarithm of the equilibrium constant. By convention, K should correspond to the reaction quotient at equilibrium with products (i.e. species with negative coefficients) at the numerous. For example, using this convention, the self-ionization of water reaction is described with coefficients of -1 for HO- and H+ species, a coefficient of +1 for H2O, and a log_K value of -14. |
reagents | Defines reagents of the reaction and associates a stoichiometric coefficient to each, where coefficients of products are negative and coefficient of reactants are positive by convention. Reagents name should correspond to species name. |
|
inline |
Name of the reaction, usually the name of its produced species by convention.
|
inline |
Index used to retrieve the reaction in data structures used internally by the ChemicalSystem. The index can also be used to uniquely identify each reaction of a system.
|
inline |
Equilibrium constant of this reaction.
|
inline |
Base 10 logarithm of the equilibrium constant of this reaction.
|
inline |
Returns the reagents of the reaction.