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

New: AutoChem module with rate data structures #616

Merged
merged 3 commits into from
Feb 12, 2025
Merged

Conversation

avcopan
Copy link
Collaborator

@avcopan avcopan commented Feb 12, 2025

Example usage:

import numpy

import autochem

units = {"energy": "cal"}
chem_str = """
C2H4+OH=PC2H4OH          2.560E+36    -7.752     6946   ! Arrhenius parameters at 1 atm
    PLOG /   1.000E-02   1.740E+43   -10.460     7699 /
    PLOG /   2.500E-02   3.250E+37    -8.629     5215 /
    PLOG /   1.000E-01   1.840E+35    -7.750     4909 /
    PLOG /   1.000E+00   2.560E+36    -7.752     6946 /
    PLOG /   1.000E+01   3.700E+33    -6.573     7606 /
    PLOG /   1.000E+02   1.120E+26    -4.101     5757 /
"""

k = autochem.rate.from_chemkin_string(chem_str)
k
# > output: Rate(reactants=['C2H4', 'OH'], products=['PC2H4OH'], reversible=True, rate_constant=PlogRateConstant(order=2, efficiencies={}, As=[1.74e+43, 3.25e+37, 1.84e+35, 2.56e+36, 3.7e+33, 1.12e+26], bs=[-10.46, -8.629, -7.75, -7.752, -6.573, -4.101], Es=[7699.0, 5215.0, 4909.0, 6946.0, 7606.0, 5757.0], ps=[0.01, 0.025, 0.1, 1.0, 10.0, 100.0], type='plog'))

k(t=700, p=1)
# > output: 1529130373819.0667

print(k(t=[700, 800], p=[0.1, 1, 10]))
# > output: [[[4.81592679e+11 1.52913037e+12 3.10970870e+12]]
#            [[2.65962744e+11 1.01383055e+12 2.56076789e+12]]]

T = numpy.linspace(400, 1250, 500)
P = 1
autochem.util.plot.arrhenius_plot(T, k(T, P), y_unit=k.unit)
# > output:

plot

@avcopan avcopan merged commit 885fc63 into Auto-Mech:dev Feb 12, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant