Every time we read a mechanism, we assign (from mechdriver by default, or when sorting for e.g., generating prompt reactions) a pes.subpes.chnl sorting. if the comments are written in the form "# pes.subpes.channel", then no resorting is made.
In any case,
the pes are ordered by formula
|
def count_atoms(fml_list): |
while the reactions within a pes and a subpes (i.e., the ubpes and channels) are only reordered by "reaction name"
|
peslist = peslist.sort_values(by=['rxn_names']) |
this means that the value of the subpes and channels will depend on how the reaction is written (A+B=C, B+A=C will be ordered differently).
So what I would like to do is to try and make the subpes/channel sorting independent on how the reaction is written in the mechanism and order reactants and products according to this function, already used in the sorter for other purposes:
|
rct_names_lst_ordered = order_rct_bystoich( |
|
def order_rct_bystoich(rct_names_lst, spc_dct=None): |
where names of bimol reactions are arranged according to the formulas, and only then according to e.g., alphabetical order. so I would rewrite reaction strings and keys according to this classification. And I should also edit the criterion used within this function to make it consistent with the count_atoms used for the pes instead of the total atom counting that is currently done (
|
atoms_rct = list(map(atom_count, fml_rct)) |
)
Hopefully this would reduce the number of entries in the dataframe of the sorter, make it a bit simpler, and increase consistency/robustness. However, this would imply that the reaction lines might be re-written differently from what the user has in the input of mechanism.dat, which is instead debatable. One could probably use the "# pes.subpes.channel" also to avoid the resorting of reaction names. Or alternatively, I could implement consistent re-ordering for subpes/channel assignment but without changes to the reaction names so that they are consistent with the input by the user.
what do you think about this?
Every time we read a mechanism, we assign (from mechdriver by default, or when sorting for e.g., generating prompt reactions) a pes.subpes.chnl sorting. if the comments are written in the form "# pes.subpes.channel", then no resorting is made.
In any case,
the pes are ordered by formula
mechanalyzer/mechanalyzer/parser/_util.py
Line 140 in 777991b
while the reactions within a pes and a subpes (i.e., the ubpes and channels) are only reordered by "reaction name"
mechanalyzer/mechanalyzer/builder/sort_fct.py
Line 198 in 777991b
this means that the value of the subpes and channels will depend on how the reaction is written (A+B=C, B+A=C will be ordered differently).
So what I would like to do is to try and make the subpes/channel sorting independent on how the reaction is written in the mechanism and order reactants and products according to this function, already used in the sorter for other purposes:
mechanalyzer/mechanalyzer/builder/sort_fct.py
Line 258 in 777991b
mechanalyzer/mechanalyzer/parser/_util.py
Line 16 in 777991b
where names of bimol reactions are arranged according to the formulas, and only then according to e.g., alphabetical order. so I would rewrite reaction strings and keys according to this classification. And I should also edit the criterion used within this function to make it consistent with the count_atoms used for the pes instead of the total atom counting that is currently done (
mechanalyzer/mechanalyzer/parser/_util.py
Line 34 in 777991b
Hopefully this would reduce the number of entries in the dataframe of the sorter, make it a bit simpler, and increase consistency/robustness. However, this would imply that the reaction lines might be re-written differently from what the user has in the input of mechanism.dat, which is instead debatable. One could probably use the "# pes.subpes.channel" also to avoid the resorting of reaction names. Or alternatively, I could implement consistent re-ordering for subpes/channel assignment but without changes to the reaction names so that they are consistent with the input by the user.
what do you think about this?