Python for Physics: Animating Interacting Particles

preview_player
Показать описание
In this video, we simulate and animate particles interacting in a Lennard-Jones potential in Python using periodic boundary conditions. At each time step, we integrate the equations of motion for the particles using a popular molecular dynamics algorithm: the velocity Verlet algorithm. We use the simulation data to animate the trajectories of the particles using matplotlib.

0:00 Introduction
1:14 The Lennard-Jones potential
3:04 Initial conditions
4:16 Force and periodic boundary conditions
8:20 Equation of motion and integration
14:42 Running the simulation
15:27 Conservation of energy and velocity distribution
17:15 Animation
Рекомендации по теме
Комментарии
Автор

Thanks !! I just start to learn about computational physics and my first personal project is about molecular dynamics. I have so much difficulties to figure out a bunch of things. You just save my week 😂. It's so clear !!. You won a new suscriber !!!

Loisloui
Автор

talking about efficiency. You're calling the function force twice with the same parameters to calculate the contributions to the force on i and j at about the 11:16 time stamp, making use of Newton's third law.
Is it more efficient to call the function twice or call it once, store the value in a variable and use the variable twice? I guess I could just make a copy of the get_forces function, have one copy of the two function calls of force and one copy where I store the return value in a variable and just time both function calls to find out which way is more efficient.

marcrindermann
visit shbcf.ru