Skip to content

Commit 05483eb

Browse files
set the built module for the functions to fix precompilation
1 parent a3f4362 commit 05483eb

File tree

6 files changed

+32
-25
lines changed

6 files changed

+32
-25
lines changed

lib/JumpProblemLibrary/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "JumpProblemLibrary"
22
uuid = "faf0f6d7-8cee-47cb-b27c-1eb80cef534e"
3-
version = "0.1.1"
3+
version = "0.1.2"
44

55
[deps]
66
Catalyst = "479239e8-5488-4da2-87a7-35f2df7eef83"

lib/JumpProblemLibrary/src/JumpProblemLibrary.jl

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ end k1 k2 k3 k4 k5 k6
4040
rates = [0.5, (20 * log(2.0) / 120.0), (log(2.0) / 120.0), (log(2.0) / 600.0), 0.025, 1.0]
4141
tf = 1000.0
4242
u0 = [1, 0, 0, 0]
43-
prob = DiscreteProblem(dna_rs, u0, (0.0, tf), rates)
43+
prob = DiscreteProblem(dna_rs, u0, (0.0, tf), rates, eval_module = @__MODULE__)
4444
Nsims = 8000
4545
expected_avg = 5.926553750000000e+02
4646
prob_data = Dict("num_sims_for_mean" => Nsims, "expected_mean" => expected_avg)
4747
"""
4848
DNA negative feedback autoregulatory model. Protein acts as repressor.
4949
"""
50-
prob_jump_dnarepressor = JumpProblemNetwork(dna_rs, rates, tf, u0, prob, prob_data)
50+
prob_jump_dnarepressor = JumpProblemNetwork(dna_rs, rates, tf, u0, prob, prob_data,
51+
eval_module = @__MODULE__)
5152

5253
bd_rs = @reaction_network begin
5354
k1, 0 --> A
@@ -56,14 +57,15 @@ end k1 k2
5657
rates = [1000.0, 10.0]
5758
tf = 1.0
5859
u0 = [0]
59-
prob = DiscreteProblem(bd_rs, u0, (0.0, tf), rates)
60+
prob = DiscreteProblem(bd_rs, u0, (0.0, tf), rates, eval_module = @__MODULE__)
6061
Nsims = 16000
6162
expected_avg = t -> rates[1] / rates[2] .* (1.0 - exp.(-rates[2] * t))
6263
prob_data = Dict("num_sims_for_mean" => Nsims, "expected_mean_at_t" => expected_avg)
6364
"""
6465
Simple birth-death process with constant production and degradation.
6566
"""
66-
prob_jump_constproduct = JumpProblemNetwork(bd_rs, rates, tf, u0, prob, prob_data)
67+
prob_jump_constproduct = JumpProblemNetwork(bd_rs, rates, tf, u0, prob, prob_data,
68+
eval_module = @__MODULE__)
6769

6870
nonlin_rs = @reaction_network begin
6971
k1, 2A --> B
@@ -75,14 +77,15 @@ end k1 k2 k3 k4 k5
7577
rates = [1.0, 2.0, 0.5, 0.75, 0.25]
7678
tf = 0.01
7779
u0 = [200, 100, 150]
78-
prob = DiscreteProblem(nonlin_rs, u0, (0.0, tf), rates)
80+
prob = DiscreteProblem(nonlin_rs, u0, (0.0, tf), rates, eval_module = @__MODULE__)
7981
Nsims = 32000
8082
expected_avg = 84.876015624999994
8183
prob_data = Dict("num_sims_for_mean" => Nsims, "expected_mean" => expected_avg)
8284
"""
8385
Example with a mix of nonlinear reactions, including third order
8486
"""
85-
prob_jump_nonlinrxs = JumpProblemNetwork(nonlin_rs, rates, tf, u0, prob, prob_data)
87+
prob_jump_nonlinrxs = JumpProblemNetwork(nonlin_rs, rates, tf, u0, prob, prob_data,
88+
eval_module = @__MODULE__)
8689

8790
oscil_rs = @reaction_network begin
8891
0.01, (X, Y, Z) --> 0
@@ -98,11 +101,12 @@ oscil_rs = @reaction_network begin
98101
end
99102
u0 = [200.0, 60.0, 120.0, 100.0, 50.0, 50.0, 50.0] # Hill equations force use of floats!
100103
tf = 4000.0
101-
prob = DiscreteProblem(oscil_rs, u0, (0.0, tf))
104+
prob = DiscreteProblem(oscil_rs, u0, (0.0, tf), eval_module = @__MODULE__)
102105
"""
103106
Oscillatory system, uses a mixture of jump types.
104107
"""
105-
prob_jump_osc_mixed_jumptypes = JumpProblemNetwork(oscil_rs, nothing, tf, u0, prob, nothing)
108+
prob_jump_osc_mixed_jumptypes = JumpProblemNetwork(oscil_rs, nothing, tf, u0, prob, nothing,
109+
eval_module = @__MODULE__)
106110

107111
specs_sym_to_name = Dict(:S1 => "R(a,l)",
108112
:S2 => "L(r)",
@@ -144,7 +148,7 @@ u0[findfirst(isequal(:S1), statesyms)] = params[1]
144148
u0[findfirst(isequal(:S2), statesyms)] = params[2]
145149
u0[findfirst(isequal(:S3), statesyms)] = params[3]
146150
tf = 100.0
147-
prob = DiscreteProblem(rs, u0, (0.0, tf), rates)
151+
prob = DiscreteProblem(rs, u0, (0.0, tf), rates, eval_module = @__MODULE__)
148152
"""
149153
Multistate model from Gupta and Mendes,
150154
"An Overview of Network-Based and -Free Approaches for Stochastic Simulation of Biochemical Systems",
@@ -154,7 +158,8 @@ prob = DiscreteProblem(rs, u0, (0.0, tf), rates)
154158
prob_jump_multistate = JumpProblemNetwork(rs, rates, tf, u0, prob,
155159
Dict("specs_to_sym_name" => specs_sym_to_name,
156160
"rates_sym_to_idx" => rates_sym_to_idx,
157-
"params" => params))
161+
"params" => params),
162+
eval_module = @__MODULE__)
158163

159164
# generate the network
160165
N = 10 # number of genes
@@ -206,13 +211,14 @@ for i in 1:(2 * N)
206211
u0[findfirst(isequal(G[i]), states(rs))] = 1
207212
end
208213
tf = 2000.0
209-
prob = DiscreteProblem(rs, u0, (0.0, tf))
214+
prob = DiscreteProblem(rs, u0, (0.0, tf), eval_module = @__MODULE__)
210215
"""
211216
Twenty-gene model from McCollum et al,
212217
"The sorting direct method for stochastic simulation of biochemical systems with varying reaction execution behavior"
213218
Comp. Bio. and Chem., 30, pg. 39-49 (2006).
214219
"""
215-
prob_jump_twentygenes = JumpProblemNetwork(rs, nothing, tf, u0, prob, nothing)
220+
prob_jump_twentygenes = JumpProblemNetwork(rs, nothing, tf, u0, prob, nothing,
221+
eval_module = @__MODULE__)
216222

217223
rn = @reaction_network begin
218224
c1, G --> G + M
@@ -228,15 +234,16 @@ rnpar = [0.09, 0.05, 0.001, 0.0009, 0.00001, 0.0005, 0.005, 0.9]
228234
varlabels = ["G", "M", "P", "P2", "P2G"]
229235
u0 = [1000, 0, 0, 0, 0]
230236
tf = 4000.0
231-
prob = DiscreteProblem(rn, u0, (0.0, tf), rnpar)
237+
prob = DiscreteProblem(rn, u0, (0.0, tf), rnpar, eval_module = @__MODULE__)
232238
"""
233239
Negative feedback autoregulatory gene expression model. Dimer is the repressor.
234240
Taken from Marchetti, Priami and Thanh,
235241
"Simulation Algorithms for Comptuational Systems Biology",
236242
Springer (2017).
237243
"""
238244
prob_jump_dnadimer_repressor = JumpProblemNetwork(rn, rnpar, tf, u0, prob,
239-
Dict("specs_names" => varlabels))
245+
Dict("specs_names" => varlabels),
246+
eval_module = @__MODULE__)
240247

241248
# diffusion model
242249
function getDiffNetwork(N)
@@ -265,6 +272,6 @@ tf = 10.0
265272
u0 is a similar function that returns the initial condition vector.
266273
"""
267274
prob_jump_diffnetwork = JumpProblemNetwork(getDiffNetwork, params, tf, getDiffu0, nothing,
268-
nothing)
275+
nothing, eval_module = @__MODULE__)
269276

270277
end # module

lib/ODEProblemLibrary/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ODEProblemLibrary"
22
uuid = "fdc4e326-1af4-4b90-96e7-779fcce2daa5"
3-
version = "0.1.1"
3+
version = "0.1.2"
44

55
[deps]
66
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"

lib/ODEProblemLibrary/src/ode_simple_nonlinear_prob.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ D = Differential(t)
5555
eqs = [D(y) ~ μ * ((1 - x^2) * y - x),
5656
D(x) ~ y]
5757
de = ODESystem(eqs; name = :van_der_pol)
58-
van = ODEFunction(de, [y, x], [μ], jac = true)
58+
van = ODEFunction(de, [y, x], [μ], jac = true, eval_module = @__MODULE__)
5959

6060
"""
6161
Van der Pol Equations
@@ -97,7 +97,7 @@ eqs = [D(y₁) ~ -k₁ * y₁ + k₃ * y₂ * y₃,
9797
D(y₂) ~ k₁ * y₁ - k₂ * y₂^2 - k₃ * y₂ * y₃,
9898
D(y₃) ~ k₂ * y₂^2]
9999
de = ODESystem(eqs; name = :rober)
100-
rober = ODEFunction(de, [y₁, y₂, y₃], [k₁, k₂, k₃], jac = true)
100+
rober = ODEFunction(de, [y₁, y₂, y₃], [k₁, k₂, k₃], jac = true, eval_module = @__MODULE__)
101101

102102
"""
103103
The Robertson biochemical reactions: (Stiff)
@@ -178,7 +178,7 @@ eqs = [D(y₁) ~ I₁ * y₂ * y₃,
178178
D(y₂) ~ I₂ * y₁ * y₃,
179179
D(y₃) ~ I₃ * y₁ * y₂]
180180
de = ODESystem(eqs; name = :rigid_body)
181-
rigid = ODEFunction(de, [y₁, y₂, y₃], [I₁, I₂, I₃], jac = true)
181+
rigid = ODEFunction(de, [y₁, y₂, y₃], [I₁, I₂, I₃], jac = true, eval_module = @__MODULE__)
182182

183183
"""
184184
Rigid Body Equations (Non-stiff)
@@ -372,7 +372,7 @@ u0[8] = 0.0057
372372
"""
373373
Hires Problem (Stiff)
374374
375-
It is in the form of
375+
It is in the form of
376376
377377
```math
378378
\\frac{dy}{dt} = f(y)
@@ -388,7 +388,7 @@ where ``f`` is defined by
388388
389389
``f(y) = \\begin{pmatrix} −1.71y_1 & +0.43y_2 & +8.32y_3 & +0.0007y_4 & \\\\ 1.71y_1 & −8.75y_2 & & & \\\\ −10.03y_3 & +0.43y_4 & +0.035y_5 & & \\\\ 8.32y_2 & +1.71y_3 & −1.12y_4 & & \\\\ −1.745y_5 & +0.43y_6 & +0.43y_7 & & \\\\ −280y_6y_8 & +0.69y_4 & +1.71y_5 & −0.43y_6 & +0.69y_7 \\\\ 280y_6y_8 & −1.81y_7 & & & \\\\ −280y_6y_8 & +1.81y_7 & & & \\end{pmatrix}``
390390
391-
Reference: [demohires.pdf](http://www.radford.edu/~thompson/vodef90web/problems/demosnodislin/Demos_Pitagora/DemoHires/demohires.pdf)
391+
Reference: [demohires.pdf](http://www.radford.edu/~thompson/vodef90web/problems/demosnodislin/Demos_Pitagora/DemoHires/demohires.pdf)
392392
Notebook: [Hires.ipynb](http://nbviewer.jupyter.org/github/JuliaDiffEq/DiffEqBenchmarks.jl/blob/master/StiffODE/Hires.ipynb)
393393
"""
394394
prob_ode_hires = ODEProblem(hires, u0, (0.0, 321.8122),
@@ -404,7 +404,7 @@ eqs = [D(y1) ~ p1 * (y2 + y1 * (1 - p2 * y1 - y2)),
404404
D(y3) ~ p3 * (y1 - y3)]
405405
de = ODESystem(eqs; name = :orego)
406406
jac = calculate_jacobian(de)
407-
orego = ODEFunction(de, [y1, y2, y3], [p1, p2, p3], jac = true)
407+
orego = ODEFunction(de, [y1, y2, y3], [p1, p2, p3], jac = true, eval_module = @__MODULE__)
408408

409409
"""
410410
Orego Problem (Stiff)

lib/SDEProblemLibrary/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "SDEProblemLibrary"
22
uuid = "c72e72a9-a271-4b2b-8966-303ed956772e"
3-
version = "0.1.1"
3+
version = "0.1.2"
44

55
[deps]
66
Catalyst = "479239e8-5488-4da2-87a7-35f2df7eef83"

lib/SDEProblemLibrary/src/SDEProblemLibrary.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,6 @@ p = (0.01, 3.0, 3.0, 4.5, 2.0, 15.0, 20.0, 0.005, 0.01, 0.05)
506506
An oscillatory chemical reaction system
507507
"""
508508
prob_sde_oscilreact = SDEProblem(network, [200.0, 60.0, 120.0, 100.0, 50.0, 50.0, 50.0],
509-
(0.0, 4000.0), p)
509+
(0.0, 4000.0), p, eval_module = @__MODULE__)
510510

511511
end # module

0 commit comments

Comments
 (0)