Thermodynamics & Interfacial Kinetics (softpotato.analytical.kinetics)¶
The softpotato.analytical.kinetics module provides thermodynamic and electrode kinetic formulations, including Nernst equilibrium, Butler–Volmer, and Tafel models.
kinetics
¶
Analytical and empirical equations for thermodynamics and interfacial kinetics.
This module provides closed-form equations, asymptotic expansions, and regression analysis tools for electrochemical thermodynamics (Nernst equation) and heterogeneous interfacial charge-transfer kinetics (Butler–Volmer equation and Tafel approximations).
Functions & Classes
nernst
Compute Nernst equilibrium electrode potential from concentration or concentration ratio.
nernst_potential
Alias for nernst.
nernst_ratio
Compute equilibrium concentration ratio \(c_{\text{Ox}} / c_{\text{Red}}\) from potential.
nernst_equilibrium_concentrations
Compute equilibrium species concentrations from potential and total concentration.
exchange_current_density
Compute exchange current density \(j_0\) from standard rate constant and concentrations.
exchange_current
Compute exchange current \(I_0\) from standard rate constant, concentrations, and area.
charge_transfer_resistance
Compute charge-transfer resistance \(R_{\text{ct}}\) from exchange current.
butler_volmer
Compute Faradaic current or current density using the Butler–Volmer equation.
butler_volmer_current_density
Compute Faradaic current density using the Butler–Volmer equation.
butler_volmer_linear
Compute low-overpotential linear approximation of the Butler–Volmer equation.
tafel_slope
Compute theoretical Tafel slope \(b\) in V/decade.
tafel
Compute high-overpotential Tafel current approximation.
tafel_overpotential
Compute overpotential \(\eta\) from current using the Tafel approximation.
TafelResult
Container dataclass for Tafel diagnostic linear regression parameters.
tafel_analysis
Perform linear regression on overpotential-current data to extract Tafel parameters.
Conventions & Units
All equations are dimensionally consistent in either standard SI or standard electrochemical CGS units:
- SI: \(c^*\) in \(\text{mol}\cdot\text{m}^{-3}\), \(A\) in \(\text{m}^2\), \(k^0\) in \(\text{m}\cdot\text{s}^{-1}\), \(F\) in \(\text{C}\cdot\text{mol}^{-1}\) \(\implies I\) in \(\text{A}\), \(j\) in \(\text{A}\cdot\text{m}^{-2}\).
- CGS: \(c^*\) in \(\text{mol}\cdot\text{cm}^{-3}\), \(A\) in \(\text{cm}^2\), \(k^0\) in \(\text{cm}\cdot\text{s}^{-1}\), \(F\) in \(\text{C}\cdot\text{mol}^{-1}\) \(\implies I\) in \(\text{A}\), \(j\) in \(\text{A}\cdot\text{cm}^{-2}\).
Standard IUPAC sign conventions are applied by default:
- Anodic (oxidation) currents are positive (\(I > 0\), \(j > 0\)) for positive overpotentials (\(\eta > 0\)).
- Cathodic (reduction) currents are negative (\(I < 0\), \(j < 0\)) for negative overpotentials (\(\eta < 0\)).
- The toggle anodic_positive=False can be specified to follow the polarographic / US convention (cathodic positive).
References
- A. J. Bard, L. R. Faulkner, H. S. White, Electrochemical Methods: Fundamentals and Applications, 3rd ed., John Wiley & Sons, 2022, Chapter 3.
- J. O'M. Bockris, A. K. N. Reddy, M. Gamboa-Aldeco, Modern Electrochemistry 2A: Fundamentals of Electrodics, 2nd ed., Kluwer Academic / Plenum Publishers, 2000.
TafelResult
dataclass
¶
Container for Tafel diagnostic linear regression parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
branch
|
str
|
Tafel polarization branch analyzed ( |
required |
i0
|
float
|
Extracted exchange current \(I_0\) in Amperes (A) or current density in \(\text{A}/\text{area}\). |
required |
slope
|
float
|
Fitted Tafel slope \(b = \partial \eta / \partial \log_{10}|I|\) in \(\text{V}/\text{decade}\). |
required |
slope_mv
|
float
|
Fitted Tafel slope in \(\text{mV}/\text{decade}\) (\(b \times 1000\)). |
required |
alpha
|
float
|
Extracted apparent charge-transfer coefficient \(\alpha\) (dimensionless). |
required |
intercept
|
float
|
Regression intercept \(a\) of \(\eta = a + b \log_{10}|I|\) in Volts (V). |
required |
r_squared
|
float
|
Coefficient of determination \(R^2\) of the linear regression fit. |
required |
stderr
|
float
|
Standard error of the regression slope \(\partial \log_{10}|I| / \partial \eta\) in \(\text{V}^{-1}\). |
required |
intercept_stderr
|
float
|
Standard error of the regression intercept in \(\log_{10}(\text{A})\). |
required |
k0
|
float or None
|
Extracted apparent standard heterogeneous rate constant \(k^0\)
in \(\text{m}/\text{s}\) or \(\text{cm}/\text{s}\), computed if |
None
|
Source code in src/softpotato/analytical/kinetics.py
nernst
¶
nernst(c_ox: float | ArrayLike, c_red: float | ArrayLike | None = None, E0: float = 0.0, n: float = 1, T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY) -> float | np.ndarray
Compute Nernst equilibrium electrode potential.
Calculates the reversible thermodynamic electrode potential \(E_{\text{eq}}\) for the redox reaction \(\text{Ox} + n e^- \rightleftharpoons \text{Red}\):
If c_red is omitted (set to None), c_ox is interpreted as the
precomputed concentration ratio \(r = c_{\text{Ox}} / c_{\text{Red}}\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c_ox
|
float or array - like
|
Concentration of oxidized species \(c_{\text{Ox}}\) (\(\ge 0\)),
or concentration ratio \(c_{\text{Ox}} / c_{\text{Red}}\) if |
required |
c_red
|
float or array - like
|
Concentration of reduced species \(c_{\text{Red}}\) (\(\ge 0\)).
If |
None
|
E0
|
float
|
Standard or formal electrode potential \(E^{0\prime}\) in Volts (V). |
0.0
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
T
|
float
|
Temperature in Kelvin (\(T > 0\), default 298.15 K). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}\cdot\text{mol}^{-1}\)). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Equilibrium electrode potential \(E_{\text{eq}}\) in Volts (V).
Returns |
Raises:
| Type | Description |
|---|---|
ValueError
|
If concentrations are negative, if both \(c_{\text{Ox}}\) and \(c_{\text{Red}}\) are zero, or if physical parameters \(n, T, R, F\) are non-positive. |
Examples:
>>> from softpotato.analytical.kinetics import nernst
>>> # Equal concentrations yield formal potential E0
>>> nernst(1.0, 1.0, E0=0.25)
0.25
>>> # 10-fold excess of Ox at 298.15 K shifts potential by ~59.16 mV (n=1)
>>> round(nernst(10.0, 1.0, E0=0.0) * 1000, 2)
59.16
>>> # Direct ratio input
>>> round(nernst(10.0, E0=0.0) * 1000, 2)
59.16
Source code in src/softpotato/analytical/kinetics.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
nernst_ratio
¶
nernst_ratio(E: float | ArrayLike, E0: float = 0.0, n: float = 1, T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY) -> float | np.ndarray
Compute equilibrium concentration ratio \(c_{\text{Ox}} / c_{\text{Red}}\) from potential.
Inverts the Nernst equation to determine the equilibrium surface concentration ratio corresponding to an applied electrode potential \(E\):
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
E
|
float or array - like
|
Electrode potential \(E\) in Volts (V). |
required |
E0
|
float
|
Standard or formal electrode potential \(E^{0\prime}\) in Volts (V). |
0.0
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
T
|
float
|
Temperature in Kelvin (\(T > 0\), default 298.15 K). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}\cdot\text{mol}^{-1}\)). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Equilibrium concentration ratio \(c_{\text{Ox}} / c_{\text{Red}}\) (dimensionless). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If \(n, T, R, F\) are non-positive. |
Examples:
>>> from softpotato.analytical.kinetics import nernst_ratio
>>> # At formal potential E = E0, ratio is unity
>>> nernst_ratio(0.25, E0=0.25)
1.0
>>> # At E = E0 + 0.05916 V, ratio is ~10.0 (n=1, 298.15 K)
>>> round(nernst_ratio(0.05916, E0=0.0), 1)
10.0
Source code in src/softpotato/analytical/kinetics.py
nernst_equilibrium_concentrations
¶
nernst_equilibrium_concentrations(E: float | ArrayLike, c_total: float | ArrayLike = 1.0, E0: float = 0.0, n: float = 1, T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY) -> tuple[float | np.ndarray, float | np.ndarray]
Compute equilibrium species concentrations from potential and total concentration.
Evaluates the equilibrium concentrations of both oxidized (\(c_{\text{Ox}}\)) and reduced (\(c_{\text{Red}}\)) species given total electroactive concentration \(c_{\text{total}} = c_{\text{Ox}} + c_{\text{Red}}\):
The calculation uses numerically stable logistic evaluation (scipy.special.expit)
to prevent floating-point overflow across extreme potentials.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
E
|
float or array - like
|
Electrode potential \(E\) in Volts (V). |
required |
c_total
|
float or array - like
|
Total concentration \(c_{\text{total}} = c_{\text{Ox}} + c_{\text{Red}}\) in \(\text{mol}/\text{m}^3\) or \(\text{mol}/\text{cm}^3\) (\(c_{\text{total}} \ge 0\)). |
1.0
|
E0
|
float
|
Standard or formal electrode potential \(E^{0\prime}\) in Volts (V). |
0.0
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
T
|
float
|
Temperature in Kelvin (\(T > 0\), default 298.15 K). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}\cdot\text{mol}^{-1}\)). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
tuple of (float or np.ndarray, float or np.ndarray)
|
Tuple of |
Raises:
| Type | Description |
|---|---|
ValueError
|
If \(c_{\text{total}} < 0\) or if physical parameters \(n, T, R, F\) are non-positive. |
Examples:
>>> from softpotato.analytical.kinetics import nernst_equilibrium_concentrations
>>> # At formal potential, both species have equal 50% fraction
>>> c_ox, c_red = nernst_equilibrium_concentrations(0.0, c_total=2.0, E0=0.0)
>>> (round(c_ox, 2), round(c_red, 2))
(1.0, 1.0)
Source code in src/softpotato/analytical/kinetics.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
exchange_current_density
¶
exchange_current_density(k0: float, c_ox: float = 1.0, c_red: float = 1.0, alpha: float = 0.5, n: float = 1, F: float = FARADAY) -> float
Compute exchange current density \(j_0\).
Calculates the equilibrium exchange current density for the single-step electron transfer reaction \(\text{Red} \rightleftharpoons \text{Ox} + n e^-\):
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k0
|
float
|
Standard heterogeneous charge-transfer rate constant in \(\text{m}/\text{s}\) or \(\text{cm}/\text{s}\) (\(k^0 \ge 0\)). |
required |
c_ox
|
float
|
Bulk concentration of oxidized species in \(\text{mol}/\text{m}^3\) or \(\text{mol}/\text{cm}^3\) (\(c_{\text{Ox}}^* \ge 0\)). |
1.0
|
c_red
|
float
|
Bulk concentration of reduced species in \(\text{mol}/\text{m}^3\) or \(\text{mol}/\text{cm}^3\) (\(c_{\text{Red}}^* \ge 0\)). |
1.0
|
alpha
|
float
|
Apparent cathodic charge-transfer coefficient (\(0 < \alpha < 1\)). |
0.5
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
F
|
float
|
Faraday constant in \(\text{C}/\text{mol}\) (\(F > 0\)). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float
|
Exchange current density \(j_0\) in \(\text{A}/\text{m}^2\) or \(\text{A}/\text{cm}^2\). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If \(k^0 < 0\), \(c^* < 0\), \(\alpha \notin (0, 1)\), or \(n, F \le 0\). |
Examples:
>>> from softpotato.analytical.kinetics import exchange_current_density
>>> # k0 = 1e-2 cm/s, c_bulk = 1e-3 mol/cm^3, n=1
>>> j0 = exchange_current_density(1e-2, c_ox=1e-3, c_red=1e-3, alpha=0.5, n=1)
>>> round(j0, 2)
0.96
Source code in src/softpotato/analytical/kinetics.py
exchange_current
¶
exchange_current(k0: float, c_ox: float = 1.0, c_red: float = 1.0, alpha: float = 0.5, area: float = 1.0, n: float = 1, F: float = FARADAY) -> float
Compute total exchange current \(I_0\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k0
|
float
|
Standard heterogeneous charge-transfer rate constant in \(\text{m}/\text{s}\) or \(\text{cm}/\text{s}\) (\(k^0 \ge 0\)). |
required |
c_ox
|
float
|
Bulk concentration of oxidized species (\(c_{\text{Ox}}^* \ge 0\)). |
1.0
|
c_red
|
float
|
Bulk concentration of reduced species (\(c_{\text{Red}}^* \ge 0\)). |
1.0
|
alpha
|
float
|
Apparent cathodic charge-transfer coefficient (\(0 < \alpha < 1\)). |
0.5
|
area
|
float
|
Electrode surface area in \(\text{m}^2\) or \(\text{cm}^2\) (\(A > 0\)). |
1.0
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
F
|
float
|
Faraday constant in \(\text{C}/\text{mol}\) (\(F > 0\)). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float
|
Total exchange current \(I_0\) in Amperes (A). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If parameters are physically invalid. |
Source code in src/softpotato/analytical/kinetics.py
charge_transfer_resistance
¶
charge_transfer_resistance(i0: float, n: float = 1, T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY) -> float
Compute charge-transfer resistance \(R_{\text{ct}}\).
Evaluates the activation polarization resistance at the equilibrium potential (\(\eta = 0\)):
If an exchange current density \(j_0\) is supplied in place of \(I_0\), the function returns the area-specific charge-transfer resistance \(R_{\text{ct,spec}} = R_{\text{ct}} \cdot A\) in \(\Omega\cdot\text{m}^2\) or \(\Omega\cdot\text{cm}^2\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i0
|
float
|
Exchange current \(I_0\) in Amperes (A), or exchange current density \(j_0\) (\(I_0 > 0\)). |
required |
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
T
|
float
|
Temperature in Kelvin (\(T > 0\), default 298.15 K). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}\cdot\text{mol}^{-1}\)). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float
|
Charge-transfer resistance \(R_{\text{ct}}\) in Ohms (\(\Omega\)), or \(\Omega\cdot\text{area}\) if \(j_0\) was passed. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If \(I_0 \le 0\) or if physical parameters are invalid. |
Examples:
>>> from softpotato.analytical.kinetics import charge_transfer_resistance
>>> # At I0 = 1 mA, n=1, 298.15 K
>>> r_ct = charge_transfer_resistance(1e-3, n=1)
>>> round(r_ct, 2)
25.69
Source code in src/softpotato/analytical/kinetics.py
butler_volmer
¶
butler_volmer(eta: float | ArrayLike, i0: float = 1.0, *, alpha: float = 0.5, n: float = 1, T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY, c_ox_surf: float | ArrayLike | None = None, c_red_surf: float | ArrayLike | None = None, c_ox_bulk: float = 1.0, c_red_bulk: float = 1.0, anodic_positive: bool = True) -> float | np.ndarray
Compute Faradaic current or current density using the Butler–Volmer equation.
Under pure activation control (\(c_i(0) = c_i^*\)), calculates the net Faradaic current response as a function of electrode overpotential \(\eta = E - E_{\text{eq}}\):
When interfacial surface concentrations \(c_{\text{Ox}}(0)\) or \(c_{\text{Red}}(0)\) are supplied, evaluates the mass-transport-corrected generalized Butler–Volmer equation:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eta
|
float or array - like
|
Electrode overpotential \(\eta = E - E_{\text{eq}}\) in Volts (V). |
required |
i0
|
float
|
Exchange current \(I_0\) in Amperes (A), or exchange current density \(j_0\) (\(I_0 \ge 0\)). If set to 1.0, returns normalized current \(I / I_0\). |
1.0
|
alpha
|
float
|
Apparent cathodic charge-transfer coefficient (\(0 < \alpha < 1\)). |
0.5
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
T
|
float
|
Temperature in Kelvin (\(T > 0\), default 298.15 K). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}\cdot\text{mol}^{-1}\)). |
FARADAY
|
c_ox_surf
|
float or array - like
|
Surface concentration of oxidized species \(c_{\text{Ox}}(0) \ge 0\). |
None
|
c_red_surf
|
float or array - like
|
Surface concentration of reduced species \(c_{\text{Red}}(0) \ge 0\). |
None
|
c_ox_bulk
|
float
|
Bulk concentration of oxidized species \(c_{\text{Ox}}^* > 0\). |
1.0
|
c_red_bulk
|
float
|
Bulk concentration of reduced species \(c_{\text{Red}}^* > 0\). |
1.0
|
anodic_positive
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Faradaic current \(I(\eta)\) in Amperes (A) or current density in \(\text{A}/\text{area}\). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If parameters are physically invalid. |
Examples:
>>> from softpotato.analytical.kinetics import butler_volmer
>>> # Zero overpotential gives zero current
>>> butler_volmer(0.0, i0=1e-3)
0.0
>>> # Symmetric curve at alpha = 0.5
>>> i_anodic = butler_volmer(0.05, i0=1.0)
>>> i_cathodic = butler_volmer(-0.05, i0=1.0)
>>> round(i_anodic + i_cathodic, 6)
0.0
Source code in src/softpotato/analytical/kinetics.py
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | |
butler_volmer_current_density
¶
butler_volmer_current_density(eta: float | ArrayLike, j0: float = 1.0, *, alpha: float = 0.5, n: float = 1, T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY, c_ox_surf: float | ArrayLike | None = None, c_red_surf: float | ArrayLike | None = None, c_ox_bulk: float = 1.0, c_red_bulk: float = 1.0, anodic_positive: bool = True) -> float | np.ndarray
Compute Faradaic current density \(j(\eta)\) using the Butler–Volmer equation.
Convenience wrapper around butler_volmer explicitly denoting current density.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eta
|
float or array - like
|
Electrode overpotential \(\eta = E - E_{\text{eq}}\) in Volts (V). |
required |
j0
|
float
|
Exchange current density \(j_0\) in \(\text{A}/\text{m}^2\) or \(\text{A}/\text{cm}^2\) (\(j_0 \ge 0\)). |
1.0
|
alpha
|
float
|
Apparent cathodic charge-transfer coefficient (\(0 < \alpha < 1\)). |
0.5
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
T
|
float
|
Temperature in Kelvin (\(T > 0\), default 298.15 K). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}\cdot\text{mol}^{-1}\)). |
FARADAY
|
c_ox_surf
|
float or array - like
|
Surface concentration of oxidized species \(c_{\text{Ox}}(0) \ge 0\). |
None
|
c_red_surf
|
float or array - like
|
Surface concentration of reduced species \(c_{\text{Red}}(0) \ge 0\). |
None
|
c_ox_bulk
|
float
|
Bulk concentration of oxidized species \(c_{\text{Ox}}^* > 0\). |
1.0
|
c_red_bulk
|
float
|
Bulk concentration of reduced species \(c_{\text{Red}}^* > 0\). |
1.0
|
anodic_positive
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Current density \(j(\eta)\) in \(\text{A}/\text{m}^2\) or \(\text{A}/\text{cm}^2\). |
Source code in src/softpotato/analytical/kinetics.py
butler_volmer_linear
¶
butler_volmer_linear(eta: float | ArrayLike, i0: float = 1.0, n: float = 1, T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY, anodic_positive: bool = True) -> float | np.ndarray
Compute low-overpotential linear approximation of the Butler–Volmer equation.
When overpotential is small compared to the thermal voltage (\(|\eta| \ll \frac{R T}{n F}\)):
This linear relationship is valid within \(< 1\%\) error for \(|\eta| \lesssim 10\,\text{mV}\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eta
|
float or array - like
|
Electrode overpotential \(\eta = E - E_{\text{eq}}\) in Volts (V). |
required |
i0
|
float
|
Exchange current \(I_0\) in Amperes (A) or current density (\(I_0 \ge 0\)). |
1.0
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
T
|
float
|
Temperature in Kelvin (\(T > 0\), default 298.15 K). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}\cdot\text{mol}^{-1}\)). |
FARADAY
|
anodic_positive
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Linearized current approximation in Amperes (A) or current density. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If parameters are physically invalid. |
Examples:
>>> from softpotato.analytical.kinetics import butler_volmer_linear, butler_volmer
>>> # At eta = 2 mV, linear approximation closely matches full Butler-Volmer
>>> i_full = butler_volmer(0.002, i0=1.0)
>>> i_lin = butler_volmer_linear(0.002, i0=1.0)
>>> round(abs(i_full - i_lin) / i_full * 100, 3) < 0.1 # error < 0.1%
True
Source code in src/softpotato/analytical/kinetics.py
tafel_slope
¶
tafel_slope(alpha: float = 0.5, n: float = 1, branch: Literal['anodic', 'cathodic'] = 'anodic', T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY, signed: bool = True) -> float
Compute theoretical Tafel slope \(b\) in Volts per decade (\(\text{V}/\text{dec}\)).
Calculates the theoretical logarithmic voltage-current sensitivity parameter:
- Anodic branch (\(\eta \gg 0\)):
$$ b_a = \frac{\ln(10) R T}{(1 - \alpha) n F} $$
- Cathodic branch (\(\eta \ll 0\)):
$$ b_c = -\frac{\ln(10) R T}{\alpha n F} \quad (\text{if signed=True}) $$
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
Apparent cathodic charge-transfer coefficient (\(0 < \alpha < 1\)). |
0.5
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
branch
|
('anodic', 'cathodic')
|
Kinetic polarization branch to evaluate. |
'anodic'
|
T
|
float
|
Temperature in Kelvin (\(T > 0\), default 298.15 K). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}\cdot\text{mol}^{-1}\)). |
FARADAY
|
signed
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
float
|
Theoretical Tafel slope \(b\) in \(\text{V}/\text{decade}\). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> from softpotato.analytical.kinetics import tafel_slope
>>> # Standard 1-electron transfer at 25 °C with alpha = 0.5: ~118.3 mV/dec
>>> round(tafel_slope(alpha=0.5, n=1, branch="anodic") * 1000, 1)
118.3
>>> round(tafel_slope(alpha=0.5, n=1, branch="cathodic", signed=True) * 1000, 1)
-118.3
Source code in src/softpotato/analytical/kinetics.py
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | |
tafel
¶
tafel(eta: float | ArrayLike, i0: float = 1.0, alpha: float = 0.5, branch: Literal['auto', 'anodic', 'cathodic'] = 'auto', n: float = 1, T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY, anodic_positive: bool = True) -> float | np.ndarray
Compute high-overpotential Tafel current approximation.
At sufficiently high overpotentials (\(|\eta| > \frac{R T}{n F}\)), the opposing reaction direction becomes negligible, reducing the Butler–Volmer equation to a single exponential branch:
- Anodic (\(\eta \gg 0\)):
$$ I_a = I_0 \exp\left( \frac{(1 - \alpha) n F \eta}{R T} \right) $$
- Cathodic (\(\eta \ll 0\)):
$$ |I_c| = I_0 \exp\left( -\frac{\alpha n F \eta}{R T} \right) $$
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eta
|
float or array - like
|
Electrode overpotential \(\eta = E - E_{\text{eq}}\) in Volts (V). |
required |
i0
|
float
|
Exchange current \(I_0\) in Amperes (A) or current density (\(I_0 \ge 0\)). |
1.0
|
alpha
|
float
|
Apparent cathodic charge-transfer coefficient (\(0 < \alpha < 1\)). |
0.5
|
branch
|
('auto', 'anodic', 'cathodic')
|
Branch to evaluate. If |
'auto'
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
T
|
float
|
Temperature in Kelvin (\(T > 0\), default 298.15 K). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}\cdot\text{mol}^{-1}\)). |
FARADAY
|
anodic_positive
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Tafel current approximation in Amperes (A) or current density. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> from softpotato.analytical.kinetics import tafel
>>> # Overpotential of 118.2 mV increases current by 1 decade above I0
>>> round(tafel(0.11822, i0=1.0, alpha=0.5, n=1, branch="anodic"), 1)
10.0
Source code in src/softpotato/analytical/kinetics.py
950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | |
tafel_overpotential
¶
tafel_overpotential(current: float | ArrayLike, i0: float = 1.0, alpha: float = 0.5, branch: Literal['anodic', 'cathodic'] = 'anodic', n: float = 1, T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY) -> float | np.ndarray
Compute overpotential \(\eta\) from current using the Tafel approximation.
Inverts the Tafel relationship to determine the activation overpotential required to sustain a given Faradaic current \(|I|\):
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
current
|
float or array - like
|
Faradaic current or current density (\(|I| > 0\)). |
required |
i0
|
float
|
Exchange current \(I_0 > 0\) in matching units. |
1.0
|
alpha
|
float
|
Apparent cathodic charge-transfer coefficient (\(0 < \alpha < 1\)). |
0.5
|
branch
|
('anodic', 'cathodic')
|
Polarization branch ('anodic' or 'cathodic'). |
'anodic'
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
T
|
float
|
Temperature in Kelvin (\(T > 0\), default 298.15 K). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}\cdot\text{mol}^{-1}\)). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Activation overpotential \(\eta\) in Volts (V). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If current or \(I_0\) are non-positive, or if parameters are invalid. |
Examples:
>>> from softpotato.analytical.kinetics import tafel_overpotential
>>> # 1 decade of current above I0 requires ~118.3 mV overpotential (n=1, alpha=0.5)
>>> eta = tafel_overpotential(10.0, i0=1.0, alpha=0.5, branch="anodic")
>>> round(eta * 1000, 1)
118.3
Source code in src/softpotato/analytical/kinetics.py
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 | |
tafel_analysis
¶
tafel_analysis(overpotential: float | ArrayLike, current: float | ArrayLike, *, branch: Literal['anodic', 'cathodic'] = 'anodic', fit_range: tuple[float, float] | None = None, area: float | None = None, c_bulk: float | None = None, n: float = 1, T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY) -> TafelResult
Perform linear Tafel regression on overpotential-current data.
Applies linear regression to the high-overpotential logarithmic relationship:
to extract:
- The exchange current \(I_0 = 10^{\text{intercept}}\).
- The experimental Tafel slope \(b = 1 / \text{slope}\) in \(\text{V}/\text{decade}\) and \(\text{mV}/\text{decade}\).
- The apparent charge-transfer coefficient \(\alpha\).
- The standard rate constant \(k^0\) (if
areaandc_bulkare supplied).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
overpotential
|
array - like
|
Electrode overpotential \(\eta = E - E_{\text{eq}}\) in Volts (V). |
required |
current
|
array - like
|
Measured Faradaic current in Amperes (A) or current density. |
required |
branch
|
('anodic', 'cathodic')
|
Kinetic branch to isolate for regression:
- |
'anodic'
|
fit_range
|
tuple of (float, float)
|
Potential window |
None
|
area
|
float
|
Electrode surface area in \(\text{m}^2\) or \(\text{cm}^2\) (\(A > 0\)). |
None
|
c_bulk
|
float
|
Bulk electroactive species concentration in \(\text{mol}/\text{m}^3\) or \(\text{mol}/\text{cm}^3\) (\(c^* > 0\)). |
None
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
T
|
float
|
Temperature in Kelvin (\(T > 0\), default 298.15 K). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}\cdot\text{mol}^{-1}\)). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
TafelResult
|
Container holding fitted kinetic and regression parameters. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If fewer than 3 valid data points exist in the selected fit window, or if physical parameters are invalid. |
Examples:
>>> import numpy as np
>>> from softpotato.analytical.kinetics import butler_volmer, tafel_analysis
>>> # Generate synthetic Butler-Volmer data with I0 = 1e-4 A, alpha = 0.5
>>> eta_pts = np.linspace(0.12, 0.25, 50)
>>> i_pts = butler_volmer(eta_pts, i0=1e-4, alpha=0.5, n=1)
>>> res = tafel_analysis(eta_pts, i_pts, branch="anodic")
>>> round(res.i0 * 1e4, 2)
0.99
>>> round(res.alpha, 2)
0.5
>>> round(res.slope_mv, 1)
118.0
Source code in src/softpotato/analytical/kinetics.py
1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 | |