Uchiyama model in box

import Pkg
Pkg.add(url="https://github.com/pnavaro/Uchiyama.jl")
     Cloning git-repo `https://github.com/pnavaro/Uchiyama.jl`
    Updating git-repo `https://github.com/pnavaro/Uchiyama.jl`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `~/work/Uchiyama.jl/Uchiyama.jl/docs/Project.toml`
  [f1e6e184] ~ Uchiyama v0.1.0 `~/work/Uchiyama.jl/Uchiyama.jl` ⇒ v0.1.0 `https://github.com/pnavaro/Uchiyama.jl#master` [loaded: `/home/runner/work/Uchiyama.jl/Uchiyama.jl/src/Uchiyama.jl` (v0.1.0) expected `/home/runner/.julia/packages/Uchiyama/SghEa/src/Uchiyama.jl` (v0.1.0)]
    Updating `~/work/Uchiyama.jl/Uchiyama.jl/docs/Manifest.toml`
  [f1e6e184] ~ Uchiyama v0.1.0 `~/work/Uchiyama.jl/Uchiyama.jl` ⇒ v0.1.0 `https://github.com/pnavaro/Uchiyama.jl#master` [loaded: `/home/runner/work/Uchiyama.jl/Uchiyama.jl/src/Uchiyama.jl` (v0.1.0) expected `/home/runner/.julia/packages/Uchiyama/SghEa/src/Uchiyama.jl` (v0.1.0)]
Precompiling packages...
    486.8 msUchiyama
  1 dependency successfully precompiled in 1 seconds. 189 already precompiled.
  1 dependency precompiled but a different version is currently loaded. Restart julia to access the new version. Otherwise, loading dependents of this package may trigger further precompilation to work with the unexpected version.
using Plots
using Random
using Uchiyama

n = 50 # number of particles
ϵ = 0.02
c = trunc(Int, 200ϵ) # marker size

rng = MersenneTwister(1234)

particles = SquareParticles(rng, n, ϵ, option = :box)
pc = ParticleCollisions(particles)
bc = BoxCollisions(particles)

steps = 1000

anim = @animate for _ in 1:steps

     dt = step!(particles, pc, bc)

     p = plot(size  = (200,200),
              xlims = (-0.5,0.5),
              ylims = (-0.5,0.5),
              grid  = false,
              axis  = nothing, framestyle= :box, legend=false, widen = false)

     scatter!( getindex.(particles.q,1) .- getindex.(particles.q,2),
               getindex.(particles.q,2) .+ getindex.(particles.q,1),
               markershape  = :square,
               markersize   = c,
               aspect_ratio = :equal)

end every 10

gif(anim, joinpath(@__DIR__, "event_driven.gif"), fps = 10)
Example block output

This page was generated using Literate.jl.