Skip to content

Commit c01dd20

Browse files
committed
fixup! added SurfaceChargeTransport kinetics model to surface.pyx and surface.pyx
1 parent 4cbd3c4 commit c01dd20

2 files changed

Lines changed: 35 additions & 8 deletions

File tree

rmgpy/kinetics/surface.pxd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,13 @@ cdef class SurfaceChargeTransfer(KineticsModel):
7777
cdef public ScalarQuantity _n
7878
cdef public ScalarQuantity _Ea
7979
cdef public ScalarQuantity _T0
80+
cdef public ScalarQuantity _V0
8081
cdef public ScalarQuantity _a
8182
cdef public ScalarQuantity _ne
8283

83-
cpdef double get_rate_coefficient(self, double T, double P=?, double V=?) except -1
84+
cpdef double get_activation_energy_from_potential(self, double V=?, bint non_negative=?)
85+
86+
cpdef double get_rate_coefficient(self, double T, double V=?) except -1
8487

8588
cpdef change_rate(self, double factor)
8689

rmgpy/kinetics/surface.pyx

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ cdef class SurfaceChargeTransfer(KineticsModel):
527527
`a` The charge transfer coefficient
528528
`A` The preexponential factor
529529
`T0` The reference temperature
530+
`V0` The reference potential
530531
`n` The temperature exponent
531532
`Ea` The activation energy
532533
`ne` The stochiometry coeff for electrons (negative if reactant, positive if product)
@@ -539,7 +540,7 @@ cdef class SurfaceChargeTransfer(KineticsModel):
539540
540541
"""
541542

542-
def __init__(self, a=0.5, A=None, n=0.0, Ea=None, T0=(1.0, "K"), ne=1, Tmin=None, Tmax=None, Pmin=None, Pmax=None,
543+
def __init__(self, a=0.5, A=None, n=0.0, Ea=None, T0=(1.0, "K"), V0=(0.0, "V"), ne=-1, Tmin=None, Tmax=None, Pmin=None, Pmax=None,
543544
uncertainty=None, comment=''):
544545

545546
self.A = A
@@ -548,6 +549,7 @@ cdef class SurfaceChargeTransfer(KineticsModel):
548549
self.T0 = T0
549550
self.a = a
550551
self.ne = ne
552+
self.V0 = V0
551553

552554
property A:
553555
"""The preexponential factor."""
@@ -577,6 +579,13 @@ cdef class SurfaceChargeTransfer(KineticsModel):
577579
def __set__(self, value):
578580
self._T0 = quantity.Temperature(value)
579581

582+
property V0:
583+
"""The reference potential"""
584+
def __get__(self):
585+
return self._V0
586+
def __set__(self, value):
587+
self._V0 = quantity.Potential(value)
588+
580589
property ne:
581590
"""The number of electrons transferred."""
582591
def __get__(self):
@@ -613,20 +622,35 @@ cdef class SurfaceChargeTransfer(KineticsModel):
613622
return (SurfaceChargeTransfer, (self.a, self.A, self.n, self.ne, self.Ea, self.T0, self.Tmin, self.Tmax, self.Pmin, self.Pmax,
614623
self.uncertainty, self.comment))
615624

616-
cpdef double get_rate_coefficient(self, double T, double P=0.0, double V=0.0) except -1:
625+
cpdef double get_activation_energy_from_potential(self, double V=0.0, bint non_negative=True):
626+
"""
627+
Return the effective activation energy (in J/mol) at specificed potential (in Volts).
628+
"""
629+
cdef double ne, Ea, V0
630+
631+
ne = self._ne.value_si
632+
Ea = self._Ea.value_si
633+
V0 = self._V0.value_si
634+
635+
Ea -= ne * constants.F * (V-V0)
636+
637+
if non_negative is True:
638+
return max(0.0,Ea)
639+
else:
640+
return Ea
641+
642+
cpdef double get_rate_coefficient(self, double T, double V=0.0) except -1:
617643
"""
618644
Return the rate coefficient in the appropriate combination of m^2,
619645
mol, and s at temperature `T` in K.
620646
"""
621-
cdef double A, n, Ea, T0, ne, a
647+
cdef double A, n, Ea, T0
622648
A = self._A.value_si
623-
a = self._a.value_si
624649
n = self._n.value_si
625-
ne = self._ne.value_si
626-
Ea = self._Ea.value_si
650+
Ea = self.get_activation_energy_from_potential(V)
627651
T0 = self._T0.value_si
628652

629-
return A * (T / T0) ** n * exp(-Ea / (constants.R * T)) * exp((a * ne * constants.F * V) / (constants.R * T)) # NOT SURE ABOUT SIGN
653+
return A * (T / T0) ** n * exp(-Ea / (constants.R * T))
630654

631655
cpdef change_t0(self, double T0):
632656
"""

0 commit comments

Comments
 (0)