Note
Go to the end to download the full example code.
Active particles
Simple implementation of non-interacting active particles.

0%| | 0/10.0 [00:00<?, ?it/s]
Initializing: 0%| | 0/10.0 [00:00<?, ?it/s]
0%| | 0/10.0 [00:00<?, ?it/s]
10%|█ | 1.0/10.0 [00:00<00:08, 1.10it/s]
20%|██ | 2.0/10.0 [00:00<00:03, 2.20it/s]
40%|████ | 4.0/10.0 [00:00<00:01, 4.40it/s]
40%|████ | 4.0/10.0 [00:00<00:01, 4.40it/s]
100%|██████████| 10.0/10.0 [00:00<00:00, 10.99it/s]
100%|██████████| 10.0/10.0 [00:00<00:00, 10.99it/s]
import numpy as np
import emulsim
# set up state
particle_data = np.random.uniform(0, 100, size=(10, 2))
particles = emulsim.ArrowsElement.from_position_random_direction(particle_data)
state = emulsim.State({"particles": particles})
# set up simulation
simulation = emulsim.Simulation(state)
simulation.add_actor(
"particles", emulsim.ActiveParticleActor({"rotational_diffusion": 1.0})
)
simulation.add_actor("particles", emulsim.BoxActor({"bounds": [[0, 100], [0, 100]]}))
# run simulation
result = simulation.run(t_range=10)
result.plot()
Total running time of the script: (0 minutes 0.946 seconds)