Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
hwpang committed Mar 21, 2024
1 parent e68d462 commit 1997ef9
Show file tree
Hide file tree
Showing 23 changed files with 92 additions and 152 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: 1.8
version: '1.10'
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
Expand All @@ -24,21 +24,13 @@ jobs:
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: conda-incubator/setup-miniconda@v2
with:
environment-file: environment.yml
python-version: 3.7
activate-environment: rms_env
- name: Fix PyCall linking
run: |
julia -e 'ENV["PYTHON"]=ENV["CONDA"] * "/envs/rms_env/bin/python"; using Pkg; Pkg.add("PyCall"); Pkg.build("PyCall")'
- uses: julia-actions/julia-buildpkg@v1
- name: Build
run: |
julia -e 'using Pkg; Pkg.develop(PackageSpec(path="../ReactionMechanismSimulator.jl")); Pkg.build("ReactionMechanismSimulator");'
julia -e 'using Pkg; Pkg.develop(Pkg.PackageSpec(path="../ReactionMechanismSimulator.jl/")); Pkg.build("ReactionMechanismSimulator");'
- name: Run tests
run: |
julia -e 'using Pkg; Pkg.test("ReactionMechanismSimulator";coverage=true)'
julia -e 'using Pkg; Pkg.test("ReactionMechanismSimulator"; coverage=true)'
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/Install.yml

This file was deleted.

8 changes: 1 addition & 7 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: 1.8
- uses: conda-incubator/setup-miniconda@v2
with:
environment-file: environment.yml
python-version: 3.7
activate-environment: rms_env
version: '1.10'
- name: Install dependencies
run: |
julia -e 'ENV["PYTHON"]=ENV["CONDA"] * "/envs/rms_env/bin/python"; using Pkg; Pkg.add("PyCall"); Pkg.build("PyCall")'
julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate();'
- name: Build and deploy
env:
Expand Down
12 changes: 6 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version = "1.0.0"
[deps]
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
Expand All @@ -21,8 +21,8 @@ ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
PythonPlot = "274fc56d-3b97-40fa-a1cd-1b4a50311bf9"
QuartzImageIO = "dca85d43-d64c-5e67-8c65-017450d5d020"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
Expand All @@ -43,7 +43,7 @@ YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
[compat]
Calculus = "0.4,0.5"
Colors = "0.11,0.12"
Conda = "1"
CondaPkg = "0"
CSV = "0.10"
DataFrames = "1"
SciMLSensitivity = "^7"
Expand All @@ -57,8 +57,8 @@ ModelingToolkit = "8"
OrdinaryDiffEq = "^6"
Parameters = "0.12"
PreallocationTools = "0.4"
PyCall = "1"
PyPlot = "2"
PythonCall = "0"
PythonPlot = "1"
QuartzImageIO = "0.7"
RecursiveArrayTools = "2.17"
ReverseDiff = "1.9"
Expand Down
24 changes: 10 additions & 14 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
using PyCall
using Conda
packages = Conda._installed_packages()
if !("rmg" in packages) && !("rmgmolecule" in packages) && (PyCall.pyversion.major != 3 || !(PyCall.pyversion.minor in [7, 8, 9]))
using CondaPkg
using PythonCall
packages = keys(CondaPkg.current_packages())
if !("rmg" in packages) && !("rmgmolecule" in packages) || !(v"3.7" <= PythonCall.C.python_version() && PythonCall.C.python_version() <= v"3.9")
const Pkg = Base.require(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"))
Conda.add("python=3.8")
try
Conda.rm("numpy") #get around MKL problem
catch e
end
Conda.add("nomkl")
Conda.add("numpy")
Conda.add_channel("mjohnson541")
Conda.add("rmgmolecule")
Pkg.build("PyCall")
CondaPkg.add("python"; version="3.9")
CondaPkg.add("matplotlib")
CondaPkg.add("rdkit")
CondaPkg.add("pydot")
CondaPkg.add("rmgmolecule"; version=">=0.3.0", channel="mjohnson541")
Pkg.build("PythonCall")
end
6 changes: 3 additions & 3 deletions docs/src/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ The above instructions will automatically handle Julia-Python linking. However,

```
import Pkg
Pkg.add("PyCall")
Pkg.add("PythonCall")
ENV["CONDA_JL_HOME"] = PATH_TO_YOUR_ENV
Pkg.build("Conda")
Pkg.build("CondaPkg")
ENV["PYTHON"] = PATH_TO_PYTHON
Pkg.build("PyCall")
Pkg.build("PythonCall")
```
11 changes: 0 additions & 11 deletions environment.yml

This file was deleted.

2 changes: 1 addition & 1 deletion iJulia/Automatic Mechanism Analysis Example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outputs": [],
"source": [
"using Sundials\n",
"using PyPlot\n",
"using PythonPlot\n",
"using ReactionMechanismSimulator"
]
},
Expand Down
2 changes: 1 addition & 1 deletion iJulia/ConstantPH2Combustion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"outputs": [],
"source": [
"using DifferentialEquations\n",
"using PyPlot\n",
"using PythonPlot\n",
"using ReactionMechanismSimulator"
]
},
Expand Down
2 changes: 1 addition & 1 deletion iJulia/ConstantTPH2Combustion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"using DiffEqBase\n",
"using Sundials\n",
"using DiffEqSensitivity\n",
"using PyPlot\n",
"using PythonPlot\n",
"using ReactionMechanismSimulator"
]
},
Expand Down
2 changes: 1 addition & 1 deletion iJulia/ConstantTVOctaneOxidation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"outputs": [],
"source": [
"using DifferentialEquations\n",
"using PyPlot\n",
"using PythonPlot\n",
"using ReactionMechanismSimulator"
]
},
Expand Down
2 changes: 1 addition & 1 deletion iJulia/ConstantVH2Combustion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"outputs": [],
"source": [
"using DifferentialEquations\n",
"using PyPlot\n",
"using PythonPlot\n",
"using ReactionMechanismSimulator"
]
},
Expand Down
2 changes: 1 addition & 1 deletion iJulia/Gas-Catalyst Interface.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"outputs": [],
"source": [
"using ReactionMechanismSimulator\n",
"using PyPlot\n",
"using PythonPlot\n",
"using DifferentialEquations\n",
"using Sundials"
]
Expand Down
2 changes: 1 addition & 1 deletion iJulia/ParametrizedTConstantVOctaneOxidation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"outputs": [],
"source": [
"using DifferentialEquations\n",
"using PyPlot\n",
"using PythonPlot\n",
"using ReactionMechanismSimulator"
]
},
Expand Down
2 changes: 1 addition & 1 deletion iJulia/ParametrizedTPH2Combustion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"outputs": [],
"source": [
"using DifferentialEquations\n",
"using PyPlot\n",
"using PythonPlot\n",
"using ReactionMechanismSimulator"
]
},
Expand Down
2 changes: 1 addition & 1 deletion iJulia/ParametrizedVH2Combustion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"outputs": [],
"source": [
"using DifferentialEquations\n",
"using PyPlot\n",
"using PythonPlot\n",
"using ReactionMechanismSimulator"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"source": [
"using ReactionMechanismSimulator\n",
"using ReactionMechanismSimulator.Sundials\n",
"using ReactionMechanismSimulator.PyPlot"
"using ReactionMechanismSimulator.PythonPlot"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@
"source": [
"using ReactionMechanismSimulator\n",
"using ReactionMechanismSimulator.Sundials\n",
"using ReactionMechanismSimulator.PyPlot"
"using ReactionMechanismSimulator.PythonPlot"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/Parse.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Unitful
using YAML
using PyCall
using PythonCall
using StaticArrays

module Calc
Expand Down
4 changes: 2 additions & 2 deletions src/Plotting.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PyPlot
using PythonPlot

"""
Plot the mole fractions of the simulation bsol from t0 to tf
Expand Down Expand Up @@ -484,7 +484,7 @@ function plottimescales(Jy;taumax=1e6,taumin=1e-18,taures=10.0^0.5,usediag=true)
else
taus = 1.0./abs.(eigvals(Jy))
end
PyPlot.hist([x==Inf ? 0.0 : x for x in taus],bins=10.0.^(log10(taumin):log10(taures):log10(taumax)))
PythonPlot.hist([x == Inf ? 0.0 : x for x in taus], bins=10.0 .^ (log10(taumin):log10(taures):log10(taumax)))
xscale("log")
xlabel("Species Time Scale [sec]")
ylabel("Counts")
Expand Down
89 changes: 44 additions & 45 deletions src/ReactionMechanismSimulator.jl
Original file line number Diff line number Diff line change
@@ -1,54 +1,53 @@
module ReactionMechanismSimulator
import Logging
Logging.disable_logging(Logging.Warn)

module ReactionMechanismSimulator
using PyCall
push!(PyVector(pyimport("sys")["path"]), "")
const Chem = PyNULL()
const Desc = PyNULL()
const molecule = PyNULL()
const fragment = PyNULL()
const pydot = PyNULL()
const chemkin = PyNULL()
const species = PyNULL()
const reaction = PyNULL()
const nasa = PyNULL()
const wilhoit = PyNULL()
const arrhenius = PyNULL()
const falloff = PyNULL()
const chebyshev = PyNULL()
const solvation = PyNULL()
const os = PyNULL()
using PythonCall
pyimport("sys").path.append("")
const Chem = Ref{Py}()
const Desc = Ref{Py}()
const molecule = Ref{Py}()
const chemkin = Ref{Py}()
const species = Ref{Py}()
const reaction = Ref{Py}()
const nasa = Ref{Py}()
const wilhoit = Ref{Py}()
const arrhenius = Ref{Py}()
const falloff = Ref{Py}()
const chebyshev = Ref{Py}()
const solvation = Ref{Py}()
const fragment = Ref{Py}()
const pydot = Ref{Py}()
const os = Ref{Py}()
function __init__()
copy!(Chem, pyimport_conda("rdkit.Chem", "rdkit", "rmg"))
copy!(Desc, pyimport_conda("rdkit.Chem.Descriptors", "rdkit", "rmg"))
Chem[] = pyimport("rdkit.Chem")
Desc[] = pyimport("rdkit.Chem.Descriptors")
try
copy!(molecule, pyimport("rmgpy.molecule"))
copy!(chemkin, pyimport("rmgpy.chemkin"))
copy!(species, pyimport("rmgpy.species"))
copy!(reaction, pyimport("rmgpy.reaction"))
copy!(nasa, pyimport("rmgpy.thermo.nasa"))
copy!(wilhoit, pyimport("rmgpy.thermo.wilhoit"))
copy!(arrhenius, pyimport("rmgpy.kinetics.arrhenius"))
copy!(falloff, pyimport("rmgpy.kinetics.falloff"))
copy!(chebyshev, pyimport("rmgpy.kinetics.chebyshev"))
copy!(solvation, pyimport("rmgpy.data.solvation"))
copy!(fragment, pyimport("rmgpy.molecule.fragment"))
molecule[] = pyimport("rmgpy.molecule")
chemkin[] = pyimport("rmgpy.chemkin")
species[] = pyimport("rmgpy.species")
reaction[] = pyimport("rmgpy.reaction")
nasa[] = pyimport("rmgpy.thermo.nasa")
wilhoit[] = pyimport("rmgpy.thermo.wilhoit")
arrhenius[] = pyimport("rmgpy.kinetics.arrhenius")
falloff[] = pyimport("rmgpy.kinetics.falloff")
chebyshev[] = pyimport("rmgpy.kinetics.chebyshev")
solvation[] = pyimport("rmgpy.data.solvation")
fragment[] = pyimport("rmgpy.molecule.fragment")
catch e
copy!(molecule, pyimport_conda("molecule.molecule", "rmgmolecule", "mjohnson541"))
copy!(chemkin, pyimport_conda("molecule.chemkin", "rmgmolecule", "mjohnson541"))
copy!(species, pyimport_conda("molecule.species", "rmgmolecule", "mjohnson541"))
copy!(reaction, pyimport_conda("molecule.reaction", "rmgmolecule", "mjohnson541"))
copy!(nasa, pyimport_conda("molecule.thermo.nasa", "rmgmolecule", "mjohnson541"))
copy!(wilhoit, pyimport_conda("molecule.thermo.wilhoit", "rmgmolecule", "mjohnson541"))
copy!(arrhenius, pyimport_conda("molecule.kinetics.arrhenius", "rmgmolecule", "mjohnson541"))
copy!(falloff, pyimport_conda("molecule.kinetics.falloff", "rmgmolecule", "mjohnson541"))
copy!(chebyshev, pyimport_conda("molecule.kinetics.chebyshev", "rmgmolecule", "mjohnson541"))
copy!(solvation, pyimport_conda("molecule.data.solvation", "rmgmolecule", "mjohnson541"))
copy!(fragment, pyimport_conda("molecule.molecule.fragment", "rmgmolecule", "mjohnson541"))
molecule[] = pyimport("molecule.molecule")
chemkin[] = pyimport("molecule.chemkin")
species[] = pyimport("molecule.species")
reaction[] = pyimport("molecule.reaction")
nasa[] = pyimport("molecule.thermo.nasa")
wilhoit[] = pyimport("molecule.thermo.wilhoit")
arrhenius[] = pyimport("molecule.kinetics.arrhenius")
falloff[] = pyimport("molecule.kinetics.falloff")
chebyshev[] = pyimport("molecule.kinetics.chebyshev")
solvation[] = pyimport("molecule.data.solvation")
fragment[] = pyimport("molecule.molecule.fragment")
end
copy!(pydot, pyimport_conda("pydot", "pydot"))
copy!(os, pyimport_conda("os", "os"))
pydot[] = pyimport("pydot")
os[] = pyimport("os")
end
include("Constants.jl")
include("Tools.jl")
Expand Down

0 comments on commit 1997ef9

Please sign in to comment.