# ChargedParticles Example Seems Too Boring as an Example of NBodySimulator - Am I doing something wrong?

**URL:** <https://discourse.julialang.org/t/chargedparticles-example-seems-too-boring-as-an-example-of-nbodysimulator-am-i-doing-something-wrong/69439>\
**Category:** Modelling & Simulations\
**Tags:** sciml\
**Created:** [October 8, 2021, 2:59pm UTC](https://discourse.julialang.org/t/chargedparticles-example-seems-too-boring-as-an-example-of-nbodysimulator-am-i-doing-something-wrong/69439 "2021-10-08T14:59:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Fleischhacker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adam_fleischhacker/32/24468_2.png) [@Adam\_Fleischhacker](https://discourse.julialang.org/u/Adam_Fleischhacker)\
**Post date:** [October 8, 2021, 2:59pm UTC](https://discourse.julialang.org/t/chargedparticles-example-seems-too-boring-as-an-example-of-nbodysimulator-am-i-doing-something-wrong/69439/1 "2021-10-08T14:59:42Z")

</div>

I am using the NBodySimulator.jl package and trying to understand it to model “blue-noise sampling” (see here if interested: [Blue noise sampling using an N-body simulation-based method | SpringerLink](https://link.springer.com/article/10.1007/s00371-017-1382-9)).

I am swimming out of my depths a bit, but feel that if I see a “charged particles” example that does something, that would aid my understanding. Running the documented example from the documentation ([link here](https://github.com/SciML/NBodySimulator.jl#electrostatic-interaction)) reproduced below with my choice for coulomb’s constant, k:

```julia
using NBodySimulator
using StaticArrays
using Plots

## I supplied k - is it wrong
k = 8.987551787368177e9
r = 100.0 # m
q1 = 1e-3 # C
q2 = -1e-3 # C
m1 = 100.0 # kg
m2 = 0.1 # kg
v2 = sqrt(abs(k * q1 * q2 / m2 / r)) # m/s - using the centrifugal acceleration
t = 2 * pi * r / v2 # s - for one rotation
p1 = ChargedParticle(SVector(0.0, 0.0, 0.0), SVector(0.0, 0, 0.0), m1, q1)
p2 = ChargedParticle(SVector(100.0, 0.0, 0.0), SVector(0.0, v2, 0.0), m2, q2)
system = ChargedParticles([p1, p2], k)
simulation = NBodySimulation(system, (0.0, t))
sim_result = run_simulation(simulation)

plot(sim_result) ## plot seems too boring

```

the plot does not show anything happening. The points/particles just sit there being all boring-like without any path trace shown:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/8/18b3a5913861638a586bc7fd14d5e12b1664e9d0.png)

Is there something I am doing wrong or something I can adjust to at least see a movement path of some kind? I would think the particles might move towards one another since they are oppositely charged.

---

<div class="post-metadata">

**Author:** ![Adam\_Fleischhacker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adam_fleischhacker/32/24468_2.png) [@Adam\_Fleischhacker](https://discourse.julialang.org/u/Adam_Fleischhacker)\
**Post date:** [October 8, 2021, 3:43pm UTC](https://discourse.julialang.org/t/chargedparticles-example-seems-too-boring-as-an-example-of-nbodysimulator-am-i-doing-something-wrong/69439/2 "2021-10-08T15:43:29Z")

</div>

I got some kind help suggesting using animate instead of plot. Now I can see the dynamics much better.

```julia
animate(sim_result, "path_to_animated_particles.gif", fps = 120,xlims=(-150,150),ylims=(-150,150))

```

![path_to_animated_particles](https://global.discourse-cdn.com/julialang/original/3X/f/3/f3773c1b3997e8e3b56c52577d8c15961477aead.gif)

I guess plot does not show the trace path as it does for some other examples. Thx for the help!!
