ReactionMechanismGenerator / RMG-website

A Django-powered website for Reaction Mechanism Generator (RMG)
Other
20 stars 29 forks source link

"ValueError: No valid NASA polynomial at temperature..." when loading certain kinetic families #240

Closed jonwzheng closed 7 months ago

jonwzheng commented 2 years ago

Issue

We noticed in the log files that there was a persistent error: "ValueError: No valid NASA polynomial at temperature (x) K." upon loading kinetics families in the database. I recreated this on my local machine. It seems that often the failure is due to NASA polynomial generation at a temperature outside the "Tmin", "Tmax" bounds for the entry.

Specific examples

Loading the "XY_Addition_MultipleBond" family causes this issue when loading the entry with index=15 (C2H4Cl2 <=> C2H3Cl + ClH). Specifically, the code throws an error when data = item.generate_reverse_rate_coefficient() is called in family.py within RMG-Py. Thus, this may be an RMG-Py error.

Early investigation

I believe the issue is in line 822-825 of reaction.py. It seems like there is a "backup" Tlist that's generated, spanning 303.03 to 2000 K, if Tmin and Tmax are not defined. But Tmin and Tmax are both defined for the entries, causing this error to be thrown. I will investigate further and document more below or in a future PR.

Edit 1: It seems actually that Tmin and Tmax are not defined in the failure cases' kinetic data. But they are defined in the thermo data. So reaction.py does not find any T limits in the kinetics, resorting to a large temperature range as the Tlist to get energies over, but this range is outside the thermo Tmin and Tmax in their NASAPolynomials. So, there is essentially a mismatch in the data. The kinetic data should include the Tmin and Tmax for the NASAPolynomial.

The error is explicitly encountered in line 829 of reaction.py, when kf.get_rate_coefficient is run, specifically get_equilibrium_constant(Tlist[i]) in the function call of get_free_energy_of_reaction.

Recommendations

It is unclear to me why the Kinetics data could include a Tmin, Tmax range that might be different from the Tmin, Tmax range permissible by the thermo. Either way, other libraries have the same missing kinetics Tmin/Tmax but don't run into the same errors; it's just that their thermo Tmax tends to exceed 2000 K. It seems like this is actually an oversight present in all thermo but, again, is not usually an issue because the default thermo Tmax exceeds 2000 K.

Possibly related is also RMG-Py commit 734e2539ee764e5b873c7090d207077660e1afae when 2000K is added to the default list of fitting T's. However, many old thermo do not go up to 2000 T so they run into this error.