[Corrupted] Changing the anion/cation proportion in a mixture (4K)
Channel: Nils Berglund
Date: 2023-12-14

For a few days, I am going to release both a more and a less compressed version of videos. This is in order to test the working hypothesis that videos compressed as the last step before upload do survive YT re-encoding, while the less compressed get corrupted after a while. The more compressed versions are labeled 4K, crf 28.
This version became corrupted approximately 24 hours after release. Please watch instead the version https://youtu.be/ozG8KNuKq7s

This video shows a mixture of negatively charged anions and positively charged cations, in which the proportion of anions changes in the course of the simulation from 10% to 90%. While this does not seem quite physical, one could imagine some process involving radioactive decay to realize such a scenario. I made this simulation to find out how the anion/cation ratio influences the clustering properties of the mixture. 
The smaller particles, shown in blue in the first part of the video, represent anions, while the larger particles, shown in red and marked with a +, represent cations. The charge of each cation is the opposite of the charge of two anions, and its mass is 1.5 times as large. The particles interact via a Coulomb potential, and in addition, there is a Lennard-Jones type repulsion between anions and cations, in order to avoid their collapse on a single point. This is a simplification of what happens in real systems, but there is indeed an effective repulsion due to quantum effects. 
There is a constant electric field directed to the right, which pulls cations to the right and anions to the left. There are cylindrical boundary conditions, and a thermostat maintains the velocity distribution of the system in a Boltzmann-Gibbs distribution of decreasing temperature. 
This simulation has two parts, showing the evolution with two different color schemes:
Charge density: 0:00
Kinetic energy: 1:56
In the first part, the particles' color depends on their type (anions are blue, cations are red), while the background indicates the charge density, slightly averaged over space and time. In the second part, it depends on their kinetic energy (mass times speed squared, divided by 2). 
To save on computation time, particles are placed into a "hash grid", each cell of which contains between 3 and 10 particles. Then only the influence of other particles in the same or neighboring cells is taken into account for each particle. 
The temperature is controlled by a thermostat, implemented here with the "Nosé-Hoover-Langevin" algorithm introduced by Ben Leimkuhler,  Emad Noorizadeh and Florian Theil, see reference below. The idea of the algorithm is to couple the momenta of the system to a single random process, which fluctuates around a temperature-dependent mean value. Lower temperatures lead to lower mean values. 
The Lennard-Jones potential is strongly repulsive at short distance, and mildly attracting at long distance. It is widely used as a simple yet realistic model for the motion of electrically neutral molecules. The force results from the repulsion between electrons due to Pauli's exclusion principle, while the attractive part is a more subtle effect appearing in a multipole expansion. For more details, see https://en.wikipedia.org/wiki/Lennard-Jones_potential

Render time: 10 minutes 20 seconds
Color scheme: Part 1 and particles in Part 2 - Turbo, by Anton Mikhailov
https://gist.github.com/mikhailov-work/6a308c20e494d9e0ccc29036b28faa7a
Background in Part 2 - Twilight by Bastian Bechtold
https://github.com/bastibe/twilight

Music: "Delta Wave" by Asher Fulero@AsherFulero

Reference: Leimkuhler, B., Noorizadeh, E. & Theil, F. A Gentle Stochastic Thermostat for Molecular Dynamics. J Stat Phys 135, 261–277 (2009). https://doi.org/10.1007/s10955-009-9734-0
http://www.maths.warwick.ac.uk/~theil/HL12-3-2009.pdf

Current version of the C code used to make these animations: 
https://github.com/nilsberglund-orleans/YouTube-simulations
https://www.idpoisson.fr/berglund/software.html
Some outreach articles on mathematics:
https://images.math.cnrs.fr/_Berglund-Nils-1343_.html
(in French, some with a Spanish translation)

#molecular_dynamics #ions