Skip to content

Commit

Permalink
Merge pull request #135 from ReactionMechanismGenerator/ci_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alongd authored Oct 27, 2023
2 parents 965ec71 + 9429b60 commit e099afe
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/cont_int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ jobs:
- name: Checkout T3
uses: actions/checkout@v3

- name: Clean Ubuntu Image
uses: kfir4444/free-disk-space@main
with:
# This may remove tools actually needed - currently does not
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true

- name: Cache RMG
id: cache-rmg
uses: actions/cache@v2
Expand Down Expand Up @@ -97,7 +108,7 @@ jobs:
conda-${{ runner.os }}--${{ runner.arch }}-rmgpyenv-${{ env.CACHE_NUMBER}}
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
CACHE_NUMBER: 1
id: cache-rmgpy-env
- name: Update environment
run: mamba env update -n rmg_env -f RMG-Py/environment.yml
Expand All @@ -107,6 +118,7 @@ jobs:
run: |
cd RMG-Py
conda activate rmg_env
make clean
make
echo "PYTHONPATH=$(pwd):$PYTHONPATH" >> $GITHUB_ENV
echo "PATH=$(pwd):$PATH" >> $GITHUB_ENV
Expand All @@ -115,9 +127,7 @@ jobs:
echo "PATH=$(pwd):$PATH" >> ~/.bashrc
echo "export rmgpy_path=$(pwd)" >> ~/.bashrc
- name: Install PyCall RMG_ENV
run: python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"


- name: Cache RMS
id: cache-rms
uses: actions/cache@v2
Expand All @@ -133,12 +143,10 @@ jobs:
${{ runner.os }}-julia-${{ env.CACHE_NUMBER }}-rms

- name: Install RMS Julia
run: julia -e 'using Pkg; Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="main"));using ReactionMechanismSimulator'
run: julia -e 'using Pkg; Pkg.add(PackageSpec(name="PyCall",rev="master"));Pkg.build("PyCall");Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="main")); using ReactionMechanismSimulator;'

- name: Link Python-JL
run: |
ln -sfn $(which python-jl) $(which python)
cd ..
- name: Install PyCall RMG_ENV
run: python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"

- name: Install ARC ENV
run: |
Expand Down
14 changes: 10 additions & 4 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import datetime
import os
import shutil
import re

from rmgpy.data.thermo import ThermoLibrary
from rmgpy.reaction import Reaction
Expand Down Expand Up @@ -734,7 +735,12 @@ def test_determine_species_based_on_collision_violators():
'S(26357)',
'S(25149)'
]
assert [t3.species[index]['Chemkin label'] for index in species_to_calc] == expected_species_to_calc
expected_numeric_identifiers = [int(re.findall(r'\((\d+)\)', species)[0]) for species in expected_species_to_calc]
numeric_identifiers = [int(re.findall(r'\((\d+)\)', t3.species[index]['Chemkin label'])[0]) for index in species_to_calc]

# Assert that the numeric identifiers are the same
# We do this because 'S' is a generic label for a species, and the numeric identifier is what distinguishes them
assert expected_numeric_identifiers == numeric_identifiers


def test_trsh_rmg_tol():
Expand Down Expand Up @@ -865,7 +871,7 @@ def test_add_reaction():

assert t3.get_reaction_key(reaction=rmg_reactions[342]) == 0
assert t3.reactions[0]['RMG label'] == 's0_H + s1_CC=CCCC <=> s2_S2XC6H13'
assert 'H(2)+S(1229)=C6H13(794)' in t3.reactions[0]['Chemkin label']
assert 'H(2)+C6H12(1229)<=>S2XC6H13(794)' in t3.reactions[0]['Chemkin label']
assert t3.reactions[0]['QM label'] == 's0_H + s1_CC=CCCC <=> s2_S2XC6H13'
assert t3.reactions[0]['SMILES label'] == '[H] + CC=CCCC <=> CC[CH]CCC'
assert isinstance(t3.reactions[0]['object'], Reaction)
Expand All @@ -875,7 +881,7 @@ def test_add_reaction():

assert t3.get_reaction_key(reaction=rmg_reactions[100]) == 1
assert t3.reactions[1]['RMG label'] == 's3_S2XC12H25 + s4_fuel <=> s5_S3XC12H25 + s4_fuel'
assert 'S(839)+fuel(1)=S(840)+fuel(1)' in t3.reactions[1]['Chemkin label']
assert 'S2XC12H25(839)+fuel(1)<=>S3XC12H25(840)+fuel(1)' in t3.reactions[1]['Chemkin label']
assert t3.reactions[1]['QM label'] == 's3_S2XC12H25 + s4_fuel <=> s5_S3XC12H25 + s4_fuel'
assert t3.reactions[1]['SMILES label'] == 'CC[CH]CCCCCCCCC + CCCCCCCCCCCC <=> CCC[CH]CCCCCCCC + CCCCCCCCCCCC'
assert isinstance(t3.reactions[1]['object'], Reaction)
Expand All @@ -885,7 +891,7 @@ def test_add_reaction():

assert t3.get_reaction_key(reaction=rmg_reactions[14]) == 2
assert t3.reactions[2]['RMG label'] == 's6_PC4H9 <=> s7_C2H4 + s8_C2H5'
assert 'PC4H9(191)=C2H4(22)+C2H5(52)' in t3.reactions[2]['Chemkin label']
assert 'PC4H9(191)<=>C2H4(22)+C2H5(52)' in t3.reactions[2]['Chemkin label']
assert t3.reactions[2]['QM label'] == 's6_PC4H9 <=> s7_C2H4 + s8_C2H5'
assert t3.reactions[2]['SMILES label'] == '[CH2]CCC <=> C=C + C[CH2]'
assert isinstance(t3.reactions[2]['object'], Reaction)
Expand Down

0 comments on commit e099afe

Please sign in to comment.