Giter VIP home page Giter VIP logo

reactionmechanismgenerator / t3 Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 4.0 15.45 MB

The Tandem Tool (T3) for automated chemical kinetic model development

Home Page: https://reactionmechanismgenerator.github.io/T3/

License: MIT License

Makefile 0.03% Python 57.54% Shell 0.86% Julia 0.02% Jupyter Notebook 41.35% Dockerfile 0.20%
kinetics automation quantum-chemistry chemical-kinetics sensitivity-analysis python

t3's People

Contributors

alongd avatar amarkpayne avatar calvinp0 avatar jintaowu98 avatar kfir4444 avatar kspieks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

t3's Issues

Auto-correct RMG termination criterion

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.

T3 should use Arkane YAML files where possible

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.

Cantera adapters expect T /P to be scalars and crash if they are lists

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?

Multiple thermo estimators

T3 should have multiple thermo estimators (ML?), and should quickly estimate thermo for all species in the model, flagging outliers (and recalculating them).

Syntax error

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?

Allow specifying species concentrations in the reactors

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.

T3 should also save an ARC input file

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.

Report full SA

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.

Compute high-P limit rate coefficients used for ILS in a PDep network

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.

Missing termination time in SA if not defined in the RMG reactor

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

make test: RuntimeWarning: divide by zero

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

Consider SA when restarting

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.

Make T3 more robust w.r.t PDep ME solution

When RMG crushes due to a PDep k(E) error, do the following:

  1. Examine the requested T range in the RMG PDep block, reducing this range (esp. the high T side) might help it converge
  2. Get the network number and extract all wells and calc thermo for them (also path reaction rate coefficients?)

Report why species did not converge

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']

Consider several multiplicities when sending reactions to QM

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)

Use species .yml files if already used in previous computations

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.

Do compute thermo/kinetic data even if it is present in SOME libraries

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.

Running PDep SA takes a long time

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

Pulling the latest RMS with adjoint SA

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.

rms not defined

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

T3 should (optionally) to determine RMG move to core tolerances on its own

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.