ecNetSim_LTPS_NGS V10.7 & ecTrans V5.0 — User Manual
(AI-generated, may contain significant errors)

Author: Dr. Zhaoxiang Deng (USTC)
License: This software is licensed to the author only. Unauthorized distribution or commercial use is strictly prohibited.
Supported SPICE backends: PSpice/PSpice-For-TI/LTspice/QSPICE/Micro-Cap/NGSPICE (open source)
Supported plotting: Gnuplot (open source)


Table of Contents

  1. Overview
  2. System Requirements & Installation
  3. Usage — Command Line
  4. Input File Format (.atn)
  5. Output Files
  6. Simulation Modes
  7. Diffusion Geometries
  8. Electrochemical Techniques Supported
  9. Adsorption Support
  10. ecTrans 5.0 — NGSPICE Integration & Post-Processing
  11. Gnuplot Output & Concentration Profiles
  12. Annotated Input File Examples
  13. Error Messages Reference
  14. Advanced Tips
  15. Version History (selected)

1. Overview

ecNetSim converts electrochemical reaction schemes into SPICE netlists and executes transient circuit simulations to obtain cyclic voltammograms (CV), chronoamperograms (CA), and related results. Its core idea is the network model (ecNet): each mass-transport box becomes a resistor–capacitor network element, and charge-transfer kinetics become voltage-controlled current sources (G elements). The program reads a plain-text input file (.atn), generates a SPICE netlist (.sp, .cir, or .net), optionally runs NGSPICE or LTspice, reads the resulting .raw file, and plots via Gnuplot.

ecTrans is a companion program that accepts a previously generated (or user-modified) .sp or .spt netlist, drives NGSPICE in batch mode, parses the binary/ASCII .raw output, writes tabulated .out data files, generates a Gnuplot .gp script, and launches Gnuplot for interactive plotting — all in a single command-line invocation.

Capabilities summary

Feature Details
Electrode geometries Linear, Spherical, Cylindrical, Rotational Disk (RDE), Finite Diffusion (thin layer), Surface (SF/thin-film)
Electrochemical methods CV, CA, SWV (Osteryoung & Barker), SCV, DPV, ACV, EIS
Reaction types Electron Transfer Reactions (ETR, Butler-Volmer), Homogeneous Chemical Reactions (HCR, forward + backward, 1st/2nd-order)
Adsorption Langmuir-type: equilibrium or kinetic; competitive (default) or non-competitive (independent-site); active (ETR) and inactive (HCR-only) adsorbates; pre-adsorption equilibrium
iR drop / double layer Uncompensated resistance Ru and double-layer capacitance Cdl
Natural convection Optional correction layer for long-time experiments
SPICE backends LTspice (.sp), PSPICE (.net/.cir), NGSPICE (.sp)
Plotting Gnuplot (dimensionless i vs. E or t; real i vs. E or t; concentration profiles; heatmap; 3D surface)
Concentration profiles Optional 2D heatmap and 3D (time × space × concentration) output, including adsorbed surface excess
ecTrans integration One-command NGSPICE run + raw parsing + Gnuplot plotting

2. System Requirements & Installation

Directory structure example

C:\NETSIM\
  ecNetSimV10.x.exe     <- main executable (ecNetSim)
  ecTransV5.0.exe        <- companion NGSPICE runner
  ngspice\
    ngspice.exe          <- NGSPICE 64-bit binary
  ltspice\
    ltspice.lnk          <- shortcut to LTspice XVII
  pspice\
    pspice.lnk           <- shortcut to PSpice
  gnuplot\
    gnuplot.lnk          <- shortcut to Gnuplot
  input.atn              <- your input file

Using a .bat wrapper

To call the program from any directory (so the input file path is resolved correctly), use the provided batch wrapper:

@"C:\NETSIM\ecNetSimV10.x.exe" "%CD%\%~1"

Call as: ecnetsim myfile.atn


3. Usage — Command Line

3.1 ecNetSim 10.7

ecNetSimV10.x.exe [FILENAME]
ecNetSimV10.x.exe /?

3.2 ecTrans 5.0

ecTransV5.0.exe  <FILENAME>.sp
ecTransV5.0.exe  <FILENAME>.spt

4. Input File Format (.atn)

4.1 General Rules

  1. The file consists of alternating prompt lines (in square brackets, e.g. [Number of Reaction-diffusion Species(no period)]) and data lines.
  2. Do not modify prompt lines. The program validates them exactly; any change causes a fatal error.
  3. Data lines follow immediately after each prompt line. Blank lines and * memo lines between prompt and data are silently skipped.
  4. Lines starting with * are treated as memo/comment lines and are silently skipped everywhere.
  5. Whitespace: leading and trailing spaces are stripped automatically. TAB characters are forbidden and will trigger an error.
  6. Terminators:
    • Sections that end with (with period) in the prompt use . (period) as a section terminator and ; as a record separator.
    • Sections that end with (no period) use a single value on one line; no terminator needed.
  7. Scientific notation: values like 1e-5, 1E-5, 1.5e-10 are supported everywhere. The built-in SafeVal() function correctly handles negative exponents that QB64's native Val() misparses.
  8. The file ends with the line [END].
  9. Appended input: If using sp+/cir+/net+ as [Netlist] option, input (.atn) content is appended to the end of the netlist, allowing re-run from the netlist file directly with ecNetSim. Note: ecTrans only works with netlist files and does NOT require the + suffix; the + suffix is an ecNetSim-internal feature for embedding .atn content.
  10. Prompt-line validation (sqerr): The program counts how many prompt lines are matched. At the end, it verifies the count against expected values (15, 16, 17, or 18 depending on which optional sections are present). A mismatch produces the error *"You must have changed the prompt lines in the input file!"*.

4.2 Block-by-Block Reference


[Method(CV/CA: Cyclic Voltammetry/ChronoAmperometry)(no period)]

Data line: CV or CA

Value Meaning
CV Cyclic voltammetry (default)
CA Chronoamperometry

If omitted or invalid, defaults to CV.


[Number of Reaction-diffusion Species(no period)]

Data line: a positive integer N (≥ 1).

Defines the total number of species that participate in diffusion and/or adsorption. Must be set before the ETR/HCR blocks. Species are referenced by index 1 … N throughout the file.


Electron Transfer Reactions (ETR)

There are four variant prompt lines for ETR — the program accepts any of them:

  1. [Electron Transfer Reactions|E0'(V)|alpha|alpha2|na|k0(cm/s or s^-1 for SF)(with period)]
  2. [ET Reactions|E0'(V)|alpha|alpha2|na|k0(cm/s or s^-1 for SF)(prefix @/@@: dependent/independent ETRs of adsorbates)(with period)]
  3. [Electron Transfer Reactions|E0'(V)|alpha|na|k0(cm/s or s^-1 for SF)(with period)]
  4. [ET Reactions|E0'(V)|alpha|na|k0(cm/s or s^-1 for SF)(prefix @/@@: dependent/independent ETRs of adsorbates)(with period)]

The number of ETR reactions m is NOT specified by the user. The parser reads reaction lines one by one after the prompt. If the first data line starts with [, then m = 0 (no ETR). Otherwise, reactions are read until a line ending in . (last reaction) is encountered.

NOTE — Minimal input required for pure chemical kinetics mode (m = 0, no ETR, HCR present):

Each ETR occupies one line ending in ; (more reactions to follow) or . (last reaction):

OxSpeciesNum[a]+|-[n]e<->RedSpeciesNum[a]|E0'|alpha[|alpha2]|na|k0;

Fields (pipe-separated):

Field Description
OxSpeciesNum Species number (integer) of the oxidized form. Append a (e.g. 1a) if this species is adsorbed.
+ or - Sign of electron transfer direction: + = reduction (electrons gained by species), - = oxidation (electrons lost by species).
[n]e Number of electrons transferred. e alone means 1 electron. Example: 2e means 2 electrons.
<-> or -> <-> = reversible; -> or --> = irreversible (forward only).
RedSpeciesNum Species number of the reduced form. Use 0 if this species does not diffuse (e.g. stripped metal). Append a for adsorbed.
E0' Formal potential (V).
alpha Cathodic transfer coefficient α_c (0 < α < 1, typically 0.5).
alpha2 (new format only, prompts 1 & 2) Anodic transfer coefficient α_a. If omitted or if Abs(n_electron) < 2, α_a = 1 − α_c. Only used as a separate parameter when Abs(n_electron) ≥ 2.
na Number of electrons involved in the rate-determining step. Input as a positive integer (e.g. 1, 2); the program automatically applies the direction sign based on the +/- symbol. Usually equals 1.
k0 Standard heterogeneous rate constant (cm/s for diffusion types; s⁻¹ for SF).

Adsorbed species ETR prefix (prompts 2 & 4 only):

When ALL species in the ETR are adsorbed (all marked with trailing a, e.g. 1a+e<->2a), prefix the line with @ or @@ to indicate an adsorbate ETR. The @/@@ prefix represents electrochemical or chemical conversion between adsorbed states on the electrode surface. Both modes use surface concentration nodes and the same k⁰ normalization (k0_nondim = k⁰ × τ); the difference is only in the formal potential treatment:

Example — @ (dependent) adsorbate ETR:

@1a+e<->2a|0|0.5|1|1e8.

E⁰_input = 0 V. If β₁ = 100 and β₂ = 400, then E⁰_corrected = 0 − (RT/F)·ln(100/400) = +0.036 V (at 298 K).

Example — @@ (independent) adsorbate ETR:

@@1a+1e<->2a|0.36|0.5|1|1e8.

E⁰ = 0.36 V is used directly as the surface formal potential. No β-dependent correction.

Example — single-step 1e reduction (new format with alpha2):

1+1e<->2|0.0|0.5|0.5|1|0.01.

Species 1 (Ox) + 1 electron → Species 2 (Red), E⁰' = 0.0 V, α_c = 0.5, α_a = 0.5, na = 1, k⁰ = 0.01 cm/s.

Example — single-step 1e oxidation (legacy format without alpha2):

1-e<->2|0.49|0.5|1|1e6.

Species 1 (Red) − 1 electron → Species 2 (Ox), E⁰' = 0.49 V, α_c = 0.5, na = 1, k⁰ = 1×10⁶ cm/s.

Example — adsorbate ETR with kinetic adsorption:

@1a+e<->2a|0|0.5|1|1e8.

Dependent adsorbate ETR: adsorbed species 1 → adsorbed species 2, E⁰ = 0 V, k⁰ = 1×10⁸ s⁻¹.

Example — two sequential ETRs (EEE mechanism, legacy format):

1-e<->2|0.49|0.5|1|1e6;
2-e<->3|1.15|0.5|1|1e6.

If no ETR reactions are desired, the prompt line must still be present, but the next line can be another prompt line starting with [; the program will then set m = 0.


Homogeneous Chemical Reactions (HCR)

Two variant prompt lines:

  1. [Homogeneous Chemical Reactions|kfc|kbc(with period)]
  2. [Homogeneous Chemical Reactions|kfc|kbc(prefix @: reactions of adsorbates)(with period)]

The number of HCR reactions mc is NOT specified by the user. If the first data line starts with [ and m <> 0, then mc = 0. If m = 0 and the data line starts with [, the program reports an error.

Each HCR reaction occupies one line ending in ; or .:

ReactantSpeciesList<->|-->ProductSpeciesList|kfc|kbc;

Fields:

Field Description
ReactantSpeciesList Species numbers separated by + (or space). Append a for adsorbed (e.g. 2a).
<-> or --> <-> = reversible; --> = irreversible.
ProductSpeciesList Same format as reactants. Use 0 for a species that leaves the system (e.g. gas).
kfc Forward rate constant. Units depend on reaction order: 1st order → s⁻¹; 2nd order → mM⁻¹s⁻¹.
kbc Backward rate constant (same unit convention). Use 0 for irreversible.

Adsorbed HCR prefix (prompt 2 only): @ before a reaction line denotes an adsorbate reaction.

Example — 2nd-order dimerization (irreversible):

1+1-->0|1e4|0.

Two molecules of species 1 → product leaves system, kf = 1×10⁴ mM⁻¹s⁻¹, irreversible.

Example — EC mechanism (E followed by C): ETR block: 1-e<->2|0.0|0.5|1|0.1. HCR block: 2<->3|100|1.

Example — multi-species reversible HCR with adsorbates:

2<->3|1e10|0;
@2a<->3a|1e12|0;
2+5a<->1+6|4.3e2|1e5.

[Diffusion Type(L/S/C/RDE/FD/SF: Linear/Spherical/Cylindrical/Rotational Disk/Finite Diffusion/SurFace)(no period)]

Conditional: This section is only processed when m <> 0.

Data line: one of:

Code Geometry
L Semi-infinite planar (linear) diffusion
S Semi-infinite spherical diffusion (microelectrode)
C Semi-infinite cylindrical diffusion
RDE Rotating disk electrode (Levich–Koutecký)
FD Finite (thin-layer) linear diffusion
SF Surface-confined (no diffusion; all species adsorbed)

Default if omitted (next line starts with [): L.


[Area(cm^2)/Radius(um)/Radius,Length(cm)/Angular Velocity(rad/s),Kinematic Viscosity(cm^2/s),Area/Area,Thickness(cm)/Area(no period)]

Conditional: This section is only processed when m <> 0.

Data line format depends on diffusion type:

Diffusion type Data format Example
L area(cm²) 0.0314
S radius(μm) 5
C radius(cm),length(cm) 0.01,0.5
RDE ω(rad/s),ν(cm²/s),area(cm²) 100,0.01,0.0314
FD area(cm²),thickness(cm) 0.01,0.001
SF area(cm²) 0.01

All values must be positive.


[Experimental: cycles,Ei(V),Es(V),Et(V),v(V/s) or Time(s) for CA,Temper(C.D.)(no period)]

or the variant with rest time:

[Experimental: cycles,Ei(V),Es(V),Et(V),v(V/s) or Time(s) for CA,Rest time(s),Temper(C.D.)(no period)]

Data line: cycles,Ei,Es,Et,v[,t_rest],temperature

Parameter Description
cycles Number of CV cycles (integer ≥ 1). For CA, use 1.
Ei Initial potential (V).
Es Switching (vertex) potential (V).
Et Final potential (V). For CA with cycles > 1: Et is the alternate step potential (alternates with Es). For CA with cycles = 1: not used but must be provided (set equal to Ei).
v Scan rate (V/s) for CV, or total time (s) for CA. Must be > 0.
t_rest (variant only) Pre-experiment equilibration rest time (s). Can be empty for no rest.
temperature Temperature (°C). Warning issued if ≤ 0.

Notes:

Example — CV, 2 cycles, ±0.5 V window, 0.1 V/s, 25 °C:

2,-0.5,0.5,-0.5,0.1,25

Example — CA with rest time (empty for no rest):

1,1.2,-0.5,1.2,1e4,,25.0

[Simulation: boxnum,beta,dE(mV) or dt(s) for CA(no period)]

or the variant with binary reading limit:

[Simulation: boxnum,beta,binary reading limit,dE(mV) or dt(s) for CA(no period)]

Data line: boxnum,beta[,bin_limit],dE

Parameter Description
boxnum Number of spatial boxes (finite difference grid points along x). Typical: 30–200. Must be > 0.
beta Grid expansion parameter. 0 = uniform grid; > 0 = exponentially expanding grid (recommended: 0.3–0.5).
bin_limit (variant only) File size threshold (bytes) for the data_3d subroutine to choose reading mode. If the .out file is smaller than bin_limit, the entire file is loaded into memory at once via binary read (Input$). If the file is equal to or larger than bin_limit, the program falls back to line-by-line text reading (Line Input) to avoid memory overflow. Default: 4×10⁶ (≈ 3.8 MB). Leave empty for default.
dE Potential step in mV for CV, or time step in seconds for CA. Must be > 0.

Example:

30,0.5,,1

30 boxes, β = 0.5, bin_limit = default (≈ 3.8 MB), 1 mV step.


[IR drop: Ru(ohm),Cdl(F)(no period)]

Conditional: This section is only processed when m <> 0. If the data line starts with [, both default to 0.

Data line: Ru,Cdl

Parameter Description
Ru Uncompensated resistance (Ω). Use 0 to ignore.
Cdl Double-layer capacitance (F). Use 0 to ignore.

Both must be ≥ 0.

Example:

50,1e-6

[Initial Concentrations(mM or mol/cm^2 for SF)(with period)]

Assigns initial concentrations to all N species. Format:

SpeciesNum[,SpeciesNum2,...][or RangeStart-RangeEnd]|value;
...

Example — 3 species, species 1 at 1 mM, species 2 and 3 at 0 mM:

1|1;
2,3|0.

Example — species 1 only, with scientific notation:

1|0.1e0;
2-6|0e0.

[Diffusion Coefficients(cm^2/s)(with period)]

Conditional: This section is only processed when m <> 0 and diffusion type is not SF. Skipped automatically when m = 0 or SF.

Same format as concentrations. All values must be > 0.

Example:

1-3|1e-5.

All three species have D = 1×10⁻⁵ cm²/s.


[Saturated Surface Excesses(mol/cm^2 for adsorbates)(with period)]

Conditional: This section is only processed when m <> 0. Can be omitted entirely; if present but the first data line starts with [, it is silently skipped.

Required only when adsorption is enabled (i.e., at least one species index ends with a in the ETR/HCR block). Assigns the Langmuir saturation surface excess Γ_max for each adsorbate.

Same format as concentrations. Values must be > 0 for adsorbates.

Example:

1-2|1e-10;
3|1e-10.

[Adsorption Coefficients(mM^-1 for adsorbates) or Rate Constants(kads,kdes)(with period)]

or (equilibrium-only variant):

[Adsorption Coefficients(mM^-1 for adsorbates)(with period)]

Conditional: This section is only processed when m <> 0. Can be omitted entirely; if present but the first data line starts with [, it is silently skipped.

Same format. Two modes per species:

Mode 1 — Equilibrium (Langmuir): Single β value per species:

1|1e2;
2|0.4.

Sets ads_kin = 0 (equilibrium). The surface excess follows the instantaneous Langmuir isotherm: Γ_j = β_j · c_j(0) · Γ_sat,j / (1 + Σ_k β_k · c_k(0)).

Mode 2 — Kinetic (kads, kdes): Comma-separated pair:

1|3e2,1.2e4;

Sets kf_ads and kb_ads individually (also accepted as kads and kdes — both labels are synonymous); β is computed as kf/kb internally. When all adsorbate species use this mode, the simulation uses kinetic Langmuir ODEs: dΓ_j/dt = k_f,j · c_j(0) · (Γ_sat,j − Σ_k Γ_k) − k_b,j · Γ_j.

Mixed input (Mode 1 + Mode 2 on the same block): Allowed. When some species are given single β values and others are given kads,kdes pairs, the program treats the kads,kdes entries by computing β = kf/kb and falls back to equilibrium adsorption for all species. A warning is printed:

<Warning!> Adsorption in equilibrium is assumed in simulation due to lack of required kads and kdes

Example of mixed input (equilibrium result despite species 1 having kinetic constants):

1|3e2,1.2e4;   ← kf/kb → β = 0.025 internally, but equilibrium mode still used
2|0.4.         ← direct β, equilibrium mode

Non-competitive adsorption mode: By default all adsorbate species compete for the same surface sites (competitive Langmuir, comp_ads = 1). To switch to non-competitive (independent-site) Langmuir (comp_ads = 0), prefix any species number in the data block with a minus sign (-):

-1|1e2;
2|0.4.

When any line in this block carries the - prefix, comp_ads is set to 0 for the entire block. The isotherm and vacancy equations change as follows:

Mode Equilibrium isotherm Vacancy (kinetic mode)
Competitive (comp_ads = 1, default) Γ_j = β_j · c_j · Γ_sat,j / (1 + Σ_k β_k · c_k) Γ_vac,j = Γ_sat,j − Σ_k Γ_k
Non-competitive (comp_ads = 0) Γ_j = β_j · c_j · Γ_sat,j / (1 + β_j · c_j) Γ_vac,j = Γ_sat,j − Γ_j

Each species adsorbs independently onto its own set of sites, without competing with other adsorbates. This also affects pre-adsorption equilibrium initialization when + is used.

Pre-adsorption equilibrium marker: Append + before the terminator (; or .) in the value field to enable pre-adsorption equilibrium (all adsorbates initialized at Langmuir equilibrium):

1|3e2,1.2e4+;

Current Output / Simulation Output

These are two separate prompt lines (only ONE may appear in a given .atn file; they are mutually exclusive and share the same handler):

  1. [Current Output(CF/DF:Current Function/DeFault)(no period)]
  2. [Simulation Output(CF/DF/CPn:Current Function/DeFault/Concentration Profle)(no period)]

Conditional: Both are only processed when m <> 0. If the data line starts with [, defaults to DF.

Data line (for either prompt):

Value Meaning
CF Current function ψ = i / xtoi (CV only; not applicable to CA or SF). The dimensional current (A) is divided by the normalization factor xtoi to produce the dimensionless current function ψ. For linear diffusion: xtoi = F·A·Cmax·√(F·v·Dmax/(R·T)). For RDE: xtoi = 0.620·F·A·(Dmax·cm)^(2/3)·ω^0.5·(ν·cm)^(-1/6)·Cmax. (n is fixed at 1; Cmax/Dmax replace C/D of the standard form.)
DF Dimensional current (amperes; default)
CP<n> Concentration profile of species <n> (e.g. CP1, CP2) + default dimensional current output
CP<n>a Surface excess profile of adsorbed species <n> (e.g. CP1a)
CP<n>+ Same as CP<n>, and also generate an _xyz.out 3-column (t, x, c) file
CP<n>- Plot surface concentration of species <n> as a function of time (c at x=0 vs t); not applicable to SF
CP<n>_ Plot initial concentration profile of species <n> at t=0 (c vs x at t=0); also writes _xyz.out; not applicable to SF

If the data line is invalid or unrecognized, defaults to DF.


[Dimensionless Simulation Layer: Lmax(no period)]

or the variant with natural convection:

[Dimensionless Natural Convection Layer and Simulation Layer: delta_Convec,Lmax(no period)]

Conditional: Both are only processed when m <> 0. The two variants are mutually exclusive — only one appears in a given .atn file.

Variant 1 — Lmax only: | Input | Meaning | |-------|---------| | 6 (or any number) | Explicit dimensionless diffusion layer thickness. Default for linear/spherical/cylindrical = 6. | | 3delta_max | RDE: 3× the Levich diffusion layer. Any multiplier is allowed. | | (blank or next line starts with [) | Program auto-selects: 6 for L/S/C; 3*delta_max for RDE; length/√(D_max·τ) for FD. |

Variant 2 — Both natural convection and Lmax: Two comma-separated values: delta_Convec,Lmax

Example:

0.06546,6

[Netlist: net/cir/sp]

Data line: net, cir, sp, net+, cir+, or sp+.

Value Netlist format Appends .atn input?
net PSpice .net No
cir PSpice/HSPICE .cir No
sp ngspice/LTspice .sp No
net+ / cir+ / sp+ Same formats Yes (.atn content appended at end of netlist)

Default: sp.

When + is used, output files share the same base name and directory as the input file. Without +, files are written as autonet.* in the current working directory.


[Do you want to run the simulation immediately(Y/N)?(no period)]

Data line: Y, N, Y+, or N+.

Value Meaning
Y Run LTspice/PSPICE immediately after netlist generation (requires .\ltspice\ltspice.lnk or .\pspice\pspice.lnk)
N Generate netlist only
Y+ Run NGSPICE immediately (requires .\ngspice\ngspice.exe; netlist must be .sp)
N+ Generate .sp netlist for manual NGSPICE run or for use with ecTrans

Recommendation: Use N+ when you plan to post-process with ecTrans 4.0, or when you want to manually edit the netlist before simulating.


[END]

Mandatory last line of the input file.


5. Output Files

Extension Contents Condition
.chk Human-readable summary of all parsed parameters (for verification) Always
.sp / .cir / .net SPICE netlist (ready to simulate) Always
.plt LTspice plot settings file When netlist=sp
.pfg QSPICE plot settings file When netlist=sp
.atn Re-exported input file When using sp+/net+/cir+
.raw NGSPICE binary/ASCII simulation output When Y+ selected or run via ecTrans
.out Tab-separated simulation results After NGSPICE run + raw_reader
.log NGSPICE log output After NGSPICE run
.gp Gnuplot script (auto-generated) After NGSPICE run + raw_reader
_3d.out 3D concentration profile data matrix When CP output selected
_xyz.out 3-column file: t, x, c When CP<n>+ selected

5.1 The .atn output file and the net+/sp+/cir+ option

When you append + to the netlist format (net+, sp+, or cir+) at the [Netlist: net/cir/sp] prompt, ecNetSim sets an internal flag (atn_out$ = "+") and changes its output behavior:

1. Netlist file — input content appended inside

The program appends the entire .atn input file after a delimiter block at the end of the generated netlist:

* INPUT SOURCE (for reference, not part of netlist)
* ==================================================
[Number of Reaction-diffusion Species(no period)]
5
...
[END]

This embedded copy allows ecNetSim to re-run the simulation directly from the netlist file, without requiring the original .atn file to be present.

2. Standalone .atn output file

A separate .atn file is also written to the output directory (outputDir$ + file_name$ + ".atn"), containing the same content. This gives you a clean, standalone copy of the input that produced the netlist.

3. Re-running from the netlist file

When you later run:

ecNetSimV10.x.exe myfile.sp

...the program detects the * INPUT SOURCE... marker, extracts the embedded .atn content, re-parses it, and regenerates the netlist. This is functionally equivalent to re-running with the original .atn file.

4. Without the + suffix (net / sp / cir)

The .atn content is not appended to the netlist. The netlist file contains only SPICE netlist statements. To re-run the simulation, you must keep the original .atn file separately.

Note: ecTrans does NOT use the + suffix. It reads the netlist file directly and does not need the embedded .atn content. The + suffix is an ecNetSim-only feature for convenience when iterating on input files.


6. Simulation Modes

Cyclic Voltammetry (CV)

The applied potential waveform is:

Ei → Es (first half-scan) → Et → Es (second half-scan) → ... × cycles

The potential step dE (mV) controls the time resolution. Smaller dE = finer resolution but slower.

Chronoamperometry (CA)

The potential is stepped from Ei to Es (near-instantaneously) and held at Es. The "scan rate" field in the input file is reinterpreted as total time τ (s). dE is reinterpreted as the time step dt (s). For multi-cycle CA, the potential alternates between Es and Et each half-cycle.

Advanced Waveforms (SWV, DPV, ACV, EIS)

ecNetSim generates the CV/CA waveform automatically. For other waveforms (SWV, DPV, ACV, EIS), commented-out SPICE source lines are inserted into the netlist as templates. The user manually un-comments the relevant lines:


7. Diffusion Geometries

Linear (L)

Semi-infinite 1D diffusion to a planar electrode. Input: electrode area A (cm²).

Spherical (S)

Semi-infinite spherical diffusion to a microelectrode. Input: electrode radius r (μm).

Cylindrical (C)

Semi-infinite cylindrical diffusion. Input: radius (cm), length (cm).

Rotational Disk Electrode (RDE)

Uses the Levich–Koutecký model. Input: angular velocity ω (rad/s), kinematic viscosity ν (cm²/s), electrode area A (cm²).
Default Lmax = 3·δ_Levich.

Finite Diffusion (FD)

Thin-layer cell with a reflective boundary at x = L. Input: area A (cm²), layer thickness L (cm).

Surface-confined (SF)

No spatial diffusion. All species are surface-confined (thin-film or adsorbed monolayer).
Input: electrode area A (cm²).
Rate constant k⁰ has units s⁻¹.
Concentration has units mol/cm².
CF output is not available for SF.


8. Electrochemical Techniques Supported

Technique Method parameter Waveform Notes
CV CV Auto-generated sawtooth Standard
CA CA DC potential step Standard
LSV CV (1 cycle, Et = Es) Single sweep Set cycles=1, Et=Es
SCV Netlist template Staircase PULSE Manual edit required
SWV (Osteryoung) Netlist template Staircase + square pulse Manual edit
SWV (Barker) Netlist template Ramped CV + square pulse Manual edit
DPV Netlist template Staircase + differential pulse Manual edit
ACV Netlist template DC + SIN perturbation Manual edit
EIS Netlist template White noise .include Manual edit

9. Adsorption Support

To enable adsorption, append a to a species number in the ETR or HCR reaction formula (e.g. 1a means species 1 is adsorbed). The program then expects:

Equilibrium Langmuir Adsorption

The surface excess is determined by the instantaneous bulk concentration at x = 0.

Competitive (default, comp_ads = 1): All adsorbates share the same surface sites:

Γ_j = β_j · c_j(0) · Γ_sat,j / (1 + Σ_k β_k · c_k(0))

Non-competitive (comp_ads = 0): Each species adsorbs onto independent sites (triggered by a - prefix; see Section 4.2):

Γ_j = β_j · c_j(0) · Γ_sat,j / (1 + β_j · c_j(0))

This is the default adsorption mode (ads_kin = 0). It is activated unless all adsorbate species in the block are given kads,kdes pairs (see Kinetic mode below).

Kinetic Langmuir Adsorption

The surface excess evolves dynamically.

Competitive (comp_ads = 1, default):

dΓ_j/dt = k_f,j · c_j(0) · (Γ_sat,j − Σ_k Γ_k) − k_b,j · Γ_j

Non-competitive (comp_ads = 0):

dΓ_j/dt = k_f,j · c_j(0) · (Γ_sat,j − Γ_j) − k_b,j · Γ_j

Activated only when all adsorbate species in the block are given kads,kdes pairs (ads_kin = 1). If any species uses a single β value (Mode 1), ads_kin is reset to 0 and the entire block falls back to equilibrium adsorption (see Mixed Input below).

Mixed Input

The [Adsorption Coefficients] block permits mixing Mode 1 (β) and Mode 2 (kads,kdes) entries for different species in the same block. When this occurs, the kads,kdes pairs are internally converted to β = kf/kb, and the simulation proceeds with equilibrium adsorption for all species. A runtime warning is emitted:

<Warning!> Adsorption in equilibrium is assumed in simulation due to lack of required kads and kdes

Adsorbate ETR

Adsorbate ETRs are defined by prefixing the reaction line with @ or @@ and using species numbers with trailing a (e.g. 1a, 2a). The @/@@ prefix determines whether the formal potential is corrected for adsorption free energy.

@ (dependent adsorbate ETR): The input E⁰ is the standard (bulk-solution) formal potential. The program applies the Nernst correction: E⁰_corrected = E⁰_input − (RT/nF)·ln(β_Ox/β_Red). This requires β values for both oxidized and reduced adsorbates in the [Adsorption Coefficients] block. Use when the adsorbed ETR is thermodynamically coupled to solution-phase E⁰.

@@ (independent adsorbate ETR): The input E⁰ is the surface formal potential and is used directly without correction. Use when the E⁰ is defined for the adsorbed phase and does not depend on bulk β values.

Both modes share identical SPICE netlist structure: surface concentration nodes (az0_5), rate normalization (k0_nondim = k⁰ × τ), and Butler-Volmer expression. The only difference is the E⁰ treatment.

Pre-adsorption equilibrium

Append + before the terminator in the Adsorption Coefficients value to initialize all adsorbates at Langmuir equilibrium before the simulation starts. The initialization formula follows the active comp_ads setting (competitive or non-competitive):

1|3e2,1.2e4+;

Both electrochemically active (participating in ETR) and inactive (participating in HCR only) adsorbed species are supported.


10. ecTrans 5.0 — NGSPICE Integration & Post-Processing

10.1 How ecTrans works

ecTrans automates the entire NGSPICE → raw data → plot pipeline:

1. Parse command-line path → extract directory and base filename
2. Delete any existing .raw, .out, _xyz.out, _3d.out files for this name
3. Call NGSPICE in batch mode:
   Shell ".\ngspice\ngspice -b <file>.sp -r <file>.raw -o <file>.log"
4. Check .raw file exists:
   If NOT found → "Simulation failed!" → exit
   If found:
     a. Call raw_reader → parse binary/ASCII .raw data
     b. Read metadata comment from .sp file:
        "*info for data plotting by transient:"
        Extracts: method, difftype, Ru, Cdl, conc_start, cp_yes,
                 cp_ads_yes, tao, t_rest, Cmax, Dmax, Lmax
     c. Write .gp Gnuplot script (multiple plot windows)
     d. If CP data present: call data_3d → write _3d.out
     e. Call gnuplot → display interactive plots

10.2 Raw file format

NGSPICE outputs both binary and ASCII .raw files. ecTrans auto-detects the format by searching for Binary: in the header. For binary files, variables are stored as 64-bit doubles. The first variable is always time (time); subsequent variables are node voltages (V(node)).

10.3 Metadata in .sp file

When ecNetSim generates the netlist, it always appends a metadata comment block that ecTrans reads. The sp+/cir+/net+ suffix only controls whether the .atn input content is also appended; the metadata block (*info for data plotting by transient:) is always present regardless of the + suffix.

*info for data plotting by transient:
*method: CV
*difftype: L
*Ru: 0
*Cdl: 0
...

This allows ecTrans to configure its post-processing automatically without requiring additional user input.

10.4 Running ecTrans manually

ecTransV5.0.exe myfile.sp

Or with NGSPICE directly (without ecTrans):

ngspice -b myfile.sp -r myfile.raw -o myfile.log
gnuplot myfile.gp

Note: When running NGSPICE manually (without ecTrans), the .gp script must be manually created or modified to match your simulation parameters, as ecTrans normally generates this file automatically.


11. Gnuplot Output & Concentration Profiles

Standard plots generated (CV mode)

Window Content
Plot 1 Dimensionless current vs. dimensionless potential
Plot 2 Real current (A) vs. real potential (V)
Plot 3 (if CP) Concentration heatmap (time × space, false-color)
Plot 4 (if CP) 3D surface or matrix plot

Standard plots generated (CA mode)

Window Content
Plot 1 Real current (A) vs. real time (s)
Plot 2 Dimensionless current vs. dimensionless time
Plot 3 (if CP) Concentration heatmap

.out file columns (CV, Ru = 0, Cdl = 0)

Column Meaning
1 Point index
2 Dimensionless time t/τ
3 Real potential E (V)
4 Dimensionless current i_norm
5 Conversion factor: i(A) / i_norm
6 Real current i (A) = col 4 × col 5
7+ Concentration values for each species/box (if CP output selected)

Additional columns appear when Ru ≠ 0 or Cdl ≠ 0 (Cdl current component and IR-corrected potential).

Concentration profile option

Set [Simulation Output] or [Current Output] to CP<n> where <n> is the species number (1, 2, ...).

Use CP<n>+ to also output _xyz.out (t, x, c format, suitable for external post-processing).

Use CP<n>a for adsorbed species surface excess profiles.

Use CP<n>- to plot the surface concentration of species <n> (c at x = 0) as a function of time instead of the full heatmap. This is useful for surface-dominated processes or when only the boundary concentration evolution is needed. Not applicable to SF.

Use CP<n>_ to plot the initial spatial concentration profile of species <n> at t = 0 (c vs x) instead of the time-evolved heatmap. This also triggers _xyz.out output. Not applicable to SF.


12. Annotated Input File Examples

Example 1: Reversible CV, linear diffusion (E + C mechanism)

Below is an E + C mechanism (1e⁻ reduction followed by irreversible chemical disappearance), 2 species, linear diffusion, 2 CV cycles. This follows the same format as the reference manual for v9.6.

[Method(CV/CA: Cyclic Voltammetry/ChronoAmperometry)(no period)]
CV

[Number of Reaction-diffusion Species(no period)]
2

[Electron Transfer Reactions|E0(V)|arfa|arfa2|na|k0(cm/s or s^-1 for SF)(with period)]
1+1e<->2|0.0|0.5|0.5|1|0.01.

[Homogeneous Chemical Reactions|kfc|kbc(with period)]
2<->0|100|0.

[Diffusion Type(L/S/C/RDE/FD/SF: Linear/Spherical/Cylindrical/Rotational Disk/Finite Diffusion/SurFace)(no period)]
L

[Area(cm^2)/Radius(um)/Radius,Length(cm)/Angular Velocity(rad/s),Kinematic Viscosity(cm^2/s),Area/Area,Thickness(cm)/Area(no period)]
0.0314

[Experimental: cycles,Ei(V),Es(V),Et(V),v(V/s) or Time(s) for CA,Temper(C.D.)(no period)]
2,-0.5,0.5,-0.5,0.1,25

[Simulation: boxnum,beta,dE(mV) or dt(s) for CA(no period)]
100,0.4,2

[IR drop: Ru(ohm),Cdl(F)(no period)]
0,0

[Initial Concentrations(mM or mol/cm^2 for SF)(with period)]
1|1.0;
2|0.

[Diffusion Coefficients(cm^2/s)(with period)]
1,2|5e-6.

[Current Output(CF/DF:Current Function/DeFault)(no period)]
DF

[Dimensionless Simulation Layer: Lmax(no period)]
6

[Netlist: net/cir/sp]
sp+

[Do you want to run the simulation immediately(Y/N)?(no period)]
Y+

[END]

Example 2: Adsorption with kinetic model, solution + adsorbate ETRs

This example (adapted from EC_CV_ADS_SF_ETR_HCR2.atn) demonstrates:

*for ecNetSim v10.2 and higher.
[Method(CV/CA: Cyclic Voltammetry/ChronoAmperometry)(no period)]
CV
[Number of Reaction-diffusion Species(no period)]
3
[ET Reactions|E0(V)|arfa|na|k0(cm/s or s^-1 for SF)(prefix @/@@: dependent/independent ETRs of adsorbates)(with period)]
1+e<->2|0|0.5|1|1;
@1a+e<->2a|0|0.5|1|1e8.
[Homogeneous Chemical Reactions|kfc|kbc(prefix @: reactions of adsorbates)(with period)]
2<->3|1e10|0;
@2a<->3a|1e12|0.
[Diffusion Type(L/S/C/RDE/FD/SF: Linear/Spherical/Cylindrical/Rotational Disk/Finite Diffusion/SurFace)(no period)]
L
[Area(cm^2)/Radius(um)/Radius,Length(cm)/Angular Velocity(rad/s),Kinematic Viscosity(cm^2/s),Area/Area,Thickness(cm)/Area(no period)]
0.196
[Experimental: cycles,Ei(V),Es(V),Et(V),v(V/s) or Time(s) for CA,Rest time(s),Temper(C.D.)(no period)]
1,1.2,-0.5,1.2,1e4,,25.0
[Simulation: boxnum,beta,binary reading limit,dE(mV) or dt(s) for CA(no period)]
30,0.5,,1
[IR drop: Ru(ohm),Cdl(F)(no period)]
0,0
[Initial Concentrations(mM or mol/cm^2 for SF)(with period)]
1|1;
2,3|0.
[Diffusion Coefficients(cm^2/s)(with period)]
1-3|1e-5.
[Saturated Surface Excesses(mol/cm^2 for adsorbates)(with period)]
1-2|1e-10;
3|1e-10.
[Adsorption Coefficients(mM^-1 for adsorbates) or Rate Constants(kads,kdes)(with period)]
1|3e2,1.2e4+;
2|1e2,0.1;
3|3e2,1.2e4.
[Simulation Output(CF/DF/CPn:Current Function/DeFault/Concentration Profle)(no period)]
*CP1
[Dimensionless Natural Convection Layer and Simulation Layer: delta_Convec,Lmax(no period)]
*0.06546,6
[Netlist: net/cir/sp]
sp
[Do you want to run the simulation immediately(Y/N)?(no period)]
Y+
[END]

Notes on this example:

Example 3: Multi-step ETR with adsorption (fence mechanism)

This example (adapted from fence_set_ADS.atn) demonstrates a complex electrochemical scheme with 4 sequential ETRs, HCR cross-coupling, and equilibrium adsorption.

[Method(CV/CA: Cyclic Voltammetry/ChronoAmperometry)(no period)]
CV
[Number of Reaction-diffusion Species(no period)]
6
[Electron Transfer Reactions|E0(V)|arfa|na|k0(cm/s or s^-1 for SF)(with period)]
1-e<->2|0.49|0.5|1|1e6;
2-e<->3|1.15|0.5|1|1e6;
4-e<->5|0.050|0.5|1|1e6;
5-e<->6|0.63|0.5|1|1e6.
[Homogeneous Chemical Reactions|kfc|kbc(with period)]
4-->1|600|0;
2a-->5|290|0;
3-->6|5e3|0;
2+5a<->1+6|4.3e2|1e5.
[Diffusion Type(L/S/C/RDE/FD/SF: Linear/Spherical/Cylindrical/Rotational Disk/Finite Diffusion/SurFace)(no period)]
L
[Area(cm^2)/Radius(um)/Radius,Length(cm)/Angular Velocity(rad/s),Kinematic Viscosity(cm^2/s),Area/Area,Thickness(cm)/Area(no period)]
0.000314
[Experimental: cycles,Ei(V),Es(V),Et(V),v(V/s) or Time(s) for CA,Temper(C.D.)(no period)]
1,-0.4,1.4,-0.4,200,25.0
[Simulation: boxnum,beta,dE(mV) or dt(s) for CA(no period)]
30,0.5,1
[IR drop: Ru(ohm),Cdl(F)(no period)]
0,0
[Initial Concentrations(mM or mol/cm^2 for SF)(with period)]
1|0.1e0;
2-6|0e0.
[Diffusion Coefficients(cm^2/s)(with period)]
1-6|1.0e-05.
[Saturated Surface Excesses(mol/cm^2 for adsorbates)(with period)]
2|6.25e-10;
5|10e-10.
[Adsorption Coefficients(mM^-1 for adsorbates)(with period)]
2|0.4;
5|1.0.
[Current Output(CF/DF:Current Function/DeFault)(no period)]
[Dimensionless Simulation Layer: Lmax(no period)]
[Netlist: net/cir/sp]
sp
[Do you want to run the simulation immediately(Y/N)?(no period)]
Y+
[END]

Notes on this example:


13. Error Messages Reference

Message Cause Fix
Cannot open file! (ERR=53) Input file not found Check path and extension.
You must have changed the prompt lines in the input file! Total matched prompt count ≠ expected (15/16/17/18) Verify all prompt lines match the source exactly, character by character.
At least one species should be initially present! All initial concentrations are zero. Set at least one concentration > 0.
Parameters for ... can NOT be omitted! A required data line is missing (next line starts with [). Provide the required data after each prompt.
Parameters in: ... exceed number of species Species index > snum in concentration/diffusion/ETR/HCR. Use valid species indices (1 … snum).
Et is larger/smaller than Es! Inconsistent potential window for CV. Check Ei, Es, Et ordering.
Invalid potential range! Es = Ei = Et (zero range). Adjust potential values.
TAB spaces should be removed from: ... TAB character detected in input line. Replace all TABs with spaces.
CF output cannot be used for a SF simulation! CF selected with SF diffusion type. Use DF instead.
CF output cannot be used for a CA simulation! CF selected with CA method. Use DF instead.
ETR line without an ending ";" or "." ETR data line missing terminator. Add ; (more reactions) or . (last reaction).
HCR line without an ending ";" or "." HCR data line missing terminator. Same fix.
Invalid ETR input lines Malformed ETR (wrong number of pipe separators, invalid species, etc.). Check format.
Invalid HCR input lines Malformed HCR. Check format.
Ru and Cdl cannot be negative! Negative Ru or Cdl. Use non-negative values.
Concentration cannot be negative! Negative initial concentration. Check input values.
Diffusion coefficient cannot be negative or zero! D ≤ 0 for a diffusing species. Use positive values.
delta_max CANNOT be defined for a non-RDE simulation!!! *delta_max Lmax value used for non-RDE. Use a numeric Lmax value instead.
Adsorption coefficient cannot be negative! Negative β, kads, or kdes. Use positive values.
<Warning!> Adsorption in equilibrium is assumed ... Mixed β and kads,kdes in [Adsorption Coefficients], or kads/kdes present but not all species use them. Equilibrium mode used; provide kads,kdes for all adsorbates to enable kinetic mode, or use single β values consistently.
kads and kdes MUST be assigned for simulation of adsorbate reactions Adsorbate species participate in HCR reactions (via @ prefix) but no kads/kdes were given. Supply kads,kdes pairs for all adsorbates in the [Adsorption Coefficients] block.
Simulation failed! NGSPICE ran but produced no .raw file. Check .log for errors.
NGSPICE.EXE does not exist under ...\ngspice\ NGSPICE binary not found. Install/copy ngspice.exe.
LTSPICE.LNK does not exist under ...\ltspice\ LTspice shortcut not found. Install LTspice and create shortcut.
Warning: temperature is zero or negative! Non-fatal; check your temperature input. Verify temperature value.

14. Advanced Tips

Re-running from a netlist file with ecNetSim

If you used sp+, the .sp file contains the embedded .atn input after the netlist. You can pass the .sp file directly:

ecNetSimV10.x.exe myfile.sp

The program extracts the .atn content, re-parses it, and regenerates the netlist.

ecNetSimV10.x.exe myfile.atn    (Netlist=sp, Run=N)
ecTransV5.0.exe myfile.sp       (NGSPICE + raw parsing + Gnuplot)

This two-step approach allows you to inspect or edit the .sp netlist between generation and simulation.

Choosing beta (grid expansion)

Concentration profile resolution

For a detailed heatmap, set boxnum ≥ 100 and use CP<n>. The Gnuplot heatmap automatically scales x to dimensionless coordinates x/√(D_max·τ) and time to t/τ.

Multiple electron transfers

For a multi-step process where intermediates are detectable, define separate ETR lines:

1-e<->2|0.49|0.5|1|1e6;
2-e<->3|1.15|0.5|1|1e6.

Oxidation reactions

Use - before e to indicate oxidation (species loses electrons):

1-e<->2|0.0|0.5|1|0.01.

The sign of na is automatically derived from the +/- direction: the program multiplies the input na value by enum/Abs(enum). Therefore, always input na as a positive number.

Batch wrapper (run.bat)

@echo off
"C:\NETSIM\ecNetSimV10.x.exe" "%CD%\%~1"

Copy as ecnetsim.bat to a directory in PATH. Then:

cd C:\myproject
ecnetsim input.atn

15. Version History (selected)

Date Change
2007-01-30 Multiple electron transfer reactions added
2018-01-04 QB64 compatibility (CALLS → CALL)
2020-04-09 Removed redundant 1kΩ resistors
2023-03-31 LTspice compatibility
2023-06-14 Bug fix: species #10 assignment in HCR
2024-03-15 Overflow fix for Es = Et; Ei = Es allowed
2026-04-15 PWL format updated for new LTspice version
2026-04-19 .net, .cir, .sp format selection added
2026-04-26 Strict prompt-line validation; multiple parameter checks
2026-04-30 Terminator checks for ETR/HCR/concentration blocks; Current Output and Simulation Output as separate prompts
2026-05-01 TAB character detection; memo (*) line skip
2026-05-04 LTspice .plt and QSPICE .pfg plot file generation
2026-05-06 NGSPICE integration; .tran UIC fix for initial conditions
2026-05-09 SafeVal() function — fixes QB64 Val() bug on negative-exponent sci-notation
2026-05-13–16 Adsorption of electrochemically active species
2026-05-17–18 Adsorption of electrochemically inactive species
2026-05-22–23 Concentration profile output (CP option)
2026-05-23–24 Heatmap plotting; binary 3D data reading
2026-05-26 SWV, SCV, DPV, ACV, EIS netlist templates
2026-05-27 _xyz.out option (CP<n>+); large-file data_3d optimization
2026-05-30 @/@@ prefix for adsorbate ETRs; dependent (E⁰ corrected by β) vs independent (E⁰ direct)
2026-05-31 HCR <->/--> separator; @ prefix for adsorbate HCR
2026-06-01 Kinetic adsorption (kads, kdes); pre-adsorption equilibrium marker (+)
2026-06-01 Rest time parameter; binary reading limit; natural convection correction
2026-06-01 ecTrans 4.0: standalone NGSPICE runner with raw_reader and Gnuplot integration
2026-06-05 arfa/arfa2alpha/alpha2; E0E0' (ETR parameter rename)
2026-06-05 net+/sp+/cir+ option: append .atn input after netlist; re-export .atn file
2026-06-06 Grammar checks for gamma_max / ads_kf_kb_beta; adsorption input validation improved
2026-06-08 CP<n>-: surface concentration vs time plot; CP<n>_: initial concentration profile at t=0
2026-06-08 ecTrans 5.0: supports CP<n>- (surface conc. vs time) and CP<n>_ (t=0 profile) plotting

End of Manual — ecNetSim_LTPS_NGS V10.7 & ecTrans V5.0