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

Stable test #259

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
32dc883
ignore automatically generated files
hwpang Jun 23, 2024
80b4828
Add channels
hwpang Jun 23, 2024
5d59536
Remove yml file as it's not used anymore, using CondaPkg to manage env
hwpang Jun 23, 2024
2300cf6
Switch to CondaPkg, PythonCall, PythonPlot
hwpang Jun 23, 2024
aef963e
Remove unused dependency
hwpang Jun 23, 2024
5653f7c
Update version
hwpang Jun 23, 2024
e0c6c4b
bump to 1.10
hwpang Jun 23, 2024
dfe380d
No need to install env beforehand
hwpang Jun 23, 2024
b9e777d
Install with CondaPkg
hwpang Jun 23, 2024
0b3e7fd
Switch to 1.10 and no need to create env
hwpang Jun 23, 2024
82e1d58
export env path for CondaPkg
hwpang Jun 23, 2024
a857031
Update build to use CondaPkg
hwpang Jun 23, 2024
1f43a40
Update installation instruction
hwpang Jun 23, 2024
db530a2
Use PythonPlot instead of PyPlot
hwpang Jun 23, 2024
9163eed
Switch to PythonPlot
hwpang Jun 23, 2024
3b0447d
Switch parsing to PythonCall and PythonPlot
hwpang Jun 23, 2024
5f572c8
Switch plotting to pythonplot
hwpang Jun 23, 2024
9ab4354
Use PythonCall syntax in module
hwpang Jun 23, 2024
1d8a45f
Don't set jacobian prototype if jacobian is not sparse
hwpang Jun 23, 2024
57164e7
Switch to pythoncall syntax in test
hwpang Jun 23, 2024
18cd0ed
Import necessary packages
hwpang Jun 23, 2024
85dd259
Use SciMLSensitivity
hwpang Jun 23, 2024
58c7094
Change rtol
hwpang Jun 23, 2024
6b8f26d
Add propane mech test file
hwpang Jun 23, 2024
e6dc131
ensure SciMLSensitivity.extract_local_sensitivities is called
mjohnson541 Jun 29, 2024
f504b7a
clean up automatic mechanism string output
mjohnson541 Jun 29, 2024
1dc9c22
adapt automatic mechanism analysis tests
mjohnson541 Jun 29, 2024
7652ec2
make compat for PythonCall and CondaPkg more specific for release
mjohnson541 Jun 29, 2024
2d07eac
move conda install to import and on test
mjohnson541 Jun 29, 2024
e597206
clean up conda installs
mjohnson541 Jun 30, 2024
dec22df
run rops and flux diagram generation in tests
mjohnson541 Jul 8, 2024
dcec0e2
decode to utf-8
mjohnson541 Jul 9, 2024
0ad13ca
0-index python objects
mjohnson541 Jul 29, 2024
6fa41f8
adapt getcolor
mjohnson541 Jul 29, 2024
564facb
avoid pydot 2.0.0
mjohnson541 Jul 9, 2024
d954221
remove CondaPkg.toml
mjohnson541 Jul 30, 2024
e4b54f8
increment version
mjohnson541 Aug 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 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
Copy link
Contributor

Choose a reason for hiding this comment

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

Can probably switch to the newest version

Suggested change
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2

with:
version: 1.8
version: '1.10'
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
Expand All @@ -24,21 +24,17 @@ 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");'
current_path=${{ github.workspace }}
export JULIA_CONDAPKG_ENV="$current_path/rms_env"
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)'
current_path=${{ github.workspace }}
export JULIA_CONDAPKG_ENV="$current_path/rms_env"
julia -e 'using Pkg; Pkg.test("ReactionMechanismSimulator"; coverage=true)'
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ 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();'
current_path=${{ github.workspace }}
export JULIA_CONDAPKG_ENV="$current_path/rms_env"
julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.build("ReactionMechanismSimulator");'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
DOCUMENTER_DEBUG: true
run: julia --color=yes --project=docs docs/make.jl
run: |
current_path=${{ github.workspace }}
export JULIA_CONDAPKG_ENV="$current_path/rms_env"
julia --color=yes --project=docs docs/make.jl
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
*.dot
docs/build/
.DS_Store
deps/build.log
deps/build.log
.CondaPkg/
rms_env/
*.cov
Manifest.toml
24 changes: 12 additions & 12 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name = "ReactionMechanismSimulator"
uuid = "c2d78dd2-25c4-5b79-bebc-be6c69dd440f"
authors = ["Matt Johnson <[email protected]>", "Hao-Wei Pang <[email protected]>"]
version = "1.0.0"
version = "1.0.1"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Expand All @@ -17,12 +17,13 @@ IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
LsqFit = "2fda8390-95c7-5789-9bda-21331edee243"
MicroMamba = "0b3b1443-0f03-428d-bdfb-f27f9c1191ea"
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 @@ -39,31 +40,31 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
CSV = "0.10"
Calculus = "0.4,0.5"
Colors = "0.11,0.12"
Conda = "1"
CSV = "0.10"
CondaPkg = "0.2"
DataFrames = "1"
SciMLSensitivity = "^7"
FastGaussQuadrature = "0.5"
ForwardDiff = "0.10"
Images = "0.24"
IncompleteLU = "0.2"
IterTools = "1.3"
LsqFit = "0.12"
MicroMamba = "0.1"
ModelingToolkit = "8"
OrdinaryDiffEq = "^6"
Parameters = "0.12"
PreallocationTools = "0.4"
PyCall = "1"
PyPlot = "2"
PythonCall = "0.9"
PythonPlot = "1"
QuartzImageIO = "0.7"
RecursiveArrayTools = "2.17"
ReverseDiff = "1.9"
SciMLBase = "^1"
SciMLSensitivity = "^7"
SmoothingSplines = "0.3"
SpecialFunctions = "1"
StaticArrays = "1"
Expand All @@ -72,5 +73,4 @@ Symbolics = "4"
Tracker = "0.2"
Unitful = "^1.3"
YAML = "0.4"
Zygote = "0.5,0.6"
julia = "^1.6"
21 changes: 0 additions & 21 deletions deps/build.jl

This file was deleted.

11 changes: 6 additions & 5 deletions docs/src/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ The above instructions will automatically handle Julia-Python linking. However,

```
import Pkg
Pkg.add("PyCall")
ENV["CONDA_JL_HOME"] = PATH_TO_YOUR_ENV
Pkg.build("Conda")
ENV["PYTHON"] = PATH_TO_PYTHON
Pkg.build("PyCall")
ENV["JULIA_CONDAPKG_BACKEND"] = "Null"
ENV["JULIA_PYTHONCALL_EXE"] = "/path/to/python"
Pkg.add("CondaPkg")
Pkg.build("CondaPkg")
Pkg.add("PythonCall")
Pkg.build("PythonCall")
Comment on lines -40 to +45
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also make sure this part is up to date with what you change?

```
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
18 changes: 15 additions & 3 deletions src/AutomaticMechanismAnalysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -665,16 +665,28 @@ function getrxnanalysisstring(sim,ra;branchingcutoff=1e-2,branchfract=0.01)
s *= "Associated key reaction path in $spname loss direction \n"
for i = 1:length(rp.rxninds)
rstr = getrxnstr(sim.reactions[rp.rxninds[i]])
sgn = rp.spcsinds[i+1] in sim.reactions[rp.rxninds[i]].productinds
if sgn
sn = "+"
else
sn = "-"
end
br = round(rp.branchfracts[i],sigdigits=6)
s *= "$rstr at path branching of $br \n"
s *= "$rstr ($sn) at path branching of $br \n"
end
else
s *= "Associated key reaction path in $spname production direction \n"
revinds = reverse(rp.rxninds)
for i = 1:length(rp.rxninds)
rstr = getrxnstr(sim.reactions[revinds[i]])
sgn = rp.spcsinds[i+1] in sim.reactions[rp.rxninds[i]].productinds
if sgn
sn = "+"
else
sn = "-"
end
br = round(rp.branchfracts[i],sigdigits=6)
s *= "$rstr at path step branching of $br \n"
s *= "$rstr ($sn) at path step branching of $br \n"
end
end
s *= "\n"
Expand All @@ -684,7 +696,7 @@ function getrxnanalysisstring(sim,ra;branchingcutoff=1e-2,branchfract=0.01)
for i = 1:length(ra.clusterprodlossfracts)
if abs(ra.clusterprodlossfracts[i]) > branchfract
cluster = ra.clusternames[i]
fract = abs(ra.clusterprodlossfracts[i])
fract = round(abs(ra.clusterprodlossfracts[i]),sigdigits=6)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fract = round(abs(ra.clusterprodlossfracts[i]),sigdigits=6)
fract = round(abs(ra.clusterprodlossfracts[i]), sigdigits=6)

if ra.clusterprodlossfracts[i] > 0
s *= "Reaction accounts for $fract of the net production for cluster $cluster \n"
else
Expand Down
14 changes: 7 additions & 7 deletions 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 Expand Up @@ -131,7 +131,7 @@ function getatomdictfromrdkit(mol)
atmD = Dict{String,Int64}()
molecularweight = 0.0
for atm in mol.GetAtoms()
v = elementdict[atm.GetAtomicNum()]
v = elementdict[PythonCall.pyconvert(Int64, atm.GetAtomicNum())]
if v in keys(atmD)
atmD[v] += 1
else
Expand All @@ -140,9 +140,9 @@ function getatomdictfromrdkit(mol)
end
nbonds = length(mol.GetBonds())
try
molecularweight = Desc.MolWt(mol)/1000.0
catch
@warn("unable to compute molecular weight")
molecularweight = PythonCall.pyconvert(Float64, Desc.MolWt(mol)) / 1000.0
catch e
@warn("unable to compute molecular weight: $e")
end
return atmD,nbonds,molecularweight
end
Expand All @@ -151,15 +151,15 @@ export getatomdictfromrdkit
function getatomdictfromrmg(mol)
atmD = Dict{String,Int64}()
for atm in mol.atoms
v = elementdict[atm.element.number]
v = elementdict[PythonCall.pyconvert(Int64, atm.element.number)]
if v in keys(atmD)
atmD[v] += 1
else
atmD[v] = 1
end
end
nbonds = length(mol.get_all_edges())
molecularweight = mol.get_molecular_weight()
molecularweight = PythonCall.pyconvert(Float64, mol.get_molecular_weight())
return atmD,nbonds,molecularweight
end
function getatomdictsmiles(smiles)
Expand Down
Loading
Loading