Closed calvinp0 closed 1 year ago
zmats = list()
for d2, d3 in d2_d3_product:
xyz_guess = None
try:
xyz_guess = combine_coordinates_with_redundant_atoms(
xyz_1=arc_reactant.get_xyz(),
xyz_2=arc_product.get_xyz(),
mol_1=rmg_reactant_mol,
mol_2=rmg_product_mol,
reactant_2=arc_reaction.r_species[int(not reactants_reversed)],
h1=h1,
h2=h2,
c=c,
d=d,
r1_stretch=r1_stretch,
r2_stretch=r2_stretch,
a2=a2,
d2=d2,
d3=d3,
reactants_reversed=reactants_reversed,
)
except ValueError as e:
logger.error(f'Could not generate a guess using Heuristics for H abstraction reaction, got:\n{e}')
In this code here, the list index out of range occurs. More specifically:
arc_reaction.r_species[int(not reactants_reversed)]
The int(not reactans_reversed)
is evaluating to 1 (as it is False). However, the list in this instance has a len of 1, therefore, there is not [1]
.
Should we be then also adding to the except IndexError
? @alongd @kfir4444
@Laxzal Thanks! that is an impressive debugging!
I think, however, that the arc_reaction.r_species
should be a list of length 2, since it is an H_Abstraction reaction, so something else must be in play.
@kfir4444 Great point!
So, looking at r_76_[S]S + r_76_[S]S <=> r_76_SS + r_76_[S][S]
, we have arc_reaction.r_species
. And in this variable it only has one r species - 'r_76_[S]S'
If we have an H Abstraction reaction, but ARC only has 1 reactant or 1 product, we should't run heuristics TS search (or any other search)
Some thoughts: A. Why do we only have 1 reactant? Can you try to create an ARCReraction object for this reaction in a separate script and try to see what's going on? Then let's fix it and add a terst
B. We should check at the outset of the Heuristics method that we have 2 reactants and 2 products before calling the H Abstraction method
C. We could check that ANY reaction identified as having an RMG template actually has the number of reactants and products as the template demands. If it doesn't then output an error message, and perhaps don't process it?
I see now what @Laxzal wrote me offline: it's probably since the reactants are identical.
In this case, we should change the code to refrain from calling the .r_species
or .p_species
attributes, and instead use the ARCReaction.get_reactants_and_products()
method which returns the correct number of reactants and products
A similar fix was applied here: https://github.com/ReactionMechanismGenerator/ARC/pull/609
Describe the bug An arc reaction run returned the following error:
Uncertain which reaction it was as the error does not provide enough information. However, I believe it was one of these reactions:
The last information in the
arc.log
was regardingTS5
which I believe is this:input.zip