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

Add surface mechanisms to flux diagram tool #2727

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sevyharris
Copy link
Contributor

Motivation or Problem

Flux diagrams are really helpful tools for understand mechanisms, so we would like to be able to make them in RMG for surface/catalysis mechanisms.

Description of Changes

This adds the option of specifying a surface-phase chemkin file in addition to the gas-phase chemkin file

I also added a fix for the bug where the species_path was being defined relatively if the input.py was also defined relatively. This causes problems if you specify a save_path because it changes the directory to the save_path but the dotfile still links to the images relative to the previous location.

Testing

I've tested this on the superminimal and superminimal-catalysis mechanisms. See my example code/files below.

gas_chem_annotated.txt
gas_input.txt
gas_species_dictionary.txt

# Test the gas-phase mechanism's flux diagram
import rmgpy.tools.fluxdiagram

spec_dict = 'species_dictionary.txt'
chemkin = 'chem_annotated.txt'
input_file = 'input.txt'
output_path = 'flux_diagram'
rmgpy.tools.fluxdiagram.create_flux_diagram(input_file, chemkin, spec_dict, save_path=output_path)

surface_chem_annotated-gas.txt
surface_chem_annotated-surface.txt
surface_input.txt
surface_species_dictionary.txt

# Test the gas-phase mechanism's flux diagram
import rmgpy.tools.fluxdiagram

spec_dict = 'surface_species_dictionary.txt'
chemkin = 'surface_chem_annotated-gas.txt'
input_file = 'surface_input.txt'
output_path = 'surface_flux_diagram'
surface_path = 'surface_chem_annotated-surface.txt'
rmgpy.tools.fluxdiagram.create_flux_diagram(input_file, chemkin, spec_dict, save_path=output_path, surface_path=surface_path)

Copy link

github-actions bot commented Nov 8, 2024

Regression Testing Results

WARNING:root:Initial mole fractions do not sum to one; normalizing.
WARNING:root:Initial mole fractions do not sum to one; normalizing.
WARNING:root:Initial mole fractions do not sum to one; normalizing.
⚠️ One or more regression tests failed.
Please download the failed results and run the tests locally or check the log to see why.

Detailed regression test results.

Regression test aromatics:

Reference: Execution time (DD:HH:MM:SS): 00:00:01:04
Current: Execution time (DD:HH:MM:SS): 00:00:01:05
Reference: Memory used: 2780.66 MB
Current: Memory used: 2761.42 MB

aromatics Passed Core Comparison ✅

Original model has 15 species.
Test model has 15 species. ✅
Original model has 11 reactions.
Test model has 11 reactions. ✅

aromatics Failed Edge Comparison ❌

Original model has 106 species.
Test model has 106 species. ✅
Original model has 358 reactions.
Test model has 358 reactions. ✅

Non-identical thermo! ❌
original: C=CC1C=CC2=CC1C=C2
tested: C=CC1C=CC2=CC1C=C2

Hf(300K) S(300K) Cp(300K) Cp(400K) Cp(500K) Cp(600K) Cp(800K) Cp(1000K) Cp(1500K)
83.22 84.16 35.48 45.14 53.78 61.40 73.58 82.20 95.08
83.22 82.78 35.48 45.14 53.78 61.40 73.58 82.20 95.08

Identical thermo comments:
thermo: Thermo group additivity estimation: group(Cs-(Cds-Cds)(Cds-Cds)CsH) + group(Cs-(Cds-Cds)(Cds-Cds)CsH) + group(Cds-Cds(Cds-Cds)(Cds-Cds)) + group(Cds- CdsCsH) + group(Cds-CdsCsH) + group(Cds-CdsCsH) + group(Cds-CdsCsH) + group(Cds-Cds(Cds-Cds)H) + group(Cds-Cds(Cds-Cds)H) + group(Cds-CdsHH) + Estimated bicyclic component: polycyclic(s3_5_6_ane) - ring(Cyclohexane) - ring(Cyclopentane) + ring(1,3-Cyclohexadiene) + ring(Cyclopentadiene)

Observables Test Case: Aromatics Comparison

✅ All Observables varied by less than 0.500 on average between old model and new model in all conditions!

aromatics Passed Observable Testing ✅

Regression test liquid_oxidation:

Reference: Execution time (DD:HH:MM:SS): 00:00:02:08
Current: Execution time (DD:HH:MM:SS): 00:00:02:10
Reference: Memory used: 2915.08 MB
Current: Memory used: 2894.40 MB

liquid_oxidation Failed Core Comparison ❌

Original model has 37 species.
Test model has 37 species. ✅
Original model has 216 reactions.
Test model has 215 reactions. ❌
The original model has 1 reactions that the tested model does not have. ❌
rxn: CCO[O](30) <=> [OH](22) + CC=O(72) origin: intra_H_migration

Non-identical kinetics! ❌
original:
rxn: CCCC(C)O[O](20) + CCCCCO[O](103) <=> oxygen(1) + CCCC(C)[O](61) + CCCCC[O](127) origin: Peroxyl_Disproportionation
tested:
rxn: CCCC(C)O[O](20) + CCCCCO[O](104) <=> oxygen(1) + CCCC(C)[O](61) + CCCCC[O](127) origin: Peroxyl_Disproportionation

k(1bar) 300K 400K 500K 600K 800K 1000K 1500K 2000K
k(T): 3.77 4.45 4.86 5.14 5.48 5.68 5.96 6.09
k(T): 7.83 7.49 7.23 7.02 6.68 6.42 5.95 5.61

kinetics: Arrhenius(A=(3.2e+12,'cm^3/(mol*s)'), n=0, Ea=(3.756,'kcal/mol'), T0=(1,'K'), comment="""Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing_Ext-5R-R""")
kinetics: Arrhenius(A=(3.18266e+20,'cm^3/(mol*s)'), n=-2.694, Ea=(0,'kcal/mol'), T0=(1,'K'), comment="""Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing""")
kinetics: Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing_Ext-5R-R
kinetics: Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing

liquid_oxidation Failed Edge Comparison ❌

Original model has 202 species.
Test model has 202 species. ✅
Original model has 1610 reactions.
Test model has 1613 reactions. ❌
The original model has 2 reactions that the tested model does not have. ❌
rxn: CCO[O](30) <=> [OH](22) + CC=O(72) origin: intra_H_migration
rxn: CCCCCO[O](103) + CCCCCO[O](103) <=> oxygen(1) + CCCCC=O(106) + CCCCCO(130) origin: Peroxyl_Termination
The tested model has 5 reactions that the original model does not have. ❌
rxn: CCO[O](29) <=> C[CH]OO(73) origin: intra_H_migration
rxn: C[CH]CCCO(157) + CCCCCO[O](104) <=> CC=CCCO(183) + CCCCCOO(105) origin: Disproportionation
rxn: C[CH]CCCO(157) + CCCCCO[O](104) <=> C=CCCCO(184) + CCCCCOO(105) origin: Disproportionation
rxn: C[CH]CCCO(157) + C[CH]CCCO(157) <=> CC=CCCO(183) + CCCCCO(130) origin: Disproportionation
rxn: C[CH]CCCO(157) + C[CH]CCCO(157) <=> C=CCCCO(184) + CCCCCO(130) origin: Disproportionation

Non-identical kinetics! ❌
original:
rxn: CCCC(C)O[O](20) + CCCCCO[O](103) <=> oxygen(1) + CCCC(C)[O](61) + CCCCC[O](127) origin: Peroxyl_Disproportionation
tested:
rxn: CCCC(C)O[O](20) + CCCCCO[O](104) <=> oxygen(1) + CCCC(C)[O](61) + CCCCC[O](127) origin: Peroxyl_Disproportionation

k(1bar) 300K 400K 500K 600K 800K 1000K 1500K 2000K
k(T): 3.77 4.45 4.86 5.14 5.48 5.68 5.96 6.09
k(T): 7.83 7.49 7.23 7.02 6.68 6.42 5.95 5.61

kinetics: Arrhenius(A=(3.2e+12,'cm^3/(mol*s)'), n=0, Ea=(3.756,'kcal/mol'), T0=(1,'K'), comment="""Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing_Ext-5R-R""")
kinetics: Arrhenius(A=(3.18266e+20,'cm^3/(mol*s)'), n=-2.694, Ea=(0,'kcal/mol'), T0=(1,'K'), comment="""Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing""")
kinetics: Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing_Ext-5R-R
kinetics: Estimated from node Root_Ext-5R-R_7R!H->C_N-7C-inRing

Observables Test Case: liquid_oxidation Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

liquid_oxidation Passed Observable Testing ✅

Regression test nitrogen:

Reference: Execution time (DD:HH:MM:SS): 00:00:01:23
Current: Execution time (DD:HH:MM:SS): 00:00:01:24
Reference: Memory used: 2921.89 MB
Current: Memory used: 2891.11 MB

nitrogen Passed Core Comparison ✅

Original model has 41 species.
Test model has 41 species. ✅
Original model has 360 reactions.
Test model has 360 reactions. ✅

nitrogen Passed Edge Comparison ✅

Original model has 133 species.
Test model has 133 species. ✅
Original model has 983 reactions.
Test model has 983 reactions. ✅

Observables Test Case: NC Comparison

✅ All Observables varied by less than 0.200 on average between old model and new model in all conditions!

nitrogen Passed Observable Testing ✅

Regression test oxidation:

Reference: Execution time (DD:HH:MM:SS): 00:00:02:28
Current: Execution time (DD:HH:MM:SS): 00:00:02:26
Reference: Memory used: 2763.48 MB
Current: Memory used: 2759.19 MB

oxidation Passed Core Comparison ✅

Original model has 59 species.
Test model has 59 species. ✅
Original model has 694 reactions.
Test model has 694 reactions. ✅

oxidation Passed Edge Comparison ✅

Original model has 230 species.
Test model has 230 species. ✅
Original model has 1526 reactions.
Test model has 1526 reactions. ✅

Observables Test Case: Oxidation Comparison

✅ All Observables varied by less than 0.500 on average between old model and new model in all conditions!

oxidation Passed Observable Testing ✅

Regression test sulfur:

Reference: Execution time (DD:HH:MM:SS): 00:00:00:55
Current: Execution time (DD:HH:MM:SS): 00:00:00:56
Reference: Memory used: 2856.10 MB
Current: Memory used: 2851.31 MB

sulfur Passed Core Comparison ✅

Original model has 27 species.
Test model has 27 species. ✅
Original model has 74 reactions.
Test model has 74 reactions. ✅

sulfur Failed Edge Comparison ❌

Original model has 89 species.
Test model has 89 species. ✅
Original model has 227 reactions.
Test model has 227 reactions. ✅
The original model has 1 reactions that the tested model does not have. ❌
rxn: O(4) + SO2(15) (+N2) <=> SO3(16) (+N2) origin: primarySulfurLibrary
The tested model has 1 reactions that the original model does not have. ❌
rxn: O(4) + SO2(15) (+N2) <=> SO3(16) (+N2) origin: primarySulfurLibrary

Observables Test Case: SO2 Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

sulfur Passed Observable Testing ✅

Regression test superminimal:

Reference: Execution time (DD:HH:MM:SS): 00:00:00:36
Current: Execution time (DD:HH:MM:SS): 00:00:00:36
Reference: Memory used: 2971.57 MB
Current: Memory used: 2967.71 MB

superminimal Passed Core Comparison ✅

Original model has 13 species.
Test model has 13 species. ✅
Original model has 21 reactions.
Test model has 21 reactions. ✅

superminimal Passed Edge Comparison ✅

Original model has 18 species.
Test model has 18 species. ✅
Original model has 28 reactions.
Test model has 28 reactions. ✅

Regression test RMS_constantVIdealGasReactor_superminimal:

Reference: Execution time (DD:HH:MM:SS): 00:00:02:27
Current: Execution time (DD:HH:MM:SS): 00:00:02:26
Reference: Memory used: 3486.45 MB
Current: Memory used: 3494.74 MB

RMS_constantVIdealGasReactor_superminimal Passed Core Comparison ✅

Original model has 13 species.
Test model has 13 species. ✅
Original model has 19 reactions.
Test model has 19 reactions. ✅

RMS_constantVIdealGasReactor_superminimal Passed Edge Comparison ✅

Original model has 13 species.
Test model has 13 species. ✅
Original model has 19 reactions.
Test model has 19 reactions. ✅

Observables Test Case: RMS_constantVIdealGasReactor_superminimal Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

RMS_constantVIdealGasReactor_superminimal Passed Observable Testing ✅

Regression test RMS_CSTR_liquid_oxidation:

Reference: Execution time (DD:HH:MM:SS): 00:00:06:02
Current: Execution time (DD:HH:MM:SS): 00:00:05:54
Reference: Memory used: 3417.70 MB
Current: Memory used: 3411.00 MB

RMS_CSTR_liquid_oxidation Passed Core Comparison ✅

Original model has 37 species.
Test model has 37 species. ✅
Original model has 233 reactions.
Test model has 233 reactions. ✅

RMS_CSTR_liquid_oxidation Passed Edge Comparison ✅

Original model has 206 species.
Test model has 206 species. ✅
Original model has 1508 reactions.
Test model has 1508 reactions. ✅

Observables Test Case: RMS_CSTR_liquid_oxidation Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

RMS_CSTR_liquid_oxidation Passed Observable Testing ✅

Regression test fragment:

Reference: Execution time (DD:HH:MM:SS): 00:00:00:41
Current: Execution time (DD:HH:MM:SS): 00:00:00:40
Reference: Memory used: 2687.23 MB
Current: Memory used: 2685.89 MB

fragment Passed Core Comparison ✅

Original model has 10 species.
Test model has 10 species. ✅
Original model has 2 reactions.
Test model has 2 reactions. ✅

fragment Passed Edge Comparison ✅

Original model has 33 species.
Test model has 33 species. ✅
Original model has 47 reactions.
Test model has 47 reactions. ✅

Observables Test Case: fragment Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

fragment Passed Observable Testing ✅

Regression test RMS_constantVIdealGasReactor_fragment:

Reference: Execution time (DD:HH:MM:SS): 00:00:03:08
Current: Execution time (DD:HH:MM:SS): 00:00:03:04
Reference: Memory used: 3632.66 MB
Current: Memory used: 3635.11 MB

RMS_constantVIdealGasReactor_fragment Passed Core Comparison ✅

Original model has 10 species.
Test model has 10 species. ✅
Original model has 2 reactions.
Test model has 2 reactions. ✅

RMS_constantVIdealGasReactor_fragment Passed Edge Comparison ✅

Original model has 27 species.
Test model has 27 species. ✅
Original model has 24 reactions.
Test model has 24 reactions. ✅

Observables Test Case: RMS_constantVIdealGasReactor_fragment Comparison

✅ All Observables varied by less than 0.100 on average between old model and new model in all conditions!

RMS_constantVIdealGasReactor_fragment Passed Observable Testing ✅

Regression test minimal_surface:

Reference: Execution time (DD:HH:MM:SS): 00:00:00:44
Current: Execution time (DD:HH:MM:SS): 00:00:00:45
Reference: Memory used: 2865.93 MB
Current: Memory used: 2866.92 MB

minimal_surface Passed Core Comparison ✅

Original model has 11 species.
Test model has 11 species. ✅
Original model has 3 reactions.
Test model has 3 reactions. ✅

minimal_surface Passed Edge Comparison ✅

Original model has 38 species.
Test model has 38 species. ✅
Original model has 38 reactions.
Test model has 38 reactions. ✅

Observables Test Case: minimal_surface Comparison

✅ All Observables varied by less than 0.500 on average between old model and new model in all conditions!

minimal_surface Passed Observable Testing ✅

beep boop this comment was written by a bot 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant