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

Change method for loading energies from Gaussian log files to regex search to avoid errors #2595

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

Conversation

donerancl
Copy link
Contributor

Motivation or Problem

Sometimes, in gaussian log files, the line that contains the energy has extra characters (more than one line printed in the same line) that prevent the load_energy function in arkane/ess/gaussian.py from parsing the energy. (e.g., it will try to use an "=" as the energy)

Description of Changes

Before: find the line that has "SCF Done:", split it, take the 4th index as the energy

After: find the line that has "SCF Done:", find the substring that matches "SCF Done: E(...) = {energyfloat}, split the substring, and take the last item

the same can be done for E2, MP2, E(CORR), CCSD(T), CBS-QB3 (0 K), E(CBS-QB3)=, CBS-4 (0 K)=, G3(0 K), G3 Energy=,G4(0 K), G4 Energy=, G4MP2(0 K), G4MP2 Energy= in the same function

Testing

I plan to try the load_energy function on many gaussian log files, some which have extra characters in the line containing the energy

Reviewer Tips

Suggestions for verifying that this PR works or other notes for the reviewer.

@JacksonBurns
Copy link
Contributor

I know this isn't ready yet, but when you are good for review please squash these commits. Thanks!

@donerancl donerancl force-pushed the gaussian_regex branch 3 times, most recently from 9b0c254 to 481fcbd Compare January 31, 2024 22:05
@donerancl donerancl marked this pull request as ready for review January 31, 2024 22:07
@donerancl
Copy link
Contributor Author

I think this is ready. I was able to parse thousands of gaussian log files without the errors from the issue I described above.

Copy link
Contributor

@JacksonBurns JacksonBurns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for squashing! The new regex seems to work, as it isn't failing any such tests.

This is failing a couple of the other unit tests - it seems that the new Energy= test is picking up some non-numeric text in some cases, like in this unit test: https://github.com/ReactionMechanismGenerator/RMG-Py/actions/runs/7732973138/job/21084096743?pr=2595#step:10:2616
which is attempting to read this Gaussian log file: https://github.com/ReactionMechanismGenerator/RMG-Py/blob/b53f63bf7826440c1e410e311136fa606167c332/arkane/data/gaussian/oxygen.log

It picks up either "change" or "forces"

arkane/ess/gaussian.py Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Feb 5, 2024

Regression Testing Results

⚠️ 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:05
Current: Execution time (DD:HH:MM:SS): 00:00:01:08
Reference: Memory used: 2152.50 MB
Current: Memory used: 2143.06 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 Passed Edge Comparison ✅

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

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:09
Current: Execution time (DD:HH:MM:SS): 00:00:02:13
Reference: Memory used: 2267.35 MB
Current: Memory used: 2294.90 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](104) <=> oxygen(1) + CCCC(C)[O](61) + CCCCC[O](127) origin: Peroxyl_Disproportionation
tested:
rxn: CCCC(C)O[O](20) + CCCCCO[O](103) <=> 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](104) + CCCCCO[O](104) <=> 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](31) <=> C[CH]OO(70) origin: intra_H_migration
rxn: C[CH]CCCO(157) + CCCCCO[O](103) <=> CC=CCCO(192) + CCCCCOO(105) origin: Disproportionation
rxn: C[CH]CCCO(157) + CCCCCO[O](103) <=> C=CCCCO(193) + CCCCCOO(105) origin: Disproportionation
rxn: C[CH]CCCO(157) + C[CH]CCCO(157) <=> CC=CCCO(192) + CCCCCO(130) origin: Disproportionation
rxn: C[CH]CCCO(157) + C[CH]CCCO(157) <=> C=CCCCO(193) + CCCCCO(130) origin: Disproportionation

Non-identical kinetics! ❌
original:
rxn: CCCC(C)O[O](20) + CCCCCO[O](104) <=> oxygen(1) + CCCC(C)[O](61) + CCCCC[O](127) origin: Peroxyl_Disproportionation
tested:
rxn: CCCC(C)O[O](20) + CCCCCO[O](103) <=> 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:22
Current: Execution time (DD:HH:MM:SS): 00:00:01:25
Reference: Memory used: 2258.53 MB
Current: Memory used: 2270.96 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 132 species.
Test model has 132 species. ✅
Original model has 997 reactions.
Test model has 997 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:25
Current: Execution time (DD:HH:MM:SS): 00:00:02:35
Reference: Memory used: 2127.91 MB
Current: Memory used: 2164.41 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:54
Current: Execution time (DD:HH:MM:SS): 00:00:00:55
Reference: Memory used: 2231.55 MB
Current: Memory used: 2236.92 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:34
Current: Execution time (DD:HH:MM:SS): 00:00:00:34
Reference: Memory used: 2368.28 MB
Current: Memory used: 2392.52 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:29
Current: Execution time (DD:HH:MM:SS): 00:00:02:28
Reference: Memory used: 2795.26 MB
Current: Memory used: 2793.03 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:11
Current: Execution time (DD:HH:MM:SS): 00:00:06:10
Reference: Memory used: 2762.02 MB
Current: Memory used: 2769.94 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 Failed Edge Comparison ❌

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

Non-identical kinetics! ❌
original:
rxn: CCCO[O](35) + CCCC(C)O[O](33) <=> oxygen(1) + CCC[O](92) + CCCC(C)[O](65) origin: Peroxyl_Disproportionation
tested:
rxn: CCCO[O](36) + CCCC(C)O[O](33) <=> oxygen(1) + CCC[O](95) + CCCC(C)[O](65) origin: Peroxyl_Disproportionation

k(1bar) 300K 400K 500K 600K 800K 1000K 1500K 2000K
k(T): 3.69 4.39 4.82 5.10 5.45 5.66 5.94 6.08
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.866,'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: 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:40
Current: Execution time (DD:HH:MM:SS): 00:00:00:40
Reference: Memory used: 2062.54 MB
Current: Memory used: 2096.09 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:09
Reference: Memory used: 2924.63 MB
Current: Memory used: 2943.95 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 ✅

beep boop this comment was written by a bot 🤖

Copy link

codecov bot commented Feb 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.15%. Comparing base (551c3eb) to head (cac16dd).
Report is 92 commits behind head on main.

❗ Current head cac16dd differs from pull request most recent head 99fc9f3. Consider uploading reports for the commit 99fc9f3 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2595   +/-   ##
=======================================
  Coverage   55.15%   55.15%           
=======================================
  Files         125      125           
  Lines       37036    37037    +1     
=======================================
+ Hits        20426    20427    +1     
  Misses      16610    16610           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@JacksonBurns JacksonBurns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix! LGTM, thanks for the improvement.

donerancl and others added 2 commits February 6, 2024 15:46
I think I added these in accidentally, I got the same error and omitting them fixed it
@JacksonBurns
Copy link
Contributor

Rebased and enabled auto-merge, so this should go in on its own tonight.

@JacksonBurns
Copy link
Contributor

JacksonBurns commented Feb 7, 2024

Arg this is blocked by CI issues, apologies. Addressing now, will circle back to this...

@JacksonBurns
Copy link
Contributor

Issue found, blocked by #2608

Copy link

github-actions bot commented May 8, 2024

This pull request is being automatically marked as stale because it has not received any interaction in the last 90 days. Please leave a comment if this is still a relevant pull request, otherwise it will automatically be closed in 30 days.

@github-actions github-actions bot added the stale stale issue/PR as determined by actions bot label May 8, 2024
@JacksonBurns
Copy link
Contributor

Now blocked by #2658

@github-actions github-actions bot removed the stale stale issue/PR as determined by actions bot label May 9, 2024
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.

None yet

2 participants