Skip to content

Commit 10ddb5c

Browse files
authored
Merge pull request #2694 from ReactionMechanismGenerator/feat/resonance_scipy
[Python 3.9] Clar SciPy Re-implementation, `pythoncall` Debugging, Optional RMS
2 parents 7b2296d + c308095 commit 10ddb5c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3597
-822
lines changed

.conda/meta.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ requirements:
1414
- {{ compiler('c') }} # [unix]
1515
host:
1616
- cython >=0.25.2
17-
- lpsolve55
1817
- numpy
1918
- openbabel >=3
2019
- pydas >=1.0.2
@@ -39,7 +38,6 @@ requirements:
3938
- h5py
4039
- jinja2
4140
- jupyter
42-
- lpsolve55
4341
- markupsafe
4442
- matplotlib >=1.5
4543
- mopac

.github/workflows/CI.yml

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525
# 2023-07-17 - made it pass by default
2626
# 2023-07-21 - upload the regression results summary as artifact (for use as a comment on PRs)
2727
# 2023-07-31 - removed option to run from RMG-database with GitHub resuable workflows
28+
# 2024-10-01 - deprecated Mambaforge with Miniforge3 for environment creation
2829

2930
name: Continuous Integration
3031

3132
on:
3233
schedule:
3334
# * is a special character in YAML so you have to quote this string
3435
- cron: "0 8 * * *"
35-
# runs on all branches on both RMG-Py and forks
36-
push:
36+
# allow running on RMG-Py on a pushed branch, only if triggered manually
37+
workflow_dispatch:
3738
# runs on PRs against RMG-Py (and anywhere else, but we add this for RMG-Py)
3839
pull_request:
3940

@@ -56,8 +57,9 @@ jobs:
5657
matrix:
5758
python-version: ["3.9"]
5859
os: [macos-13, macos-latest, ubuntu-latest]
60+
test_julia: [yes, no]
5961
runs-on: ${{ matrix.os }}
60-
name: ${{ matrix.os }} Build and Test Python ${{ matrix.python-version }}
62+
name: ${{ matrix.os }} Build and Test Python ${{ matrix.python-version }} (Julia? ${{ matrix.test_julia }})
6163
# skip scheduled runs from forks
6264
if: ${{ !( github.repository != 'ReactionMechanismGenerator/RMG-Py' && github.event_name == 'schedule' ) }}
6365
env:
@@ -70,27 +72,28 @@ jobs:
7072
- name: Checkout RMG-Py
7173
uses: actions/checkout@v4
7274

75+
# Step to create a custom condarc.yml before setting up conda
76+
- name: Create custom condarc.yml
77+
run: |
78+
RUNNER_CWD=$(pwd)
79+
echo "channels:" > $RUNNER_CWD/condarc.yml
80+
echo " - conda-forge" >> $RUNNER_CWD/condarc.yml
81+
echo " - rmg" >> $RUNNER_CWD/condarc.yml
82+
echo " - cantera" >> $RUNNER_CWD/condarc.yml
83+
echo "show_channel_urls: true" >> $RUNNER_CWD/condarc.yml
84+
7385
# configures the mamba environment manager and builds the environment
7486
- name: Setup Mambaforge Python ${{ matrix.python-version }}
7587
uses: conda-incubator/setup-miniconda@v3
7688
with:
7789
environment-file: environment.yml
78-
miniforge-variant: Mambaforge
90+
miniforge-variant: Miniforge3
7991
miniforge-version: latest
8092
python-version: ${{ matrix.python-version }}
93+
condarc-file: condarc.yml
8194
activate-environment: rmg_env
8295
use-mamba: true
8396

84-
- name: Fix ARM Mac environment
85-
if: matrix.os == 'macos-latest'
86-
run: |
87-
conda deactivate
88-
conda env remove -n rmg_env
89-
conda create -n rmg_env
90-
conda activate rmg_env
91-
conda config --env --set subdir osx-64
92-
conda env update -f environment.yml
93-
9497
# list the environment for debugging purposes
9598
- name: mamba info
9699
run: |
@@ -118,31 +121,36 @@ jobs:
118121
119122
# Setup Juliaup
120123
- name: Set Julia paths
124+
if: matrix.test_julia == 'yes'
121125
run: |
122-
echo "JULIAUP_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_ENV
123-
echo "JULIAUP_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_PATH
124-
echo "JULIA_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_ENV
125-
echo "JULIA_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_PATH
126-
echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_ENV
127-
echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_PATH
128-
echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_ENV
129-
echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_PATH
126+
# echo "JULIAUP_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_ENV
127+
# echo "JULIAUP_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_PATH
128+
# echo "JULIA_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_ENV
129+
# echo "JULIA_DEPOT_PATH=$CONDA/envs/rmg_env/.julia" >> $GITHUB_PATH
130+
# echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_ENV
131+
# echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_PATH
132+
# echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_ENV
133+
# echo "JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba" >> $GITHUB_PATH
130134
echo "JULIA_CONDAPKG_BACKEND=Current" >> $GITHUB_ENV
131-
echo "JULIA_CONDAPKG_BACKEND=Current" >> $GITHUB_PATH
135+
# echo "JULIA_CONDAPKG_BACKEND=Current" >> $GITHUB_PATH
132136
133137
- name: Setup Juliaup
138+
if: matrix.test_julia == 'yes'
134139
uses: julia-actions/install-juliaup@v2
135140
with:
136-
channel: '1.10'
141+
channel: '1.9'
137142

138143
- name: Check Julia version
144+
if: matrix.test_julia == 'yes'
139145
run: julia --version
140146

141147
# RMS installation and linking to Julia
142148
- name: Install and link Julia dependencies
149+
if: matrix.test_julia == 'yes'
143150
timeout-minutes: 120 # this usually takes 20-45 minutes (or hangs for 6+ hours).
144151
# JULIA_CONDAPKG_EXE points to the existing conda/mamba to avoid JuliaCall from installing their own. See https://juliapy.github.io/PythonCall.jl/stable/pythoncall/#If-you-already-have-a-Conda-environment.
145152
run: |
153+
mamba install conda-forge::pyjuliacall
146154
julia -e 'using Pkg; Pkg.add(Pkg.PackageSpec(name="ReactionMechanismSimulator", url="https://github.com/hwpang/ReactionMechanismSimulator.jl.git", rev="fix_installation")); using ReactionMechanismSimulator'
147155
148156
- name: Install Q2DTor
@@ -158,7 +166,7 @@ jobs:
158166
id: regression-execution
159167
timeout-minutes: 60
160168
run: |
161-
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation RMS_liquidSurface_ch4o2cat fragment RMS_constantVIdealGasReactor_fragment;
169+
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation RMS_liquidSurface_ch4o2cat fragment RMS_constantVIdealGasReactor_fragment minimal_surface;
162170
do
163171
if python rmg.py test/regression/"$regr_test"/input.py; then
164172
echo "$regr_test" "Executed Successfully"
@@ -209,16 +217,16 @@ jobs:
209217
- name : Find ID of Reference Results
210218
env:
211219
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
220+
# this will search for the last successful execution of CI on main
212221
run: |
213-
run_id=$(gh run list -R ReactionMechanismGenerator/RMG-Py --workflow="Continuous Integration" --branch main --limit 1 --json databaseId --jq '.[0].databaseId')
222+
run_id=$(gh run list -R ReactionMechanismGenerator/RMG-Py --workflow="Continuous Integration" --branch main --limit 15 --json databaseId,conclusion --jq 'map(select(.conclusion == "success")) | .[0].databaseId')
214223
echo "CI_RUN_ID=$run_id" >> $GITHUB_ENV
215224
216225
- name: Retrieve Stable Regression Results
217226
if: ${{ env.REFERENCE_JOB == 'false' }}
218227
uses: actions/download-artifact@v4
219228
with:
220-
# this will search for the last successful execution of CI on main and download
221-
# the stable regression results
229+
# download stable regression results
222230
run-id: ${{ env.CI_RUN_ID }}
223231
repository: ReactionMechanismGenerator/RMG-Py
224232
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -234,7 +242,7 @@ jobs:
234242
run: |
235243
exec 2> >(tee -a regression.stderr >&2) 1> >(tee -a regression.stdout)
236244
mkdir -p "test/regression-diff"
237-
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation fragment RMS_constantVIdealGasReactor_fragment;
245+
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation fragment RMS_constantVIdealGasReactor_fragment minimal_surface;
238246
do
239247
echo ""
240248
echo "### Regression test $regr_test:"
@@ -369,7 +377,7 @@ jobs:
369377
password: ${{ secrets.DOCKERHUB_TOKEN }}
370378

371379
- name: Build and Push
372-
uses: docker/build-push-action@v4
380+
uses: docker/build-push-action@v6
373381
with:
374382
push: true
375383
tags: reactionmechanismgenerator/rmg:latest

.github/workflows/docs.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
uses: conda-incubator/setup-miniconda@v2
3131
with:
3232
environment-file: environment.yml
33-
miniforge-variant: Mambaforge
33+
miniforge-variant: Miniforge3
3434
miniforge-version: latest
3535
python-version: 3.9
3636
activate-environment: rmg_env
@@ -60,13 +60,6 @@ jobs:
6060
make clean
6161
make
6262
63-
- name: Install and link Julia dependencies
64-
timeout-minutes: 120 # this usually takes 20-45 minutes (or hangs for 6+ hours).
65-
run: |
66-
which julia
67-
export JULIA_CONDAPKG_EXE=$CONDA/condabin/mamba
68-
julia -e 'ENV["JULIA_CONDAPKG_BACKEND"] = "Current"; using Pkg; Pkg.add(PackageSpec(name="ReactionMechanismSimulator", url="https://github.com/hwpang/ReactionMechanismSimulator.jl.git", rev="fix_installation")); using ReactionMechanismSimulator'
69-
7063
- name: Checkout gh-pages Branch
7164
uses: actions/checkout@v2
7265
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ test/rmgpy/test_data/temp_dir_for_testing/cantera/chem001.yaml
103103
rmgpy/test_data/copied_kinetic_lib/
104104
testing/qm/*
105105
test_log.txt
106+
rmgpy/tools/data/flux/flux/1/*.dot
106107

107108
# example directory - save the inputs but not the outputs
108109
# cantera input files

Dockerfile

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,30 @@ RUN apt-get update && \
2323
apt-get clean -y
2424

2525
# Install conda
26-
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
27-
bash Miniconda3-latest-Linux-x86_64.sh -b -p /miniconda && \
28-
rm Miniconda3-latest-Linux-x86_64.sh
29-
ENV PATH="$PATH:/miniconda/bin"
30-
31-
# Set solver backend to mamba for speed
32-
RUN conda install -n base conda-libmamba-solver && \
33-
conda config --set solver libmamba
26+
RUN wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh" && \
27+
bash Miniforge3-Linux-x86_64.sh -b -p /miniforge && \
28+
rm Miniforge3-Linux-x86_64.sh
29+
ENV PATH="$PATH:/miniforge/bin"
3430

3531
# Set Bash as the default shell for following commands
3632
SHELL ["/bin/bash", "-c"]
3733

34+
# Add build arguments for RMG-Py, RMG-database, and RMS branches.
35+
ARG RMG_Py_Branch=main
36+
ARG RMG_Database_Branch=main
37+
ARG RMS_Branch=main
38+
ENV rmsbranch=${RMS_Branch}
39+
3840
# cd
3941
WORKDIR /rmg
4042

4143
# Clone the RMG base and database repositories
42-
RUN git clone --single-branch --branch main --depth 1 https://github.com/ReactionMechanismGenerator/RMG-Py.git && \
43-
git clone --single-branch --branch main --depth 1 https://github.com/ReactionMechanismGenerator/RMG-database.git
44+
RUN git clone --single-branch --branch ${RMG_Py_Branch} --depth 1 https://github.com/ReactionMechanismGenerator/RMG-Py.git && \
45+
git clone --single-branch --branch ${RMG_Database_Branch} --depth 1 https://github.com/ReactionMechanismGenerator/RMG-database.git
4446

4547
WORKDIR /rmg/RMG-Py
4648
# build the conda environment
47-
RUN conda env create --file environment.yml && \
48-
conda clean --all --yes
49+
RUN conda env create --file environment.yml
4950

5051
# This runs all subsequent commands inside the rmg_env conda environment
5152
#
@@ -54,6 +55,10 @@ RUN conda env create --file environment.yml && \
5455
# in a Dockerfile build script)
5556
SHELL ["conda", "run", "--no-capture-output", "-n", "rmg_env", "/bin/bash", "-c"]
5657

58+
RUN conda install -c conda-forge julia=1.9.1 pyjulia>=0.6 && \
59+
conda install -c rmg pyrms diffeqpy && \
60+
conda clean --all --yes
61+
5762
# Set environment variables as directed in the RMG installation instructions
5863
ENV RUNNER_CWD=/rmg
5964
ENV PYTHONPATH="$RUNNER_CWD/RMG-Py:$PYTHONPATH"

0 commit comments

Comments
 (0)