Skip to content

Commit 3d0b9b1

Browse files
Nora-Khalilrwest
authored andcommitted
Refactoring to avoid AttributeError in _make_rule
1 parent 1590699 commit 3d0b9b1

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

rmgpy/data/kinetics/family.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4613,18 +4613,23 @@ def _make_rule(rr):
46134613
if n > 1:
46144614
kin = arr().fit_to_reactions(rs, recipe=recipe)
46154615
if n == 1 or kin.E0.value_si < 0.0 or abs(kin.n.value_si) > 5.0:
4616-
# still run it through the averaging function when n=1 to standardize the units and run checks
4617-
kin = average_kinetics([r.kinetics for r in rs])
4618-
#kin.comment = "Only one reaction or Arrhenius BM fit bad. Instead averaged from {} reactions.".format(n)
4619-
if n == 1:
4620-
kin.uncertainty = RateUncertainty(mu=0.0, var=(np.log(fmax) / 2.0) ** 2, N=1, Tref=Tref, data_mean=data_mean, correlation=label)
4621-
else:
4616+
4617+
if n > 1: #we have an ArrheniusBM
46224618
if kin.E0.value_si < 0.0:
46234619
reason = "E0<0"
46244620
elif abs(kin.n.value_si) > 5.0:
46254621
reason = "abs(n)>5"
46264622
else:
46274623
reason = "?"
4624+
4625+
# still run it through the averaging function when n=1 to standardize the units and run checks
4626+
kin = average_kinetics([r.kinetics for r in rs])
4627+
4628+
if n == 1:
4629+
4630+
kin.uncertainty = RateUncertainty(mu=0.0, var=(np.log(fmax) / 2.0) ** 2, N=1, Tref=Tref, data_mean=data_mean, correlation=label)
4631+
else:
4632+
46284633
kin.comment = f"Blowers-Masel fit was bad ({reason}) so instead averaged from {n} reactions."
46294634
dlnks = np.array([
46304635
np.log(

0 commit comments

Comments
 (0)