diff --git a/src/simulation.jl b/src/simulation.jl index f299ade..7512ecb 100644 --- a/src/simulation.jl +++ b/src/simulation.jl @@ -12,8 +12,8 @@ function update_verlet_list!(args) end for i in 1:(args.N - 1) + p1 = args.particles[i] for j in (i + 1):(args.N) - p1 = args.particles[i] p2 = args.particles[j] overlapping = are_overlapping(p1, p2, args.skin_r², args.l).overlapping @@ -29,14 +29,14 @@ end function euler!(args) for i in 1:(args.N - 1) - p = args.particles[i] - verlet_list = args.verlet_list[p.id] + p1 = args.particles[i] + verlet_list = args.verlet_list[p1.id] for j in 1:(verlet_list.last_ind) p2 = args.particles[verlet_list.v[j]] overlapping, r⃗₁₂, distance² = are_overlapping( - p, p2, args.interaction_r², args.l + p1, p2, args.interaction_r², args.l ) if overlapping @@ -45,7 +45,7 @@ function euler!(args) @turbo for k in 1:2 dc = c * r⃗₁₂[k] - p.tmp_c[k] -= dc + p1.tmp_c[k] -= dc p2.tmp_c[k] += dc end end