vibesketch.document.electrochem¶
Electrochemical half-reactions: electrons, states, coefficients and potentials (#141).
An electrode reaction is drawn like any reaction, with what SMILES cannot say written as text, and read from the drawing like the rest of it:
electrons,
2e⁻(also2 e-or2e−), drawn on a side among the participants, or at the arrow as+ 2e⁻(taken up, a reactant) or− 2e⁻(given off, a product);a state,
(s),(l),(g),(aq)or(ads), or the asterisk of an adsorbed species, just right of a participant;a coefficient, such as the 2 of 2H2O, just left of a participant;
conditions at the arrow that read as a value and a unit: a potential with its reference electrode (
−1.2 V vs Ag/AgCl (3 M KCl), SHE, NHE, SCE, RHE),pH 7.4, a temperature in °C or K, a time.
The texts stay in the drawing, so figures print them as drawn. The balance check counts atoms (implicit hydrogens included) and charge, with each participant’s coefficient and the electrons’ charge of −1 each, and reports what does not match; it never changes the reaction.
Module Attributes
exact, from e and N_A). |
Functions
|
Atoms and charge on each side of a reaction, with the electrons, and the imbalance. |
|
One line saying whether a reaction balances, and if not, by how much. |
|
A text that writes electrons as its sign and count, or |
|
A KET drawing of a half-reaction, laid out in a row as the derivation reads it. |
|
The conditions among |
|
The electrons, states and coefficients drawn for one step, and warnings. |
|
|
|
|
Classes
A reaction's atom and charge balance: what each side holds and what does not match. |
Exceptions
A half-reaction that cannot be drawn as asked; the message says why. |
- vibesketch.document.electrochem.FARADAY = 96485.33212¶
exact, from e and N_A).
- Type:
The Faraday constant, C/mol (CODATA 2018
- class vibesketch.document.electrochem.BalanceReport[source]¶
-
A reaction’s atom and charge balance: what each side holds and what does not match.
- exception vibesketch.document.electrochem.HalfReactionRefused[source]¶
Bases:
ValueErrorA half-reaction that cannot be drawn as asked; the message says why.
- vibesketch.document.electrochem.balance(document, reaction_id)[source]¶
Atoms and charge on each side of a reaction, with the electrons, and the imbalance.
Reagents drawn at the arrow are not counted. A side’s count is the sum of coefficient times atoms, and of coefficient times charge, less one per electron on that side.
balancedis true only when every element and the charge match. RaisesKeyErrorfor an unknown reaction.- Parameters:
- Return type:
- vibesketch.document.electrochem.describe(report)[source]¶
One line saying whether a reaction balances, and if not, by how much.
- Parameters:
report (BalanceReport)
- Return type:
- vibesketch.document.electrochem.electron_text(text)[source]¶
A text that writes electrons as its sign and count, or
None.
- vibesketch.document.electrochem.half_reaction_canvas(reactants, products, *, electrons=None, conditions=(), arrow='forward', over=())[source]¶
A KET drawing of a half-reaction, laid out in a row as the derivation reads it.
A participant is a SMILES or
{smiles, coefficient, state}; coefficients are drawn before it and states after it, the electrons{count, side, at_arrow}as2e⁻among the participants of their side or, withat_arrow, as+ 2e⁻or− 2e⁻above the arrow, and the conditions below it. A participant may also be a solid{formula, coefficient, state}(#142), drawn as its formula.overare drawn above the arrow as reagents: a solid catalyst{formula}or a SMILES. RaisesHalfReactionRefused.
- vibesketch.document.electrochem.quantities(lines)[source]¶
The conditions among
linesthat read as a value with its unit.
- vibesketch.document.electrochem.read_half_reaction(scene, arrow, sides, species_of, used)[source]¶
The electrons, states and coefficients drawn for one step, and warnings.
sidesare the step’s reactant, reagent and product fragments;species_ofmaps a fragment to its species; texts read here are added tousedso they do not become condition lines.
- vibesketch.document.electrochem.widened(scene)[source]¶
scenewith each molecule’s box taken out over its coefficient and state texts.So a plus sign between
2 H⁺(aq)and its neighbour joins them as it joins bare molecules; only the boxes change, never which texts there are.
- vibesketch.document.electrochem.with_half_reaction(document, reactants, products, *, electrons=None, conditions=(), arrow='forward', over=())[source]¶
documentwith a half-reaction drawn beside its drawing, derived, and the warnings.See
half_reaction_canvas(). RaisesHalfReactionRefused.