You can try it here on github Pages
Usually, to deal with collisions, one integrates the equation of motion using a small timestep. A notoriously hard task is to deal with object interpenetration. Tricks must be used to supress these overlaps and the resulting dynamics is always nonphysical. Artifacts due to these corrections often prevent high densities to be reached. Here, (almost) everything is solved exactly by computing the time before the next collision happening in the system and then advancing the simulation time to this next collision + processing it. This type of algorithm is extremely fast but you pay the price of having to deal with an asynchronized evolution of events. Since every action is driven by the scheduling of an "event" (every collision in the future, every cell partitioning, every display of the screen in the game loop becomes an event), one has to implement a fast data structure able to quickly sort these events, retrieve them, delete them, reschedule them. This is achieved by a BST and a buffer/priority queue.
At full speed, and for ~2000 particles the algorithm can perform around $10^6$ collisions/sec.
For now, the project can only be compiled on linux but it should be pretty straighforward to modify it to compile on Windows. The graphical part probably only works with x11 but it's a matter of finding the good makefile :).
Use make G=1
for the algorithm with the graphical interface and make G=0
for the algorithm without a graphical interface. If you want to use the graphical interface, make sure that #define THREE_D
in first line of EDMD.c is set to 0 as the graphical interface does not work in 3D yet (and a lot of options are not yet supported in 3D).
For the graphical part: raylib
Compile and execute the ./a.out
. You can pass option in the command line such as ./a.out -N 1000 --phi 0.8
. This is particularly useful for the no-graphics mode of the program but almost useless when the graphical interface is used.
Without graphical interface the program ouputs files readable by ovito.
Everything is pure C no library.
This program was first designed without a graphical interface in mind and uses a lot of global variable. The graphical interface must not interfere in any way to the structure of the initial program. Which might partially explains some poor design choice. If it has to be redone, I would change a lot of things and encapsulate more the code. I'm still reworking the graphical part to alleviate the use of global variables.
If you want to understand the structure of an EDMD algorithm: Github repo EDMD with research article.