Skip to content
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

maximumEdgeSpecies ignored if toleranceThermoKeepSpeciesInEdge is not given #2575

Open
PoojaNem opened this issue Nov 14, 2023 · 9 comments
Open
Labels
bug bug which will never be closed by the actions bot

Comments

@PoojaNem
Copy link
Contributor

I am trying to generate a model for propylcyclohexane and air mixture for the equivalence ratio ranging from 0.5-2 with maximumEdgeSpecies value of 10000. But, when I run rmg job the final model edge has 74443 species and also it takes about 20 hrs to generate this model. Can anyone advice me on why generated model had edge species more than the value fixed in the input file.

The RMG input file is attached below for the reference. If required, I can also provide database files.

input.txt
image

@JacksonBurns
Copy link
Contributor

Hi @PoojaNem thanks for the thorough report!

I think you've actually found a small bug (or maybe just bad documentation) in RMG - even if maximumEdgeSpecies is set, RMG will not actually perform any filtering unless toleranceThermoKeepSpeciesInEdge is also set.
See this section of the documentation for advice on how to set that number.

I'm going to modify the title and mark this as a bug so the developers can try and find an appropriate fix! But setting this parameter should solve your problem.

Note to myself and other developers: this line in the driver script for RMG will not run thermo pruning unless the aforementioned parameter is not infinity, and by default it is set to inf in the CoreEdgeReactioModel.

@JacksonBurns JacksonBurns changed the title Edge species in the model exceeding MaximumEdgeSpecies defined in the input.py file maximumEdgeSpecies ignored if toleranceThermoKeepSpeciesInEdge is not given Nov 16, 2023
@JacksonBurns JacksonBurns added the bug bug which will never be closed by the actions bot label Nov 16, 2023
@JacksonBurns
Copy link
Contributor

@xiaoruiDong it seems like we won't be able to filter edge species without toleranceThermoKeepSpeciesInEdge provided by the user (unless we assume some default value [option 1]) given the current algorithm. We could switch the algorithm to forcibly remove species in order of which have the most difference in G relative to the core until we reach the specified value [option 2], but this seems like we would definitely remove important chemistry.

Should we then just update the docs (and the code as well, to raise an exception) to specify that both parameters are required [option 3]?

@JacksonBurns
Copy link
Contributor

Note to self: chdck git blame for the is inf line in model

@JacksonBurns
Copy link
Contributor

Note to self: chdck git blame for the is inf line in model

This is the commit that is causing this problem: 7ee5bac

Filtering is skipped if not all of the thermo filtering options are provided.

@PoojaNem
Copy link
Contributor Author

@JacksonBurns Thank you very much for looking into the issue. After adding toleranceThermoKeepSpeciesInEdge in the input file I am able to generate chemical model with intended number of edge species.

@JacksonBurns
Copy link
Contributor

@PoojaNem glad to hear it!

@mjohnson541 RE: changed the logic for running the thermo filtering in the commit 7ee5bac; can we still run the thermo filtering if the toleranceThermoKeepSpeciesInEdge parameter is not set? And we would update the if statement changed in the linked commit to see if either that condition is set or maximumEdgeSpecies is set?

@mjohnson541
Copy link
Contributor

So thermo pruning is designed primarily for when we don't want to or can't run the long simulations usually required for flux pruning. Usually this is either because the number of edge species handled is very large or there's some issue with running the model long past the times it is valid at. It's worth noting that even thermo pruning only attempts to achieve the specified maximum edge species, by default edge species are guaranteed 2 iterations in the edge regardless of their flux/thermochemistry. It is intended as a backup approach primarily for when flux pruning is no longer viable. It can significantly reduce the memory footprint which can be vital for long runs on large molecules. However, this approach is generally a less safe way to handle the edge than flux pruning.

I'm not sure I would recommend using thermo pruning in this particular example. I also would be uneasy running with only 10,000 allowed edge species, especially for that size of molecule. I don't think 20 hours is particularly long for an RMG run with a molecule of that size, I wouldn't have been surprised if it took significantly longer than that.

So in general maximumEdgeSpecies is a shared variable between flux and thermodynamic pruning systems, but neither of those systems are on by default. The intention of that design was to prevent thermodynamic pruning from being turned on unless the user explicitly set the thermodynamic filter in the input file.

[option 1/2] I think using the thermodynamic filter by default is more dangerous than we want for defaults.
[option 3] This is probably best, throw an error if maximumEdgeSpecies is specified without any pruning parameters.

@JacksonBurns
Copy link
Contributor

Great, thanks for the thorough explanation! I will work up a quick patch for [option 3].

@PoojaNem you might want to consider some of the comments above for your model. It's possible for large molecules that aggressive pruning might miss some chemistry.

@PoojaNem
Copy link
Contributor Author

@JacksonBurns and @mjohnson541 Thank you very much for the detailed explanation. I will verify the chemistry involved in the model generated with thermodynamic pruning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bug which will never be closed by the actions bot
Projects
None yet
Development

No branches or pull requests

3 participants