reactionmechanismgenerator / t3 Goto Github PK
View Code? Open in Web Editor NEWThe Tandem Tool (T3) for automated chemical kinetic model development
Home Page: https://reactionmechanismgenerator.github.io/T3/
License: MIT License
The Tandem Tool (T3) for automated chemical kinetic model development
Home Page: https://reactionmechanismgenerator.github.io/T3/
License: MIT License
I ran a model generation with T3 with the following RMG termination criteria:
termination_rate_ratio: 0.001
termination_time: [60, 's']
RMG terminated once it reached the termination_rate_ratio:
At time 2.7169e-10 s, reached target termination RateRatio: 0.0009957255199092255
This is obviously not the intended behavior, since RMG terminated after less than a simulated time of a nano second only
We could add a minimal termination time to T3, and if some criterion causes it to terminate prematurely, T3 should modify that criterion and re-run RMG.
A note to ourselves: Once we support rates and add training reactions to RMG, we should add the reverse calculated rate as well as a training reaction to reversible families.
After the 1st iteration, if T3 tries to compute a rate for a new reaction that involves one or more species that were already computed, it spawns all jobs related to that species, which is redundant and might take a lot of time.
Instead, it should always keep Arkane YAML file paths for each species it computed (thermo or one that participates in a reaction), and use these instead of spawning jobs for these species.
RMG reactors accept T / P both as floats and as lists, but the Cantera adapters send these values w/o modification to Cantera as a (T0, P0, X0)
tuple. If T / P are indeed lists, T3/Cantera crash.
Need to fix the adapters to allow T / P in a reactor to be a list.
Would we like to take the average value of the list? Or iterate through it?
To facilitate the equivalent feature of RMG's ranged reactors
RMG reactor termination_time
could default to seconds, but should allow time units (e.g., hr)
T3 should have multiple thermo estimators (ML?), and should quickly estimate thermo for all species in the model, flagging outliers (and recalculating them).
Hi @alongd ,
I cloned the codes, created the environment, set up the environmental variables. Then I try the minimal example, and encounter this:
File "/home/zhuqiren/T3/T3.py", line 45
def main() -> None:
^
SyntaxError: invalid syntax
I guess I need to compile the codes also. But it seems that it tries to update my ARC and RMG also. And it fails to build RMS. The makefile has the name of ARC makefile. And I am running some cases with ARC now. Is it the right way to compile the codes?
Facilitate this feature introduced by ReactionMechanismGenerator/RMG-Py#2001
If a species concentration is specified in the reactor, use it for that reactor in RMG, otherwise use its concentration from the species block. Currently we cannot run multiple reactors each with a different concentration.
In addition to species selection by SA, we should also select by flux. E.g., generate a flux diagram at a requested tolerance and add all the included species to the calc list.
It's super easy to generate (just don't forget to include the respective species and reactions), and useful for users to both see what this iteration does, and to be able to modify the input file and just run ARC if needed.
T3 should report the full SA per iteration, inc. parameters taken from libraries.
This is an intermediate step toward computing some of the parameters taken from libraries, at least the user can know to what the observable(s) are sensitive, and not only the parameters actually sent for computation.
Add the following to determine_reactions_based_on_sa()
in main:
# Get the top X entries from the SA.
for observable_label, sa_list in sa_dict_max.items():
sa_list_sorted = sorted(sa_list, key=lambda item: item['max_sa'], reverse=True)
for i in range(min(self.t3['sensitivity']['top_SA_reactions'], len(sa_list_sorted))):
reaction = get_reaction_by_index(sa_list_sorted[i]['parameter'] - 1, self.rmg_reactions)
if self.reaction_requires_refinement(reaction=reaction):
num = f'{i+1}{get_ordinal_indicator(i+1)} ' if i else ''
reason = f'(i {self.iteration}) the {num}most sensitive reaction for {observable_label}'
key = self.add_reaction(reaction=reaction, reasons=reason)
if key is not None:
reaction_keys.append(key)
if reaction.kinetics.is_pressure_dependent() \
and reaction not in [rxn_tup[0] for rxn_tup in pdep_rxns_to_explore] \
and self.t3['sensitivity']['pdep_SA_threshold'] is not None:
pdep_rxns_to_explore.append((reaction, i, observable_label))
# write determine_reactions_from_pdep_network()
# get all low barrier rxns from a network, compute them if not from library
# Todo: make sure rate coefficients are perturbed in Arkane PDep SA, consider these rxns here
reaction_keys.extend(self.determine_reactions_from_pdep_network(pdep_rxns_to_explore=pdep_rxns_to_explore))
And implement the determine_reactions_from_pdep_network()
function.
While it's legal to define an RMG reactor w/o a termination time, running SA (at least via the CanteraConstantTP adapter) does expect to have a run time that is taken from the reactor's termination time.
Suggestion: After an RMG run, read the chemical run time from RMG and assign it to the termination time if the latter is None
This will assist RMG to consider all pathways leading to them, and not cling to the first one it identifies.
Describe the bug
Clean install with conda / environment.yml from clone of current git repo followed by running make test
produces warning:
tests/test_functional.py::test_no_t3_no_qm
$HOME/Code/RMG-Py/rmgpy/rmg/main.py:822: RuntimeWarning: divide by zero encountered in true_divide
conditions=self.rmg_memories[index].get_cond()
How to reproduce
make test
Expected behavior
No errors or warnings
Additional context
$HOME
substituted into raw output, above, not printed as such in terminal
Miniconda 3 on Fedora Rawhide
Currently we restart T3 considering the existing RMG and ARC runs. But we don't consider already executed SA runs, and we just re-run then. We should.
So that users can go back to the iteration folder and see what happened
When RMG crushes due to a PDep k(E) error, do the following:
Add the reason the species did not converge to the T3 output:
Species for which thermodynamic data did not converge:
Label SMILES Reason for calculating thermo for this species
----- ------ ----------------------------------------------
(FAILED) H2NO3_0 [O-][NH2+]O[O] ['All core species']
(FAILED) C3H6NO3_1 CC(=COO[NH])O ['All core species']
(FAILED) C4H7N2O3_2 [N]=CNOOC=C(O)C ['All core species']
(FAILED) C3H3O3_3 O=[C]CC(=O)O ['All core species']
RMG-Py can be installed as a conda package or as a git repo clone.
We should have two environment files to reflect that, or if possible, automatically determine whether the user needs thermgpy
conda package or not.
A single reaction from RMG may actually occur on two PESs.
E.g., H-abstraction between two radicals may occur on a singlet or a triplet PES:
R1. + R2.H <=> R1H + R2..
RMG won't really know whether R2..
is more stable as a singlet or as a triplet (it'll assume a triplet). Both reactions should be computed. If the radicals of R2..
are adjacent it might be a disprop reaction (and then most likely that only the singlet surface should be explored unless R2.. is O2 or S2), but if they are not adjacent (H abstraction), the both multiplicities are are likely to be important.
A correction factor should be added to the rate (the correction factor isn't trivial, it's not simply 1/2)
Is your feature request related to a problem? Please describe.
In different iterations T3 may send reactions to be computed that involve species which participated in previously computed reactions. This will cause ARC to compute the species twice, which is inefficient.
Describe the solution you'd like
T3 should check if a species was already computed, and if so use the respective Arkane YAML file when passing the info to ARC.
We should allow users to specify the number of CPUs for an RMG run directly from the input file like we do for execution_type and memory
As discussed offline with @kspieks, if a model is sensitive to a parameter that was derived from an RMG library, in SOME cases we would still like to compute it. Since some libraries do contain estimations, and others are precise, the user should have a handle to specify which library sources are trustworthy or non-trustworthy.
Is your feature request related to a problem? Please describe.
Running PDep SA takes a long time
Describe the solution you'd like
I'd like T3 to first monitor how long it takes to run each PES and log it, just for our assessment.
Next, we should perhaps prune PESs before running SA on them
Useful if T3 is run on a server, and the user would like to copy the thermo/kinetics library to their repo w/o digging too much on the server
The current workflow for creating the t3_env
on the abc_sa
branch is to pull RMS from @mjohnson541 conda channel because at the time the original abc_sa
PR was made, v0.3.0 was not merged into RMS master branch. From our discussion yesterday, we think that removing - mjohnson541
from environment.yml
will pull the latest version of RMS, which would also mean we could remove lines 16-21 from devtools/install_pyrms.sh
and also remove devtools/install_RMS_v030.jl
. I'm documenting this here for future reference once we merge in the abc_sa
branch.
After doing the installation when I am trying to run the RMG superminimal example it is showing error like rms not defined.
exerpt of the error is as follows:-
Loading transport library from NIST_Fluorine.py in /home/purbadree/RMG/RMG-database/input/transport/libraries...
Loading transport library from GRI-Mech.py in /home/purbadree/RMG/RMG-database/input/transport/libraries...
Loading transport library from NOx2018.py in /home/purbadree/RMG/RMG-database/input/transport/libraries...
Loading transport library from PrimaryTransportLibrary.py in /home/purbadree/RMG/RMG-database/input/transport/libraries...
Loading transport library from OneDMinN2.py in /home/purbadree/RMG/RMG-database/input/transport/libraries...
Loading transport group database from /home/purbadree/RMG/RMG-database/input/transport/groups...
Loading frequencies group database from /home/purbadree/RMG/RMG-database/input/statmech/groups...
Loading solvation thermodynamics group database from /home/purbadree/RMG/RMG-database/input/solvation/groups...
Loading thermodynamics library from primaryThermoLibrary.py in /home/purbadree/RMG/RMG-database/input/thermo/libraries...
Loading thermodynamics group database from /home/purbadree/RMG/RMG-database/input/thermo/groups...
Adding rate rules from training set in kinetics families...
Filling in rate rules in kinetics families by averaging...
Traceback (most recent call last):
File "rmg.py", line 118, in
main()
File "rmg.py", line 112, in main
rmg.execute(**kwargs)
File "/home/purbadree/RMG/RMG-Py/rmgpy/rmg/main.py", line 717, in execute
self.initialize(**kwargs)
File "/home/purbadree/RMG/RMG-Py/rmgpy/rmg/main.py", line 522, in initialize
self.reaction_model.add_species_to_edge(spec)
File "/home/purbadree/RMG/RMG-Py/rmgpy/rmg/model.py", line 1184, in add_species_to_edge
self.edge.phase_system.phases["Default"].add_species(spec)
File "/home/purbadree/RMG/RMG-Py/rmgpy/rmg/reactors.py", line 288, in add_species
spec = to_rms(spc)
File "/home/purbadree/RMG/RMG-Py/rmgpy/rmg/reactors.py", line 587, in to_rms
rad = rms.getspeciesradius(atomnums, bondnum)
NameError: name 'rms' is not defined
Currently users specify a tol list
It would be great if we also allow some schemes where like an adaptive grid, T3 tries some high tolerances, and gradually lowers them on its own until the observable predictions converge. We could maybe allow "fast", "slow" and "adaptive" schemes to determine the next tol value.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.