diff --git a/Project.toml b/Project.toml index 684253a..da1455e 100644 --- a/Project.toml +++ b/Project.toml @@ -11,5 +11,6 @@ LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890" ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7" ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" +ReinforcementLearning = "158674fc-8238-5cab-b5ba-03dfc80d1318" Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" diff --git a/src/run.jl b/src/run.jl index 028be9b..f57777e 100644 --- a/src/run.jl +++ b/src/run.jl @@ -1,16 +1,27 @@ function run(; N::Int64, - T::Float64, + T::Int64, v::Float64, δt::Float64=1e-5, - save_at::Float64=0.1, + snapshot_at::Float64=0.1, framerate::Int64=0, save_data::Bool=true, n_steps_before_verlet_list_update::Int64=1000, packing_ratio::Float64=0.5, 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 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) 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 @@ -67,7 +78,7 @@ function run(; T, v, δt, - save_at, + snapshot_at, framerate, n_steps_before_verlet_list_update, packing_ratio, diff --git a/src/simulation.jl b/src/simulation.jl index c387cdb..b35f897 100644 --- a/src/simulation.jl +++ b/src/simulation.jl @@ -66,7 +66,7 @@ end function simulate( args, δt::Float64, - T::Float64, + T::Int64, n_steps_before_verlet_list_update::Int64, n_steps_before_save::Int64, )