diff --git a/rmgpy/rmg/main.py b/rmgpy/rmg/main.py index 494bd6acf4..75f47065ef 100644 --- a/rmgpy/rmg/main.py +++ b/rmgpy/rmg/main.py @@ -708,6 +708,16 @@ def execute(self, initialize=True, **kwargs): self.rmg_memories.append(RMG_Memory(reaction_system, self.balance_species)) self.rmg_memories[index].generate_cond() log_conditions(self.rmg_memories, index) + conditions = self.rmg_memories[index].get_cond() + temperature = potential = None + if isinstance(reaction_system, ElectrodeReactor): + if conditions: + potential = conditions.get('potential') + temperature = conditions.get('T') + if not potential: + potential = reaction_system.potential.value_si + if not temperature: + temperature = reaction_system.T.value_si # Update react flags if self.filter_reactions: @@ -721,7 +731,7 @@ def execute(self, initialize=True, **kwargs): atol=self.simulator_settings_list[0].atol, rtol=self.simulator_settings_list[0].rtol, filter_reactions=True, - conditions=self.rmg_memories[index].get_cond(), + conditions=conditions, ) self.update_reaction_threshold_and_react_flags( @@ -742,7 +752,9 @@ def execute(self, initialize=True, **kwargs): self.reaction_model.enlarge(react_edge=True, unimolecular_react=self.unimolecular_react, bimolecular_react=self.bimolecular_react, - trimolecular_react=self.trimolecular_react) + trimolecular_react=self.trimolecular_react, + temperature=temperature, + potential=potential) if not np.isinf(self.model_settings_list[0].thermo_tol_keep_spc_in_edge): self.reaction_model.set_thermodynamic_filtering_parameters( @@ -802,7 +814,16 @@ def execute(self, initialize=True, **kwargs): reactor_done = True objects_to_enlarge = [] - conditions = self.rmg_memories[index].get_cond() + + if isinstance(reaction_system, ElectrodeReactor): + if conditions: + potential = conditions.get('potential') + temperature = conditions.get('T') + if not potential: + potential = reaction_system.potential.value_si + if not temperature: + temperature = reaction_system.T.value_si + if conditions and self.solvent: T = conditions['T'] # Set solvent viscosity @@ -832,7 +853,7 @@ def execute(self, initialize=True, **kwargs): prune=prune, model_settings=model_settings, simulator_settings=simulator_settings, - conditions=self.rmg_memories[index].get_cond() + conditions=conditions ) except: logging.error("Model core reactions:") @@ -932,7 +953,9 @@ def execute(self, initialize=True, **kwargs): self.reaction_model.enlarge(react_edge=True, unimolecular_react=self.unimolecular_react, bimolecular_react=self.bimolecular_react, - trimolecular_react=self.trimolecular_react) + trimolecular_react=self.trimolecular_react, + potential=potential, + temperature=temperature) if old_edge_size != len(self.reaction_model.edge.reactions) or old_core_size != len( self.reaction_model.core.reactions): @@ -2340,7 +2363,7 @@ def obj(y): if 'P' in list(new_cond.keys()): new_cond['P'] = np.exp(new_cond['P']) if 'potential' in list(new_cond.keys()): - new_cond['potential'] = np.exp(new_cond['potential']) + new_cond['potential'] = new_cond['potential'] if hasattr(self, 'initial_mole_fractions'): for key in self.initial_mole_fractions.keys(): diff --git a/rmgpy/rmg/model.py b/rmgpy/rmg/model.py index fae2222d8a..a3bcde5fe5 100644 --- a/rmgpy/rmg/model.py +++ b/rmgpy/rmg/model.py @@ -503,7 +503,8 @@ def make_new_pdep_reaction(self, forward): return forward def enlarge(self, new_object=None, react_edge=False, - unimolecular_react=None, bimolecular_react=None, trimolecular_react=None): + unimolecular_react=None, bimolecular_react=None, trimolecular_react=None, + temperature=None, potential=None): """ Enlarge a reaction model by processing the objects in the list `new_object`. If `new_object` is a @@ -636,7 +637,9 @@ def enlarge(self, new_object=None, react_edge=False, reaction.kinetics = reaction.kinetics.to_arrhenius() if isinstance(reaction.kinetics, SurfaceChargeTransfer): - reaction.set_reference_potential(298) + reaction.set_reference_potential(temperature) + # reaction.kinetics.change_v0(0.0) + else: # correct barrier heights of estimated kinetics if isinstance(reaction, TemplateReaction) or isinstance(reaction,