@@ -67,6 +67,7 @@ cdef class SurfaceReactor(ReactionSystem):
6767 cdef public ScalarQuantity surface_site_density
6868 cdef public np.ndarray reactions_on_surface # (catalyst surface, not core/edge surface)
6969 cdef public np.ndarray species_on_surface # (catalyst surface, not core/edge surface)
70+ cdef public np.ndarray thermo_coeff_matrix
7071
7172 cdef public bint coverage_dependence
7273 cdef public dict coverage_dependencies
@@ -173,6 +174,8 @@ cdef class SurfaceReactor(ReactionSystem):
173174 )
174175 cdef np.ndarray[np.int_t, ndim= 1 ] species_on_surface, reactions_on_surface
175176 cdef Py_ssize_t index
177+ cdef np.ndarray thermo_coeff_matrix = np.zeros((len (self .species_index)* len (self .species_index), 4 ), dtype = np.float64)
178+ self .thermo_coeff_matrix = thermo_coeff_matrix
176179 # : 1 if it's on a surface, 0 if it's in the gas phase
177180 reactions_on_surface = np.zeros((self .num_core_reactions + self .num_edge_reactions), int )
178181 species_on_surface = np.zeros((self .num_core_species), int )
@@ -206,7 +209,10 @@ cdef class SurfaceReactor(ReactionSystem):
206209 if sp.contains_surface_site():
207210 if self .thermo_coverage_dependence and sp.thermo.thermo_coverage_dependence:
208211 for spec, parameters in sp.thermo.thermo_coverage_dependence.items():
209- species_index = self .species_index[spec]
212+ try :
213+ species_index = self .species_index[spec]
214+ except KeyError :
215+ logging.warning(" Species {} is not in the species list yet, skip the thermodynamic coverage effect estimation!" .format(spec))
210216 try :
211217 list_of_thermo_coverage_deps = self .thermo_coverage_dependencies[species_index]
212218 except KeyError : # doesn't exist yet
@@ -413,8 +419,6 @@ cdef class SurfaceReactor(ReactionSystem):
413419 cdef list list_of_coverage_deps
414420 cdef double surface_site_fraction, total_sites, a, m, E
415421
416-
417-
418422 ir = self .reactant_indices
419423 ip = self .product_indices
420424 equilibrium_constants = self .Keq
@@ -500,12 +504,12 @@ cdef class SurfaceReactor(ReactionSystem):
500504 corrected_K_eq[j] *= np.exp((free_energy_coverage_corrections[ir[j, 0 ]] + free_energy_coverage_corrections[ir[j, 1 ]] + free_energy_coverage_corrections[ir[j, 2 ]]) / (constants.R * self .T.value_si))
501505 if ip[j, 0 ] >= num_core_species or ip[j, 1 ] >= num_core_species or ip[j, 2 ] >= num_core_species:
502506 pass
503- elif ip[j, 1 ] == - 1 : # only one reactant
504- corrected_K_eq[j] /= np.exp(free_energy_coverage_corrections[ir [j, 0 ]] / (constants.R * self .T.value_si))
505- elif ip[j, 2 ] == - 1 : # only two reactants
506- corrected_K_eq[j] /= np.exp((free_energy_coverage_corrections[ir [j, 0 ]] + free_energy_coverage_corrections[ir [j, 1 ]]) / (constants.R * self .T.value_si))
507- else : # three reactants !! (really?)
508- corrected_K_eq[j] /= np.exp((free_energy_coverage_corrections[ir [j, 0 ]] + free_energy_coverage_corrections[ir [j, 1 ]] + free_energy_coverage_corrections[ir [j, 2 ]]) / (constants.R * self .T.value_si))
507+ elif ip[j, 1 ] == - 1 : # only one product
508+ corrected_K_eq[j] /= np.exp(free_energy_coverage_corrections[ip [j, 0 ]] / (constants.R * self .T.value_si))
509+ elif ip[j, 2 ] == - 1 : # only two products
510+ corrected_K_eq[j] /= np.exp((free_energy_coverage_corrections[ip [j, 0 ]] + free_energy_coverage_corrections[ip [j, 1 ]]) / (constants.R * self .T.value_si))
511+ else : # three products !! (really?)
512+ corrected_K_eq[j] /= np.exp((free_energy_coverage_corrections[ip [j, 0 ]] + free_energy_coverage_corrections[ip [j, 1 ]] + free_energy_coverage_corrections[ip [j, 2 ]]) / (constants.R * self .T.value_si))
509513 kr = kf / corrected_K_eq
510514 # Coverage dependence
511515 coverage_corrections = np.ones_like(kf, float )
0 commit comments