mirror of
https://gitlab.rlp.net/mobitar/ReCo.jl.git
synced 2025-01-01 15:39:20 +00:00
Assertions
This commit is contained in:
parent
95d3d5d9af
commit
092b0438d3
3 changed files with 18 additions and 6 deletions
|
@ -11,5 +11,6 @@ LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
|
||||||
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
|
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
|
||||||
ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7"
|
ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7"
|
||||||
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
|
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
|
||||||
|
ReinforcementLearning = "158674fc-8238-5cab-b5ba-03dfc80d1318"
|
||||||
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
||||||
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
|
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
|
||||||
|
|
21
src/run.jl
21
src/run.jl
|
@ -1,16 +1,27 @@
|
||||||
function run(;
|
function run(;
|
||||||
N::Int64,
|
N::Int64,
|
||||||
T::Float64,
|
T::Int64,
|
||||||
v::Float64,
|
v::Float64,
|
||||||
δt::Float64=1e-5,
|
δt::Float64=1e-5,
|
||||||
save_at::Float64=0.1,
|
snapshot_at::Float64=0.1,
|
||||||
framerate::Int64=0,
|
framerate::Int64=0,
|
||||||
save_data::Bool=true,
|
save_data::Bool=true,
|
||||||
n_steps_before_verlet_list_update::Int64=1000,
|
n_steps_before_verlet_list_update::Int64=1000,
|
||||||
packing_ratio::Float64=0.5,
|
packing_ratio::Float64=0.5,
|
||||||
debug::Bool=false,
|
debug::Bool=false,
|
||||||
|
seed::Int64=42,
|
||||||
)
|
)
|
||||||
Random.seed!(42)
|
@assert N > 0
|
||||||
|
@assert T > 0
|
||||||
|
@assert v >= 0
|
||||||
|
@assert δt > 0
|
||||||
|
@assert snapshot_at ∉ 0.01:0.01:T
|
||||||
|
@assert framerate >= 0
|
||||||
|
@assert n_steps_before_verlet_list_update >= 0
|
||||||
|
@assert packing_ratio > 0
|
||||||
|
@assert seed > 0
|
||||||
|
|
||||||
|
Random.seed!(seed)
|
||||||
|
|
||||||
μ = 1.0
|
μ = 1.0
|
||||||
D₀ = 1.0
|
D₀ = 1.0
|
||||||
|
@ -30,7 +41,7 @@ function run(;
|
||||||
skin_r = 1.1 * (2 * v * n_steps_before_verlet_list_update * δt + 2 * interaction_r)
|
skin_r = 1.1 * (2 * v * n_steps_before_verlet_list_update * δt + 2 * interaction_r)
|
||||||
|
|
||||||
integration_steps = floor(Int64, T / δt) + 1
|
integration_steps = floor(Int64, T / δt) + 1
|
||||||
n_steps_before_save = round(Int64, save_at / δt)
|
n_steps_before_save = round(Int64, snapshot_at / δt)
|
||||||
|
|
||||||
n_frames = floor(Int64, integration_steps / n_steps_before_save) + 1
|
n_frames = floor(Int64, integration_steps / n_steps_before_save) + 1
|
||||||
|
|
||||||
|
@ -67,7 +78,7 @@ function run(;
|
||||||
T,
|
T,
|
||||||
v,
|
v,
|
||||||
δt,
|
δt,
|
||||||
save_at,
|
snapshot_at,
|
||||||
framerate,
|
framerate,
|
||||||
n_steps_before_verlet_list_update,
|
n_steps_before_verlet_list_update,
|
||||||
packing_ratio,
|
packing_ratio,
|
||||||
|
|
|
@ -66,7 +66,7 @@ end
|
||||||
function simulate(
|
function simulate(
|
||||||
args,
|
args,
|
||||||
δt::Float64,
|
δt::Float64,
|
||||||
T::Float64,
|
T::Int64,
|
||||||
n_steps_before_verlet_list_update::Int64,
|
n_steps_before_verlet_list_update::Int64,
|
||||||
n_steps_before_save::Int64,
|
n_steps_before_save::Int64,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue