ESP

Electrochemical
Simulations
Package

(ESP v. 2.4)

(C) June 1994 - February 1998, Carlo Nervi
(для Марий)

Note:

Key Resource
Links2Go
Electrochemistry
Locations of visitors to this page

Summary:


INTRODUCTION

ESP [1] is a program to perform general electrochemical simulations and Best Fitting of experimental data. Some ideas (i.e. expanding space grid and Runge-Kutta integration) are inspired by Gosser's simulator CVSIM [2], who applied them into his simulator. Usually electrochemical simulators, i.e. like CVSIM [2], implement an "analog" waveform; ESP implement a "digital" one. It means that CV is performed by ESP as Staircase Voltammetry (SCV) rather than Cyclic Voltammetry (CV). Many electrochemists mistake analog for staircase CV. It is important to recognize that SCV and analog response are different. To my knowledge this is the first implementation of a digital-ramp simulator. With the large diffusion of digital potentiostat, like EG&G 273, SCV plays an important role with respect to analog potentiostat. Digital potential waveform allow the easy design of new techniques, as well as a less dependence of the shape of E/i plots from double layer capacitance, due to the exponential decay of the charging current. In the remaining part of this manual, CV term is used instead of the proper SCV. Available techniques in ESP are Cyclic Voltammetry (CV), Square Wave Voltammetry (SWV), Cronoamperometry (CA) and Sampled DC Polarography (SDC). This latter technique can be simulated either by solid electrode (constant area) or by dropping mercury electrode. The former can be supposed to be the simulation of a vibrating solid electrode, whereas the latter is simulated adopting the concept of a flat electrode moving towards the bulk of the solution which surface area (a sphere) increase by time [3].

ESP can simulate virtually any electrochemical mechanism, build as a combination of:

ESP perform diffusion by fast implementation (in C) of expanding space grid algorithm, to minimize computational time. Spatial grid double in size every fourth grid-increment [4]. Homogeneous chemical complications are solved by means of the Runge-Kutta integration of the fourth-order [5]. Best-Fitting routines for non-linear optimization are based on the Simplex technique [6]. COOL algorithm [7] is used; the experimental current i(exp) is expressed as a linear function of the dimensionless current function, i(sim):

i(exp) = slope * i(sim) + intcp

Here "slope" and "intcp" are constants that come from the linear regression between experimental and simulated current. Neither slope nor intcp depend by simulation parameters. If the ScaleFlag (SF) parameter is set to 0 then the output is that one of a pure simulation, e.g. slope=1 and intcp=0.

Simulation input can be done by keyboard or by file. There are two kind of informations that ESP need to perform simulation: 1) a collection of experimental parameters (like scan rate, initial and final potentials, etc.), and 2) the mechanism you want to simulate. Both this informations are stored in the mechanism file, so that there is no necessity to re-type by keyboard every things. There are different files used by ESP, and every extension identify the kind of file. File organization follows:

*.mec
is an ASCII Mechanism file, where the mechanism is stored. This file is used for both direct simulation and Best Fitting. It can be written by any text editor or by the build-in mechanism editor. Its structure is self-explaining; see supplied examples.
*.prn
is an ASCII file. The first line must be:
/* ASCII E i t */
or any permutation of {E, i, t}, i.e.:
/* ASCII i E t */
(Capsare significative!). You can omit t (and type '-' instead of't'), but never omit E or i. Moreover, if t is omitted, the '-'must be the last, i.e.:
/* ASCII  E i - */
Each subsequent lineis a curve point; each point is made by two (t omitted) or three(t not omitted) values, and the order of the values must be inagreement with the order choosen in the first line. i.e.:
/* ASCII E i - */
0.010 1.234E-7
0.020 1.567E-7
    ...
END
The last line of *.prn must be "END". The same file format is used by the output simulation file (P option). The main aim of *.prn file is to provide an alternative input/output file format which can be used by non-EG&G users.
*.sim
is the simulation output file. It has approximately the same structure of M270 binary file, so who use the EG&G software can read it as a normal experimental file. Reading *.sim by EG&G software a warning could appear: don't worry, you can continue. The best way to avoid trouble with *.sim files is to load them, skip the edventually warning message and immediately overwrite files without any further manipulations. This because I have no official information about the structure of M270 files: I just approximately analysed those files and tryed to reproduce them. *.sim can also be optimized like M270 file.
*.fit
is the Best Fit settings file (in binary). Store the whole VAR_OPT struct, wich include the experimental current as well as the value of parameters to be Fitted. It is possible to save *.fit an re-start the Best Fitting where you stopped it.
*.???
is a M270 experimental file and can be Best Fitted. Each file which doesn't fit in above seen extensions, is supposed to be an M270 experimental file.
You can run ESP as "ESP" alone (and you will be prompted to choose various possibilities) or you can type "ESP namefile" where the namefile extension reflect the kind of calculation you want. (i.e. ESP *.mec means simulation of the selected mechanism, ESP m270_file, ESP *.sim, ESP *.prn, ESP *.fit means Best Fitting).

GENERAL CONSIDERATIONS

SymbolsMeaningUnits



CConcentrationmM (millimolar, 10-3 M)
DDiffusion coefficientcm2/s (cm * cm / s)
EPotentialV
KeHeterogeneous rate constantcm/s
Kf, KbHomogeneous rate constant
(forward and backward)
1/s for first-order rate constants,
1/(mM*s) for second-order rate consants
ARElectrode areacm2
iCurrent outputAmpere
tTimes (seconds)

INPUT MECHANISM FROM KEYBOARD

The prompt "How many species ->" request the total number of species that are electrochemically active or are involved in the mechanism (i.e. a non-electro active fragments produced by an homogeneous irreversible reaction should not be considered if such a fragment doesn't produce any further electro active species). Each species is associated with an integer, in order of entry. Refer to this number identification. For each species you should enter the corresponding initial concentration; the diffusion coefficient is taken 1E-05 cm2/s by default, but you can modify it later. The concentrations are millimolar.

In entering the redox reactions, look at the following example:

Enter 1 redox as:  [i]:  [Ox]  [Red]  [n e-] [E] [Ke] [alpha]
[1]: 1 2 1 -.567 .12 .5
It means that the redox No. 1 ([1]) is entered: the Ox species is 1, the Red one is 2, reduction processes involves 1 electron, at the formal potential of E=-0.567 V, with an heterogeneous rate constant of Ke=0.12 cm/s, and transfer coefficient alpha=0.5 i.e.:

      Ox + 1e <--> Red          is:     1 + 1e <--> 2
Every input must be separated by at least one space. As a guideline, let's say that log(Ke * sqrt(ST/D))>0.2 produce nernstian behavior (D=diffusion coefficient); e.g. for ST=25 ms, a=0.5, and D=1E-5 cm2/s, Ke should be greater than 0.2 cm/s. You cannot specify less than 1 redox processes. If a EE mechanism should be entered, i.e. (0/1-) (1-/2-) processes, it is VERY IMPORTANT to enter the two redox consecutively, for instance:

        1 + 1e <--> 2
        2 + 1e <--> 3                   example:

Enter 2 redox as:  [i]:  [Ox]  [Red]  [n e-] [E] [Ke] [alpha]
[1]: 1 2 1 -.300 .25 .5
[2]: 2 3 1 -.600 .25 .5
This input is an EE mechanism having a separation between the two reduction potentials of 300 mV. If you don't enter consecutively the two redox, the EE mechanism is not recognized and unpredictable result is obtained. Higher number of consecutive electron processes are recognized (and calculated correctly) only if you follow the same approach. It means that:
  1. the [Ox] specie of the first redox (i.e. No 1) can appear only into the first redox. Never in next redox processes.
  2. the [Red] specie of the first redox (i.e. No 2) must appear as [Ox] specie into the second redox.
  3. the [Red] specie of the second redox (i.e. No 3) must appear as [Ox] specie into the third redox.
ecc... ecc...
There are no restrictions in the case of independend redox processes.

You can set the number of homogeneous chemical reactions equal to 0. Each chemical reaction is described as: "a + b <--> c + d". For example:

Enter 1 reactions (a+b <--> c+d) as [i]: [a] [b] [c] [d] [Kf] [Kb]
[1]: 1 2 3 0 10.123 0            is:     1 + 2 ---> 3     (Kf=10.123)
means a=1, b=2, c=3, d=0, Kf=10.123, Kb=0. Species number 0 means no species (i.e. is not an electroactive specie and doesn't participate furthermore to the overall mechanism). If 0 is specified you must put it as last product or reactant. If there is only one reactant b must be 0 (a can't be 0). If there are no products, both c and d must be 0; if there is one product d must be 0 (and not c). The homogeneous rate constant must be positive. They are in unity of 1/s, when first order rate constant is entered, and unity of 1/(mM*s) when second order rate constant is entered.

MEANINGS OF EXPERIMENTAL PARAMETERS

This section is mainly devoted to non EG&G users, to explain various experimental parameters, and their relations. NI, AP, IR (and RU plus DL) are introduced by ESP, and are described here. Both potential and time values can be a number or PASS.

CO:
in this field you can store any comment (67 characters maximum).
CP:
Condition Potential
CT:
Condition Time. The potential CP is applied for the time CT before to start electrochemical experiment.
ET:
Equilibration Time. The potential IP is hold for ET seconds just before to start experiment.
SR:
Scan Rate. SR=SI/ST; by this equation ST is calculated (except SDC).
FR:
Frequency. ST=1/FR
SI:
Scan Increment. The height of the step: absolute value of the potential increment (in mV) between the actual and the next value of applied potential.
ST:
Step Time. The duration of the step (in s). Also drop time.
TP:
Time per Points. Has the same meaning of ST, but in ChronoAmperometry represents the sampling time.
AM:
Acquisition Mode. AM select the point where, on the potential step wide ST s, the current must be sampled. The Step Time ST is formally divided into 4 equal parts. For CV technique AM, can be:
         AM=1        the current is sampled at the first quarter of SI
         AM=2        the current is sampled at the second quarter of SI
         AM=3        the current is sampled at the third quarter of SI
         AM=4        the current is sampled at the fourth quarter of SI
         AM=Ramp     the current is a mean of all four points sampled
         AM=All      the current is sampled at all four quarter
                     (Warning: this quadruple the number of points)
In other techniques AM doesn't have any meaning.
PH:
Pulse Height. Used in SWV: the potential in first half of ST is increased by PH, whereas in the second half is decreased by PH, so that the range of potential within the step is wide 2*PH mV.
NP:
Number of Points. This parameter is automatically calculated by ESP, and can't be modifyed. A maximum of 4000 points are allowed.
NI:
Number of Subdivision. Is the No. of parts in which the step wide ST is divided for computational purposes. Larger values of NI increase the accuracy. ESP suggest (and set) NI at the beginning of mechanism edit and every time you modify another parameter. To select NI you should set NI and immediately run simulation.
AP:
Approximation of chemistry. Can be Fast or Exact. Usually it is near the electrode that the effect of associated chemistry must be evaluated, and as the distance from the electrode increase, effects are less pronounced. ESP evaluate the homogeneous rate in the first box of the grid; Fast method check this value and in the case of a low value, computation inside all other boxes is skipped. This speed up calculations and usually is an acceptable approximation. Exact method simply perform all calculations in every boxes (useful only in particual mechanisms). Normally Fast approximation is enough; Fast may fail when homogeneous chemistry reactions are significative only away from the electrode.
WE:
Working Electrode. Actually three different kind of electrodes are supplied: Solid, HMDE and DME. Solid and HMDE are completely equivalent. DME is implemented as a flat electrode moving towards the bulk of the solution which surface area increase by time. Surface area of DME depends by ST (e.g. drop time) and MF (Mercury Flow).
MF:
Mercury Flow. MF and ST define the area of the spheric DME.
AR:
Electrode Area. The dimensional current is proportional to AR.
IP:
Initial Potential. Applied potential start from IP, goes to V1 (if not equal to PASS), to V2 (if not equal to PASS) and finally to FP.
V1:
Vertex 1. Optional potential at which sweep rate is switched.
V2:
Vertex 2. The second optional switching point.
VD:
Vertex Delay. The holding time at vertex potentials.
E1:
Potential 1. Is the first potential applied to CA experiments.
T1:
Time 1. E1 is applied for T1 seconds (CA).
E2:
Potential 2. Second potential of CA experiments.
T2:
Time 2. E2 is applied for T2 seconds (CA).
FP:
Final Potential.
NC:
Number of Cycles. How many times the IP-V1-V2-FP cycle must be repeated.
SC:
Store Cycles. Last cycle is always stored. SC select the other cycle that can be stored.
IR:
IR method. Can be None, RU (Uncompensated Resistamce), or DL (Double Layer and uncompensated resistance).
RU:
Uncompensated Resistance. Appear only if IR=RU or IR=DL. Must be always greater than 0.
DL:
Double Layer Capacitance. Appear only if IR=DL. Both DL and RU must be always greater than 0.
TE:
Temperature.

EDIT MECHANISM

The first line of the screen, in YELLOW on the right, shows the name of the mechanism file you are editing. The subsequent lines display for each species (in LIGHTRED) by first the concentration and by second the diffusion coefficient. After there are the redox couples. On the right of the redox progressive number (in LIGHTMAGENTA), the redox itself is displayed. Then there are the chemical reactions with their number (in LIGHTBLUE). If the parameter SF is set to 1 then the output of the simulation during best-fit is scaled. If SF=0 the output is not scaled. The green writings "Range to Optimize" show all selected ranges (max 10) of experimental file to be Best-Fitted. The "low" and "high" limit are the starting and ending points of the range. To modify interactively these limits just type "r n", where n is the number of the range you want to modify. Further instructions are given in the subsequent text window.

The parameters that can be optimized are Kf and Kb for homogeneous chemical reactions; E, Ke, a (alpha), and n (No. of electron, althought it is better do not optimize n) for electrochemical reactions; D (diffusion coefficient) and C (concentration) for each species. If one parameter is selected for optimization, his color will be LIGHTGREEN. To modify one parameter (or to deselect the optimization) just type its name (one of the {kf|kb|e|ke|a|n|d|c}), the number of species, redox or chemistry you want to change, and the new value of the parameter. If you want to optimize one parameter, you should type an "o " at the beginning of the line. Examples:

e 2 -.5         Change the E value of the second redox to -0.5 V
kf 1 10.        Change Kf of the first chemical reaction to 10.0
o e 2 -.5       Optimize the E of redox No. 2, and change it to -0.5 V
ex              Exit without save mechanism to disk file.
sa              Save to file *.mec and exit
But the mechanism file include also the experimental electrochemical parameters as SR (Scan Rate), IP (Initial Potential), etc... ESP is written by an electrochemist (me) that use the potentiostat EG&G M273. Although everybody can use ESP, the electrochemical parameters (experimental) are a subset of those of M270 software. The M273 is a digital potentiostat. Each wave form (E vs t) is digital, and the parameter SI (Scan Increment) is the digital step. Each step (wide SI mV) is divided by NI sub-intervals. NI depends from how fast chemical complications are. Higher are the rate constants, higher NI is. NI must be multiple of 4 (condition automatically setted by ESP). This because each step, in M273 potentiostat, is divided into 4 sub-intervals. Higher NI is, higher the accuracy of the calculation is, but higher the computational time is. You can manually set NI to get high accuracy. You can choose the value of NI you want (i.e. you could want to get very accurate simulations by setting NI=512, or, before to do final simulation, you could want to see how it looks, so fast -but inaccurate- simulations are performed by NI=8). However, as ESP starts and whenever a parameter is modifed (or by setting NI to any values lower than 4), ESP suggest an optimum value of NI. The best value of NI (and to get valuable results), is rather a complex function of SI, AM, and kind of technique choosen, I suggest you adopt the ESP suggestion, but try manually by yourself the effect of NI over results. To choose another value of NI you must set NI and immediately run the simulation.

BEWARE: the total Number of Points (NP) CANNOT exceed 4000 (as in M270). If you have more than 4000 points a message appear and ESP refuse to exit from edit mode until you have less than 4000 points (i.e. by changing SI). The NC (Number of Cycles) select how many cycles will be performed. The last cycle is always collected; the SC (Store Cycle) select the other cycle stored. NC=3, SC=1 means 3 cycles; the first and the third cycles are collected. Only two cycles can be stored. If NC>SC, a double number of point is required. BEWARE that increasing NC you greatly increase the total time of the experiment; this require a larger space-grid. Actually there is a limit of 100 space-increments. If this limit is reached the program will ask whether you want to continue or to stop. Also CT, VD and ET (Condition Time and Equilibration Time) could greatly increase both space-increments and computational time.

Another feature introduced starting from ESP 2.1 is the possibility to roughly evaluate the effect of Uncompensated Resistance and Double Layer Capacity. The IR parameter can be None (no uncompensated resistance), RU (only uncompensated resistance) or DL (double layer capacity and uncompensated resistance). If you specify IR=RU, you must supply a positive value for the RU parameter (which appear only if IR is different from None). Having IR=DL a further positive value must be provided to the DL parameter (the double layer capacity).

However care should be taken in using this option: no cycles are performed to reach a self-consistent output current. If you are running Best Fit, RU/DL can be safely used: the potential correction is done by using the experimental current, so no cycles are required and routine works well. Instead, in pure simulations the last computed current at the previous sub-interval is used to calculate the ohmic drop, so the simulated curve is not 100% quantitative; however it is useful to have an idea of the shape of current/potential wave. High values of NI produces best results; again, convergency is achieved by increasing NI.

BEST-FITTING

In Best-Fitting mode experimental curve is green, whereas simulated ones are yellows. It is very important to input parameters not very far from the real value. To choose and have an idea of the parameters (i.e. the homogeneous rate constant and reduction potentials) it is better to do some simulation before to start Best Fit. The best way to pick best initial values is to type "ESP experimental_filename" and begin Best Fitting with no parameters to optimize. Just leave the edit window by typing SA (save *.mec file). This perform a Single Fit and shows the simulated curve (yellow) together the experimental one (green). At the end of each Single Fit you can press the ESC key to exit from ESP, or other keys to re-enter into mechanism edit mode, so you can change parameters manually step by step, to look by your own eyes the difference in the next Single Fit run. If in the edit window you type EX (exit) you'll exit from ESP. When you select a parameter to optimize, the Best Fit over all experimental file begins, according selected ranges too. Ranges are useful when you want to have good agreement only for some parts of the electrochemical shape (i.e. peaks in CV) excluding parts of experimental data affected by large noise (i.e. adsorption, impurities, etc.). If full Best Fit is choosen, Log file optionally will report the Best Fit proceeding. Into Log file are stored every optimized parameters.

ANALYSIS TOOL

This is a special feature of ESP, mainly useful for theoretical study. There are few check of the validity of input, and impredictable results could be obtained when the rules here outlined are not strictly followed.

Many times in electrochemical studies peoples look only potential and current peaks and so on, simply because those points are simplest to locate. And most of times it is interesting to know how those points shift varying some parameters, like SR. Well, analysis tool of ESP allow you to automatically change some parameters and pick up selected points of electrochemical responses. The parameters that can be automagically changed are: SI, NI, PH, SR, FR, ST, TE, E, Ke, a, Kf, Kb, KtE, KlE, KtC, KlC, where last four new parameters have the following meaning:

KtE = log(sqrt(ST) * Ke/(Dox^((1-a)/2) * Dred^(a/2)))
KlE is defined in the same way except that in lieu of ST you should read (ST/(SI*nF/RT)). These parameters redefine Ke (ST is kept to the same value, e.g. SR is unchanged, so that comparison of dimensionless current is possible). The use of KtE resemble the Osteryoung approach, whereas KlE resemble the Matsuda and Ayabe definition of dimensionless parameter Lambda.

KtC = log(ST * (Kf + Kb))
KlC is defined in the same way except that in lieu of ST you should read (ST/(SI*nF/RT)), as in the previous case. These parameters redefine both Kf and Kb, however the equilibrium constant Kf/Kb is unchanged.

Each simulation calculated by Analysis tool is saved with a file name like l0000001.sim. The file number is increased according to the "logout" file. Output is both on screen and into the file "logout" (WARNING: the file is overwritten). Potentials are in mV. The potential scans (see each techniques) are divided into equals nredox intervals (where nredox is the number of redox of the current mechanism). Inside each intervals only one peak is searched, as the largest value of current. To obtain the usual measures of forward (cathodic) peak potential and current, a second-order polynome is fitted to the three largest currents, and the peak potential and current are chosen as the position and amplitude of the maximum of the parabola. The anodic peak is defined in the same way. Depending on the selected techniques, the following applies:

CV:
only a full cycle is considered. IP must be equal to FP and V1 must be different from PASS; V2 must be equal to PASS; V1 should be more negative than IP. Scans should be IP-V1 (forward) and V1-FP (reverse). Output will contain, for each redox processes, Epc (cathodic peak potential), ipc (cathodic peak current), Epa (anodic peak potential), ipa (anodic peak current), E1/2 (mean of Epa and Epc), DEp (Epa-Epc).
SWV:
the only allowed scan is IP-FP, with FP more negative than IP (V1=V2=PASS). Output consists of Esu (summit potential), isu (summit current), W1/2 (wide of the peak at the half of height), St (peak area in microcoulomb).
SDC:
the only allowed scan is IP-FP, as in SWV. Output consists of E1/2 (the half wave potential), il (the current limit), slope (the slope of logarithm analysis used to calculate E1/2). il is taken as the highest current value.
CA:
CA is not supported by the Analysis tool.
To select the analysis tool, instead of normal run, you should manually edit mechanism file by your favorite text editor. The magic keyword "Analysis" should be added at the end of the file. Subsequently the name of the parameter you want to vary, the initial, final and step values should be entered. Examples:

Analysis
NI 4 512 4
SI 1 20 1
Ke 2 0.01 1 0.01
This will vary NI from 4 to 512 by the increment of 4 (the minimum!! please take care of NI values: NI must be a multiple of 4!!!). Then SI start from 1 and will be 20 with step of 1 mV. KE (heterogeneous constant) of redox number 2 start from 0.01 and will be 1 with step of 0.01 cm/s. This means 128x20x100= 256000 simulations! As you can see the number of simulations quickly grow by increasing number of parameters... KtE, KlE, KtC, KlC, E (thermodynamic reduction potential), Ke (heterogeneous rate constants), a (alpha), Kf (homogeneous forward rate rate constant) and Kb (homogeneous backward rate constant) require the number of selected redox or chemistry.

An example that illustrate this feature is furnished by the e_an.mec and ec_an.mec files. By typing "esp e_an.mec" the file "logout" is created, which shows the effect of SR (Scan Rate) onto potential and current peaks for a quasi-reversible mechanism. A more complex example is included in ec_an.mec, where the automatic change of SR shows the effect of SR when the mechanism include an homogeneous coupled chemical reaction.

References:

  1. Source code of ESP is available upon request. It will be delivered by e-mail only. See notes in README.1ST for details and copyright.
  2. D.K.Gosser, F.Zhang, Talanta, 38 (1991) 715.
  3. Z.Galus, Fundamentals of Electrochemical Analysis., Ellis, 1994.
  4. R.Seeber, S.Stefani, Anal.Chem., 53 (1981) 1011.
  5. (a) M.F.Nielsen, K.Almadal, O.Hammerich, V.D.Parker, Acta Chem.Scand., A41 (1987) 423.
    (b) A.C.Norris, Computational Chemistry, Wiley, 1981.
  6. (a) J.A.Nelder, R.Mead, Comput.J., 7 (1965) 308.
    (b) P.B.Ryan, R.L.Barr, H.D.Todd, Anal.Chem., 52 (1980) 1460.
  7. J.O'Dea, J.Osteryoung, T.Lane, J.Phys.Chem., 90 (1986) 2761.

Notes

About Manual:
Since my native language is italian, please don't hate me for many language mistake that belong to this manual; just smile and go on ;-)
For basics about electrochemistry, see for instance:
Author, Bugs and Suggestions:
Any suggestions/bugs reports both about ESP and manual are welcome:
Dr. Carlo Nervi,
Dipartimento di Chimica IFM, via P. Giuria 7, 10125 Torino, ITALY.
Voice: +39 11 6707508
Fax  : +39 11 6707855
e-mail: nervi@ch.unito.it WWW: http://lem.ch.unito.it/
Acknowledgments:
I wish to thank Dr. Serge V. Kukharenko (Moscow) for helpful discussions and Dr. M. Ravera (Torino) for beta-testing.
Hardware requirements:
PC IBM or compatible with 386+387, 486, 586 CPU, color VGA graphics. The Borland Turbo C version of ESP (esp-tc.exe) can be run on 8086 PC without math co-processor; in any cases, math coprocessor is highly recommended.