Skip to content

Commit b96b603

Browse files
committed
WIP
1 parent 1f37bfd commit b96b603

28 files changed

+17529
-194
lines changed

.github/workflows/CI.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- uses: julia-actions/setup-julia@v1
1515
with:
16-
version: 1.8
16+
version: '1.10'
1717
- uses: actions/cache@v1
1818
env:
1919
cache-name: cache-artifacts
@@ -24,21 +24,17 @@ jobs:
2424
${{ runner.os }}-test-${{ env.cache-name }}-
2525
${{ runner.os }}-test-
2626
${{ runner.os }}-
27-
- uses: conda-incubator/setup-miniconda@v2
28-
with:
29-
environment-file: environment.yml
30-
python-version: 3.7
31-
activate-environment: rms_env
32-
- name: Fix PyCall linking
33-
run: |
34-
julia -e 'ENV["PYTHON"]=ENV["CONDA"] * "/envs/rms_env/bin/python"; using Pkg; Pkg.add("PyCall"); Pkg.build("PyCall")'
3527
- uses: julia-actions/julia-buildpkg@v1
3628
- name: Build
3729
run: |
38-
julia -e 'using Pkg; Pkg.develop(PackageSpec(path="../ReactionMechanismSimulator.jl")); Pkg.build("ReactionMechanismSimulator");'
30+
current_path=${{ github.workspace }}
31+
export JULIA_CONDAPKG_ENV="$current_path/rms_env"
32+
julia -e 'using Pkg; Pkg.develop(Pkg.PackageSpec(path="../ReactionMechanismSimulator.jl/")); Pkg.build("ReactionMechanismSimulator");'
3933
- name: Run tests
4034
run: |
41-
julia -e 'using Pkg; Pkg.test("ReactionMechanismSimulator";coverage=true)'
35+
current_path=${{ github.workspace }}
36+
export JULIA_CONDAPKG_ENV="$current_path/rms_env"
37+
julia -e 'using Pkg; Pkg.test("ReactionMechanismSimulator"; coverage=true)'
4238
- uses: julia-actions/julia-processcoverage@v1
4339
- uses: codecov/codecov-action@v1
4440
with:

.github/workflows/documentation.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,17 @@ jobs:
1616
- uses: actions/checkout@v2
1717
- uses: julia-actions/setup-julia@latest
1818
with:
19-
version: 1.8
20-
- uses: conda-incubator/setup-miniconda@v2
21-
with:
22-
environment-file: environment.yml
23-
python-version: 3.7
24-
activate-environment: rms_env
19+
version: '1.10'
2520
- name: Install dependencies
2621
run: |
27-
julia -e 'ENV["PYTHON"]=ENV["CONDA"] * "/envs/rms_env/bin/python"; using Pkg; Pkg.add("PyCall"); Pkg.build("PyCall")'
28-
julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate();'
22+
current_path=${{ github.workspace }}
23+
export JULIA_CONDAPKG_ENV="$current_path/rms_env"
24+
julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.build("ReactionMechanismSimulator");'
2925
- name: Build and deploy
3026
env:
3127
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
3228
DOCUMENTER_DEBUG: true
33-
run: julia --color=yes --project=docs docs/make.jl
29+
run: |
30+
current_path=${{ github.workspace }}
31+
export JULIA_CONDAPKG_ENV="$current_path/rms_env"
32+
julia --color=yes --project=docs docs/make.jl

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33
*.dot
44
docs/build/
55
.DS_Store
6-
deps/build.log
6+
deps/build.log
7+
.CondaPkg/
8+
rms_env/
9+
*.cov
10+
Manifest.toml

CondaPkg.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
channels = ["defaults", "mjohnson541", "rmg", "conda-forge", "cantera"]

Project.toml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version = "1.0.0"
66
[deps]
77
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
88
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
9-
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
9+
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
1010
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
1111
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
1212
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
@@ -21,8 +21,8 @@ ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
2121
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
2222
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
2323
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
24-
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
25-
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"
24+
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
25+
PythonPlot = "274fc56d-3b97-40fa-a1cd-1b4a50311bf9"
2626
QuartzImageIO = "dca85d43-d64c-5e67-8c65-017450d5d020"
2727
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
2828
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
@@ -39,12 +39,11 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3939
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
4040
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
4141
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
42-
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
4342

4443
[compat]
4544
Calculus = "0.4,0.5"
4645
Colors = "0.11,0.12"
47-
Conda = "1"
46+
CondaPkg = "0"
4847
CSV = "0.10"
4948
DataFrames = "1"
5049
SciMLSensitivity = "^7"
@@ -58,8 +57,8 @@ ModelingToolkit = "8"
5857
OrdinaryDiffEq = "^6"
5958
Parameters = "0.12"
6059
PreallocationTools = "0.4"
61-
PyCall = "1"
62-
PyPlot = "2"
60+
PythonCall = "0"
61+
PythonPlot = "1"
6362
QuartzImageIO = "0.7"
6463
RecursiveArrayTools = "2.17"
6564
ReverseDiff = "1.9"
@@ -72,5 +71,4 @@ Symbolics = "4"
7271
Tracker = "0.2"
7372
Unitful = "^1.3"
7473
YAML = "0.4"
75-
Zygote = "0.5,0.6"
7674
julia = "^1.6"

deps/build.jl

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
using PyCall
2-
using Conda
3-
packages = Conda._installed_packages()
4-
if !("rmg" in packages) && !("rmgmolecule" in packages) && (PyCall.pyversion.major != 3 || PyCall.pyversion.minor != 7)
5-
const Pkg = Base.require(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"))
6-
Conda.rm("mamba")
7-
Conda.add("conda=4")
8-
Conda.add("mamba")
9-
Conda.update()
10-
Conda.add("python=3.7")
11-
try
12-
Conda.rm("numpy") #get around MKL problem
13-
catch e
1+
using CondaPkg
2+
using PythonCall
3+
packages = keys(CondaPkg.current_packages())
4+
if !("rmg" in packages) && !("rmgmolecule" in packages)
5+
6+
if !(v"3.7" <= PythonCall.C.python_version() && PythonCall.C.python_version() <= v"3.9")
7+
CondaPkg.add("python"; version="3.9")
148
end
15-
Conda.add("nomkl")
16-
Conda.add("numpy")
17-
Conda.add_channel("mjohnson541")
18-
Conda.add_channel("hwpang")
19-
Conda.add("rmgmolecule")
20-
Pkg.build("PyCall")
21-
end
9+
CondaPkg.add("rmgmolecule"; version=">=0.3.0", channel="mjohnson541")
10+
CondaPkg.add("matplotlib", channel="conda-forge")
11+
CondaPkg.add("rdkit", channel="conda-forge")
12+
CondaPkg.add("pydot", channel="conda-forge")
13+
end
14+
15+
const Pkg = Base.require(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"))
16+
Pkg.build("PythonCall")

docs/src/Installation.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ The above instructions will automatically handle Julia-Python linking. However,
3737

3838
```
3939
import Pkg
40-
Pkg.add("PyCall")
41-
ENV["CONDA_JL_HOME"] = PATH_TO_YOUR_ENV
42-
Pkg.build("Conda")
43-
ENV["PYTHON"] = PATH_TO_PYTHON
44-
Pkg.build("PyCall")
40+
ENV["JULIA_CONDAPKG_BACKEND"] = "Null"
41+
ENV["JULIA_PYTHONCALL_EXE"] = "/path/to/python"
42+
Pkg.add("CondaPkg")
43+
Pkg.build("CondaPkg")
44+
Pkg.add("PythonCall")
45+
Pkg.build("PythonCall")
4546
```

environment.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

iJulia/Automatic Mechanism Analysis Example.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"outputs": [],
99
"source": [
1010
"using Sundials\n",
11-
"using PyPlot\n",
11+
"using PythonPlot\n",
1212
"using ReactionMechanismSimulator"
1313
]
1414
},

iJulia/ConstantPH2Combustion.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"outputs": [],
3030
"source": [
3131
"using DifferentialEquations\n",
32-
"using PyPlot\n",
32+
"using PythonPlot\n",
3333
"using ReactionMechanismSimulator"
3434
]
3535
},

iJulia/ConstantTPH2Combustion.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"using DiffEqBase\n",
1010
"using Sundials\n",
1111
"using DiffEqSensitivity\n",
12-
"using PyPlot\n",
12+
"using PythonPlot\n",
1313
"using ReactionMechanismSimulator"
1414
]
1515
},

iJulia/ConstantTVOctaneOxidation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"outputs": [],
88
"source": [
99
"using DifferentialEquations\n",
10-
"using PyPlot\n",
10+
"using PythonPlot\n",
1111
"using ReactionMechanismSimulator"
1212
]
1313
},

iJulia/ConstantVH2Combustion.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"outputs": [],
88
"source": [
99
"using DifferentialEquations\n",
10-
"using PyPlot\n",
10+
"using PythonPlot\n",
1111
"using ReactionMechanismSimulator"
1212
]
1313
},

iJulia/Gas-Catalyst Interface.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"outputs": [],
88
"source": [
99
"using ReactionMechanismSimulator\n",
10-
"using PyPlot\n",
10+
"using PythonPlot\n",
1111
"using DifferentialEquations\n",
1212
"using Sundials"
1313
]

iJulia/ParametrizedTConstantVOctaneOxidation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"outputs": [],
88
"source": [
99
"using DifferentialEquations\n",
10-
"using PyPlot\n",
10+
"using PythonPlot\n",
1111
"using ReactionMechanismSimulator"
1212
]
1313
},

iJulia/ParametrizedTPH2Combustion.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"outputs": [],
88
"source": [
99
"using DifferentialEquations\n",
10-
"using PyPlot\n",
10+
"using PythonPlot\n",
1111
"using ReactionMechanismSimulator"
1212
]
1313
},

iJulia/ParametrizedVH2Combustion.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"outputs": [],
88
"source": [
99
"using DifferentialEquations\n",
10-
"using PyPlot\n",
10+
"using PythonPlot\n",
1111
"using ReactionMechanismSimulator"
1212
]
1313
},

iJulia/Quasi-Steady State Assumptions and Isomer Lumping.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"source": [
1010
"using ReactionMechanismSimulator\n",
1111
"using ReactionMechanismSimulator.Sundials\n",
12-
"using ReactionMechanismSimulator.PyPlot"
12+
"using ReactionMechanismSimulator.PythonPlot"
1313
]
1414
},
1515
{

iJulia/Vapor-Liquid Two-Phase Low-Temperature Pyrolysis.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@
14291429
"source": [
14301430
"using ReactionMechanismSimulator\n",
14311431
"using ReactionMechanismSimulator.Sundials\n",
1432-
"using ReactionMechanismSimulator.PyPlot"
1432+
"using ReactionMechanismSimulator.PythonPlot"
14331433
]
14341434
},
14351435
{

src/Parse.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Unitful
22
using YAML
3-
using PyCall
3+
using PythonCall
44
using StaticArrays
55

66
module Calc
@@ -131,7 +131,7 @@ function getatomdictfromrdkit(mol)
131131
atmD = Dict{String,Int64}()
132132
molecularweight = 0.0
133133
for atm in mol.GetAtoms()
134-
v = elementdict[atm.GetAtomicNum()]
134+
v = elementdict[PythonCall.pyconvert(Int64, atm.GetAtomicNum())]
135135
if v in keys(atmD)
136136
atmD[v] += 1
137137
else
@@ -140,9 +140,9 @@ function getatomdictfromrdkit(mol)
140140
end
141141
nbonds = length(mol.GetBonds())
142142
try
143-
molecularweight = Desc.MolWt(mol)/1000.0
144-
catch
145-
@warn("unable to compute molecular weight")
143+
molecularweight = PythonCall.pyconvert(Float64, Desc.MolWt(mol)) / 1000.0
144+
catch e
145+
@warn("unable to compute molecular weight: $e")
146146
end
147147
return atmD,nbonds,molecularweight
148148
end
@@ -151,15 +151,15 @@ export getatomdictfromrdkit
151151
function getatomdictfromrmg(mol)
152152
atmD = Dict{String,Int64}()
153153
for atm in mol.atoms
154-
v = elementdict[atm.element.number]
154+
v = elementdict[PythonCall.pyconvert(Int64, atm.element.number)]
155155
if v in keys(atmD)
156156
atmD[v] += 1
157157
else
158158
atmD[v] = 1
159159
end
160160
end
161161
nbonds = length(mol.get_all_edges())
162-
molecularweight = mol.get_molecular_weight()
162+
molecularweight = PythonCall.pyconvert(Float64, mol.get_molecular_weight())
163163
return atmD,nbonds,molecularweight
164164
end
165165
function getatomdictsmiles(smiles)

src/Plotting.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using PyPlot
1+
using PythonPlot
22

33
"""
44
Plot the mole fractions of the simulation bsol from t0 to tf
@@ -484,7 +484,7 @@ function plottimescales(Jy;taumax=1e6,taumin=1e-18,taures=10.0^0.5,usediag=true)
484484
else
485485
taus = 1.0./abs.(eigvals(Jy))
486486
end
487-
PyPlot.hist([x==Inf ? 0.0 : x for x in taus],bins=10.0.^(log10(taumin):log10(taures):log10(taumax)))
487+
PythonPlot.hist([x == Inf ? 0.0 : x for x in taus], bins=10.0 .^ (log10(taumin):log10(taures):log10(taumax)))
488488
xscale("log")
489489
xlabel("Species Time Scale [sec]")
490490
ylabel("Counts")

0 commit comments

Comments
 (0)