Class Reaction
A reaction can be fully described by:
- a list of reactives and products (reagents)
- stoichiometric coefficients
- a log K value
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.
The Chemmisol convention 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. 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.
Examples
try (ChemicalSystem system = new ChemicalSystem()) {
// Defines the reaction PO4-3 + 4 H+ <-> H4PO3
Reaction reaction = new Reaction("H4PO3", 13.192)
.addReagent("H4PO3", -1, Phase.AQUEOUS)
.addReagent("H+", 4, Phase.AQUEOUS)
.addReagent("PO4-3", 1, Phase.AQUEOUS);
system.addReaction(reaction);
// Implicitly defines H+ as a component
system.fixPH(7);
// Defines PO4-3 as a component
system.addComponent(new ChemicalComponent(
"PO4-3", Phase.AQUEOUS, 0.1
);
// The H4PO3 species is automatically added to the system, as the
produced species of the reaction
system.setUp();
}
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddReagent
(String name, int coefficient, Phase phase) Adds a reagent to this reaction.addReagent
(Reagent reagent) Adds a reagent to this reaction.double
getLogK()
Gets the base 10 logarithm of this reaction.getName()
Gets the name of this reaction.Gets the current list of reagents of this reaction.
-
Constructor Details
-
Reaction
Initializes a new Reaction.- Parameters:
name
- Name of the reaction. By convention, generally corresponds to the name of the produced species of the reaction.log_K
- Value of log(K) where K is the equilibrium constant of the reaction.
-
-
Method Details
-
getName
Gets the name of this reaction. By convention, the name of the reaction generally corresponds to the name of its produced species. The name of each reaction must be unique within each chemical system.- Returns:
- name of the reaction
-
getLogK
public double getLogK()Gets the base 10 logarithm of this reaction.Let's consider the following example reaction:
n A + m B <-> k C + l D
([C]^k * [D]^l) / ([A]^n * [B]^m) = K
- Returns:
- log(K) value of this reaction
-
addReagent
Adds a reagent to this reaction. Equivalent toaddReagent(new Reagent(name, coefficient, phase)
.- Parameters:
name
- Name of the reagent.coefficient
- Stoichiometric coefficient associated to the reagent in this reaction.phase
- Phase of the reagent.- Returns:
- This reaction.
- See Also:
-
addReagent
Adds a reagent to this reaction.The name of the reagent must correspond to the name of the species in the chemical system to which the reaction will be added. The corresponding species does not require to be already defined in the chemical system, but all reagents must be added to the reaction before
ChemicalSystem.addReaction(Reaction)
is called. While reagents corresponding to components must be defined explicitly in the chemical system, the produced species is automatically defined when the chemical system is set up.By convention, negative coefficients are associated to products and positive coefficients are associated to reactants.
- Parameters:
reagent
- Reagent to add to this reaction.- Returns:
- This reaction.
-
getReagents
Gets the current list of reagents of this reaction.- Returns:
- list of reagents
-