-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generating reactions for nitrobenzenes is very slow #2630
Comments
If you add the limit for |
Hi Hao-Wei, do you mean the |
Hi Jonathan, I meant something like this below. I haven't tested this code yet but this constraint is used in
|
Hi Hao-Wei, thank you for the suggestion. This was helpful to learn about the species constraints. |
This sort of hanging is known for long time for molecules with many resonance structures (even most of them are unrepresentative). But, I don't have an immediate thought about why it hangs at Do you know which exactly families or products causing it? I would suggest identifying it first (e.g., by iterating families and assign it to |
Thank you, Xiaorui, these are excellent ideas. I'll profile to figure out where, exactly, it is getting stuck, and for which families. I have a follow-up concern. Even if you set
(btw, maybe we should open another PR that cleans up these two functions. There is a lot of overlapping code in both of these two functions, that can be rewritten to several smaller functions. Also the docstring for |
I too have been struggling in this area. I have been trying liquid reactors to look at amination of a nitrated benzene compounds as well as looking at aspects of the Baeyer-Mills reaction (nitrosobenzene + analine -> azobenzene). Although I am new to RMG, I understand that both efforts may not work well or at all with RMG currently. But I do want to get a sense of if/how RMG can handle liquid reactions like these. Anyway, when trying to run the default kinetics families, it gets really slow or possibly even stops. Even if it has just 200-300 species or reactions, it will make no apparent progress over night. By significantly restricting the kineticsFamilies option, it is possible to run normally, but obviously paring reaction families is a job better left to a computer. Plus, just looking at say H_abstraction does not provide much useful info. Also, it may not just be nitro-substituted benzene, because nitroso-substituted in this case seems to cause some trouble. Some qualitative things that I notice:
Finally, I will add that I used RMG binary to make an oxidation mechanism for RDX. I've since upgraded to the source install. Im trying to rerun that input file to see if it can run with the source installed version. I'm new to RMG, so I don't really know where/what to look for. If anything looks promising, I can try to better document it going forward. |
I don't think it will "break" anything, but it will potentially make the degeneracy result less accurate, particularly for molecules with resonance structures and high symmetry. Also, if there is a unit test for such a case, it may fail if turning
Refactoring and making RMG more modularized is a good idea and is always welcomed if you have some spare time. |
After fixing and allowing Still checking out all the families that it gets stuck on (it's a slow process as the kernel needs to be restarted every time it crashes), but the following families encounter the problem:
(possibly/probably more) |
It is getting stuck due to the reverse reaction of This time-out issue occurs even with much simpler nitro-containing species. The simplest I've found that runs into this is However, the simpler compound With nitroso-containing compounds it is faster, but still kind of slow, i.e. |
Some more benchmarking:
Just including the nitro group to benzene increases the generation time by a factor of 2000x. RMG says nitrobenzene has 6 resonance structures, but 6 choose 2 is only 15... |
Could you please explain how to turn resonance=False? Thank you. |
Right now the If time-sensitive, you could checkout the We may want to implement a check to see if the # of resonance forms is very large, and if so, bypass/skip the resonance calcs (maybe set as a user flag to enable this feature if desired). |
This issue is being automatically marked as stale because it has not received any interaction in the last 90 days. Please leave a comment if this is still a relevant issue, otherwise it will automatically be closed in 30 days. |
Just popping in to say I am still interested in this. |
Unfortunately we haven't yet exposed a way for users to change this setting without modifying the codebase. As a quick check could you see if setting |
Thank you, Jonathan. I will give that a try.
I am not used to github and the term "stale" prompted me to want to say that someone out there cares about this.
…________________________________
From: Jonathan Zheng ***@***.***>
Sent: Wednesday, July 10, 2024 6:00 AM
To: ReactionMechanismGenerator/RMG-Py ***@***.***>
Cc: Erik Tolmachoff ***@***.***>; Comment ***@***.***>
Subject: Re: [ReactionMechanismGenerator/RMG-Py] Generating reactions for nitrobenzenes is very slow (Issue #2630)
Unfortunately we haven't yet exposed a way for users to change this setting without modifying the codebase. As a quick check could you see if setting resonance=True to resonance=False in rmgpy/data/kinetics/common.py
https://github.com/ReactionMechanismGenerator/RMG-Py/blob/main/rmgpy/data/kinetics/common.py#L272 will fix this for you?
This will disable the resonance checking for calculating degeneracy which may affect the accuracy of your other calculations.
—
Reply to this email directly, view it on GitHub<#2630 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AWOUV4GJFEMPP3LXUSXRAPDZLUV7NAVCNFSM6AAAAABEMAWW5CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRQGQ2TCNRVGM>.
You are receiving this because you commented.Message ID: ***@***.***>
|
This issue is being automatically marked as stale because it has not received any interaction in the last 90 days. Please leave a comment if this is still a relevant issue, otherwise it will automatically be closed in 30 days. |
Bug Description
There are two separate but related issues that I observed. First, an RMG website user mentioned that using RMG kinetics search for nitro-substituted benzenes causes the kinetics search to timeout when calling
KineticsDatabase.generate_reactions
. Here are two examples:1. Bimolecular reaction
Finding the bimolecular reactions of a nitrobenzene with itself, including just monosubstituted nitrobenzene (
[O-][N+](=O)c1ccccc1
), will hang on execution.Minimal example:
Following the traceback it looks like it gets stuck on
Species.generate_resonance_structures()
-->Molecule.is_identical()
.Even if you set
resonance=False
, this still occurs because the traceback leads tofamily.calculate_degeneracy(rxn)
-->ensure_independent_atom_ids(reactants, resonance=True)
in which resonance is hardcoded to True.Nitrobenzenes have several resonance structures, but is that enough to cause this issue?
2. Unimolecular reaction for trinitrobenzene
Minimal example:
Searching the unimolecular reactions of trinitrobenzene will hang:
hanging on the same step as above.
Other thoughts
I am still investigating this, and would appreciate any input if anyone has run into a similar issue working with the resonance code, or thoughts on where to troubleshoot next.
The text was updated successfully, but these errors were encountered: