Skip to content

Step Techniques (CA & CP)

Step techniques apply abrupt jumps in either electrode potential (Chronoamperometry, potentiostatic) or applied current (Chronopotentiometry, galvanostatic).

Physical Inputs

Chronoamperometry (Potentiostatic)

Supports three construction modes, each optionally preceded by a resting quiet hold (E_quiet, t_quiet):

  1. Single-step: Chronoamperometry(E_step=..., duration=...)
  2. Double-step: Chronoamperometry(E_step1=..., E_step2=..., t_step1=..., t_step2=...)
  3. Multi-step: Chronoamperometry(potentials=[...], durations=[...])
Parameter Type Units Description
E_step / E_step1, E_step2 / potentials float / Sequence[float] \(\text{V}\) Applied step potential(s).
duration / t_step1, t_step2 / durations float / Sequence[float] \(\text{s}\) Step duration(s) (\(> 0\)).
E_quiet float, optional \(\text{V}\) Initial resting potential applied before the first step.
t_quiet float, default 0.0 \(\text{s}\) Resting duration (\(\ge 0\)). Requires E_quiet when \(> 0\).

Chronopotentiometry (Galvanostatic)

Supports single-step (current, duration) and multi-step / current-reversal (currents, durations) modes, with optional (I_quiet, t_quiet).

Under IUPAC polarity, negative current (\(I < 0\)) is cathodic (reduction) and positive current (\(I > 0\)) is anodic (oxidation).

Parameter Type Units Description
current / currents float / Sequence[float] \(\text{A}\) Applied Faradaic current(s).
duration / durations float / Sequence[float] \(\text{s}\) Step duration(s) (\(> 0\)).
I_quiet float, optional \(\text{A}\) Initial resting current applied before the first step.
t_quiet float, default 0.0 \(\text{s}\) Resting duration (\(\ge 0\)). Requires I_quiet when \(> 0\).

Automatic Sand Transition Time (\(\tau\))

When simulating Chronopotentiometry via simulate(), Soft Potato automatically detects the Sand transition time \(\tau\) (when surface reactant concentration depletes to zero) and stores it in result.metadata["transition_time"].

Full Runnable Script

"""User Guide: Step Techniques — Chronoamperometry (CA) & Chronopotentiometry (CP).

Demonstrates:
1. Single-step and double-step Chronoamperometry (potentiostatic)
2. Single-step and current-reversal Chronopotentiometry (galvanostatic)
3. Automatic Sand transition time detection in CP metadata
"""

import matplotlib.pyplot as plt

from softpotato.geometry import PlanarGeometry
from softpotato.reactions import ButlerVolmer, Species
from softpotato.techniques import (
    Chronoamperometry,
    Chronopotentiometry,
    plot_result,
    simulate,
)

# ==============================================================================
# 1. Physical System (SI units: m^2/s, mol/m^3 = mM, m^2, m/s)
# ==============================================================================
E0 = 0.0  # Formal potential [V]
D = 1.0e-9  # Diffusion coefficient [m^2/s]
c_bulk = 1.0  # Bulk concentration of Ox [mol/m^3] (= 1.0 mM)
k0 = 1.0e-3  # Heterogeneous rate constant [m/s]
alpha = 0.5  # Transfer coefficient [-]
area = 7.07e-6  # Electrode area [m^2]

ox = Species(
    "Ox", diffusivity=D, bulk_concentration=c_bulk, standard_potential=E0, n_electrons=1
)
red = Species("Red", diffusivity=D, bulk_concentration=0.0)
kinetics = ButlerVolmer(k0=k0, alpha=alpha, E0=E0, n=1)
geometry = PlanarGeometry(area)

# ==============================================================================
# 2. Single-Step & Double-Step Chronoamperometry (CA)
# ==============================================================================
ca_single = Chronoamperometry(E_step=-0.4, duration=5.0)
res_ca = simulate(ca_single, [ox, red], geometry=geometry, kinetics=kinetics)
print(
    f"Single-step CA: i(0.5 s) = {res_ca.current[len(res_ca.time) // 10] * 1e6:.2f} uA, "
    f"i(5.0 s) = {res_ca.current[-1] * 1e6:.2f} uA"
)

# Double-step CA with an initial 0.5 s quiet hold at +0.3 V
ca_double = Chronoamperometry(
    E_step1=-0.4,
    E_step2=0.4,
    t_step1=2.0,
    t_step2=2.0,
    E_quiet=0.3,
    t_quiet=0.5,
)
res_dca = simulate(ca_double, [ox, red], geometry=geometry, kinetics=kinetics)
print(f"Double-step CA: step transitions at t = {ca_double.event_times} s")

fig_ca, ax_ca = plot_result(res_dca)
ax_ca.set_title("Double-Step Chronoamperometry (with Quiet Hold)")

# ==============================================================================
# 3. Single-Step & Current-Reversal Chronopotentiometry (CP)
# ==============================================================================
# Negative current = cathodic (reduction) under IUPAC convention
cp_single = Chronopotentiometry(current=-1.5e-5, duration=4.0)
res_cp = simulate(cp_single, [ox, red], geometry=geometry, kinetics=kinetics)
tau = res_cp.metadata.get("transition_time")
print(
    f"Single-step CP: Sand transition time tau = {tau:.3f} s"
    if tau
    else "No transition"
)

fig_cp, ax_cp = plot_result(res_cp)
ax_cp.set_title("Constant-Current Chronopotentiometry")

# Current-reversal CP: reduce for 1.5 s, then oxidize for 1.5 s
cp_rev = Chronopotentiometry(currents=[-1.5e-5, 1.5e-5], durations=[1.5, 1.5])
res_rcp = simulate(cp_rev, [ox, red], geometry=geometry, kinetics=kinetics)
print(f"Current-reversal CP: reversal at t = {cp_rev.event_times} s")

fig_rcp, ax_rcp = plot_result(res_rcp)
ax_rcp.set_title("Current-Reversal Chronopotentiometry")

plt.show()