1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/ReCo.jl.git synced 2025-09-02 09:02:35 +00:00

Fixed graphics

This commit is contained in:
Mo8it 2022-01-29 14:32:04 +01:00
parent e8faf811f1
commit f4d47c7d2d
15 changed files with 442 additions and 365 deletions

View file

@ -9,7 +9,7 @@ using ProgressMeter: ProgressMeter
using ReCo: ReCo
includet("../graphics/common_CairoMakie.jl")
includet("../src/Visualization/common_CairoMakie.jl")
# IMPORTANT: Disable the periodic boundary conditions
# The arguments types have to match for the function to be overwritten!
@ -35,10 +35,11 @@ function msd_simulation(
half_box_len::Float64,
T::Float64,
snapshot_at::Float64,
parent_dir::String,
parent_dir::String;
comment::String="",
seed::Int64=42,
)
Random.seed!(42)
Random.seed!(seed)
dir = ReCo.init_sim(;
n_particles=1,
@ -76,7 +77,7 @@ function mean_squared_displacement(;
parent_dir = main_parent_dir * "/$v₀"
Threads.@threads for sim_ind in 1:n_simulations
dir = msd_simulation(v₀, half_box_len, T, 0.5, parent_dir, "$sim_ind")
dir = msd_simulation(v₀, half_box_len, T, 0.5, parent_dir; comment="$sim_ind")
sim_dirs[sim_ind, v₀_ind] = dir
@ -172,10 +173,8 @@ function run_msd_analysis()
end
function plot_random_walk(; T::Float64, v₀::Float64, seed::Int64)
Random.seed!(seed)
half_box_len = max_possible_displacement(T, v₀)
dir = msd_simulation(v₀, half_box_len, T, 8.0, "random_walk_$(Dates.now())")
dir = msd_simulation(v₀, half_box_len, T, 8.0, "random_walk_$(Dates.now())"; seed=seed)
ts = Float64[]
cs = SVector{2,Float64}[]
@ -209,12 +208,14 @@ function plot_random_walk(; T::Float64, v₀::Float64, seed::Int64)
end_point_plot = scatter!(ax, cs[end]; markersize=marker_size, color=:red)
expected_mean_squared_displacement_plot = poly!(
expected_mean_squared_displacement_plot = arc!(
ax,
Circle(Point2(0.0, 0.0), expected_mean_displacement);
strokecolor=:orange,
strokewidth=1,
color=RGBAf(0.0, 0.0, 0.0, 0.0),
Point2(0.0, 0.0),
expected_mean_displacement,
0,
2 * π;
color=:orange,
linewidth=1,
)
Legend(

View file

@ -9,7 +9,7 @@ using Random: Random
using ReCo: ReCo
includet("../../graphics/common_CairoMakie.jl")
includet("../../src/Visualization/common_CairoMakie.jl")
function radial_distribution_simulation(;
n_particles::Int64, v₀s::NTuple{N,Float64}, T::Float64, packing_ratio::Float64