File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,6 +127,25 @@ cdef class ElectrodeReactor(ReactionSystem):
127127 initial_surface_coverages[species_dict[label]] = surfaceCoverage
128128 self .initial_surface_coverages = initial_surface_coverages
129129
130+ def generate_reactant_product_indices (self , core_reactions , edge_reactions ):
131+ """
132+ Creates a matrix for the reactants and products.
133+ """
134+
135+ self .reactant_indices = - np.ones((self .num_core_reactions + self .num_edge_reactions, 3 ), np.int)
136+ self .product_indices = - np.ones_like(self .reactant_indices)
137+
138+ for rxn in itertools.chain(core_reactions, edge_reactions):
139+ j = self .reaction_index[rxn]
140+ reacts = [r for r in rxn.reactants if not r.is_electron()]
141+ prods = [p for p in rxn.products if not p.is_electron()]
142+ for l, spec in enumerate (reacts):
143+ i = self .get_species_index(spec)
144+ self .reactant_indices[j, l] = i
145+ for l, spec in enumerate (prods):
146+ i = self .get_species_index(spec)
147+ self .product_indices[j, l] = i
148+
130149 cpdef initialize_model(self ,
131150 list core_species,
132151 list core_reactions,
You can’t perform that action at this time.
0 commit comments