Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
*.ipynb_checkpoints
.ipynb_checkpoints
*/.ipynb_checkpoints/*
dist/
dist/
docs/build
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ disable=raw-checker-failed,
file-ignored,
suppressed-message,
useless-suppression,
useless-parent-delegation,
deprecated-pragma,
use-symbolic-message-instead,
use-implicit-booleaness-not-comparison-to-string,
Expand Down
58 changes: 57 additions & 1 deletion src/cvsim/fit_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,63 @@ def fit_function(


class FitE_rev(FitMechanism):
"""Scheme for fitting a CV for a reversible (Nernstian) one-electron transfer mechanism."""
"""
Scheme for fitting a CV for a reversible (Nernstian) one-electron transfer mechanism.

Parameters
----------
voltage_to_fit : list[float] | np.ndarray
Array of voltage data of the CV to fit.
current_to_fit : list[float] | np.ndarray
Array of current data of the CV to fit.
scan_rate : float
Potential sweep rate (V/s).
c_bulk : float
Bulk concentration of redox species (mM or mol/m^3).
step_size : float
Voltage increment during CV scan (mV).
disk_radius : float
Radius of disk macro-electrode (mm).
temperature : float
Temperature (K).
Default is 298.0 K (24.85C).
reduction_potential : float | None
Reduction potential of the one-electron transfer process (V vs. reference).
If known, can be fixed value, otherwise defaults to None.
diffusion_reactant : float | None
Diffusion coefficient of reactant (cm^2/s).
If known, can be fixed value, otherwise defaults to None.
diffusion_product : float | None
Diffusion coefficient of product (cm^2/s).
If known, can be fixed value, otherwise defaults to None.

"""

def __init__(
self,
voltage_to_fit: list[float] | np.ndarray,
current_to_fit: list[float] | np.ndarray,
scan_rate: float,
c_bulk: float,
step_size: float,
disk_radius: float,
temperature: float = 298.0,
reduction_potential: float | None = None,
diffusion_reactant: float | None = None,
diffusion_product: float | None = None,
) -> None:
super().__init__(
voltage_to_fit,
current_to_fit,
scan_rate,
c_bulk,
step_size,
disk_radius,
temperature,
reduction_potential,
diffusion_reactant,
diffusion_product,
)

def _scheme(self, get_var: Callable[[str], float]) -> CyclicVoltammetryScheme:
return E_rev(
Expand Down
52 changes: 52 additions & 0 deletions src/cvsim/mechanisms.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,60 @@ class E_rev(CyclicVoltammetryScheme):
Provides a current-potential profile for a reversible (Nernstian) one-electron transfer mechanism.
This is equation (7:7) from [1].

Parameters
----------
start_potential : float
Starting potential of scan (V vs. reference).
switch_potential : float
Switching potential of scan (V vs. reference).
reduction_potential : float
Reduction potential of the one-electron transfer process (V vs. reference).
scan_rate : float
Potential sweep rate (V/s).
c_bulk : float
Bulk concentration of redox species (mM or mol/m^3).
diffusion_reactant : float
Diffusion coefficient of reactant (cm^2/s).
diffusion_product : float
Diffusion coefficient of product (cm^2/s).
step_size : float
Voltage increment during CV scan (mV).
Default is 1.0 mV, a typical potentiostat default.
disk_radius : float
Radius of disk macro-electrode (mm).
Default is 1.5 mm, a typical working electrode.
temperature : float
Temperature (K).
Default is 298.0 K (24.85C).

"""

def __init__(
self,
start_potential: float,
switch_potential: float,
reduction_potential: float,
scan_rate: float,
c_bulk: float,
diffusion_reactant: float,
diffusion_product: float,
step_size: float = 1.0,
disk_radius: float = 1.5,
temperature: float = 298.0,
) -> None:
super().__init__(
start_potential,
switch_potential,
reduction_potential,
scan_rate,
c_bulk,
diffusion_reactant,
diffusion_product,
step_size,
disk_radius,
temperature,
)

def simulate(self) -> tuple[np.ndarray, np.ndarray]:
"""
Simulates the CV for a reversible one-electron transfer mechanism.
Expand Down