Skip to content

Commit 54c6495

Browse files
committed
Fix name shadowing in simple reactor's get_const_spc_indices()
1 parent d1379a7 commit 54c6495

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

rmgpy/solver/simple.pyx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,19 @@ cdef class SimpleReactor(ReactionSystem):
169169
conditions[species_dict[label]] = value
170170
self.sens_conditions = conditions
171171

172-
def get_const_spc_indices (self, core_species):
172+
def get_const_spc_indices(self, core_species):
173173
"""
174174
Allow to identify constant Species position in solver
175175
"""
176-
for spc in self.const_spc_names:
177-
if self.const_spc_indices is None: # initialize once the list if constant SPC declared
178-
self.const_spc_indices = []
179-
for spc in core_species: #Need to identify the species object corresponding to the the string written in the input file
180-
if spc.label == spc:
181-
self.const_spc_indices.append(core_species.index(spc))
176+
if self.const_spc_names is None:
177+
return
178+
if self.const_spc_indices is None:
179+
self.const_spc_indices = []
180+
for name in self.const_spc_names:
181+
for spc in core_species:
182+
if spc.label == name:
183+
self.const_spc_indices.append(core_species.index(spc))
184+
break
182185

183186
cpdef initialize_model(self, list core_species, list core_reactions, list edge_species, list edge_reactions,
184187
list surface_species=None, list surface_reactions=None, list pdep_networks=None,

0 commit comments

Comments
 (0)