ReactionMechanismGenerator / RMG-Py

Python version of the amazing Reaction Mechanism Generator (RMG).
http://reactionmechanismgenerator.github.io/RMG-Py/
Other
397 stars 228 forks source link

Issue with species_list: NoneType' object is not iterable (while generating collision_rate_violator log) #2604

Closed PoojaNem closed 8 months ago

PoojaNem commented 9 months ago

Hello Everyone,

Problem Description:

I am trying to generate a kinetic model for n-propylcyclohexane oxidation in RMG. However, on running every time RMG throws a type error that says: "'NoneType' object is not iterable."

image

There are a few points to notice here:

  1. Error happens after adding JetSurf2.0 thermo library to the input file (Current simulation utilizes JetSurf2.0_Modified, with thermodynamic data for species C5H5 from AramcoMech2.0).
  2. The issue only pops up at the simulation's end while generating the collision_rate_violators log.
  3. RMG successfully generates Cantera and Chemkin files that can be used for further processing.
  4. Following the error traceback shows that in line 244 of the reaction.py file, the species_list argument (to the function write_kinetic_entry inside function to_chemkin) is an empty list which consequently results in an error while processing line 1890 (for species in species_list:) in chemkin.pyx file.
  5. Based on the definition of the function to_chemkin (provided in the file reaction.py line 234), I also tried setting kinetics to False. But, the error remained the same.
  6. Related to #2096.

The zip folder containing an input file and database for reproducing a model is attached below.

Installation Information:

ZipFolder.zip

PoojaNem commented 9 months ago

Hello Everyone,

I have found the source of this error while debugging. The error occurred due to a missing Troe kinetic in the main.py file of the RMG (image below). The present RMG code checks if violator[0].kinetics is the ThirdBody and, if True, enters into the if condition where self.reaction_model.core.species is supplied as an argument (species_list) to the function to_chemkin. For all the other types of kinetics, the else loop is followed, which does not have any argument. However, Troe kinetics also requires species_list, as an argument to identify collider species, which is considered as None as per the current code.
Therefore, adding Troe to the if statement resolved this concern. The code runs fine after making this change. image

I hope my explanation is clear. It would be helpful if developers could provide their feedback on the same.

JacksonBurns commented 9 months ago

Hi @PoojaNem thank you for opening this issue and doing this investigation as well! This seems reasonable to me, though we should subject the change to our continuous integration just to make sure there aren't any unintended side effects.

Could you please follow this official GitHub tutorial for proposing changes to the codebase: https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project

I am happy to get these merged into RMG and have you listed as an official contributor after that!

PoojaNem commented 8 months ago

@JacksonBurns, Thanks for the prompt reply. I have submitted pull request #2614 to incorporate the changes to RMG. Let me know if further details are required from my end.