This simulation models Maxwell's demon using event-driven molecular dynamics (EDMD). Particles are hard spheres that hit each other and the boundary elastically. EDMD analytically solves the equations of motion; thus, collision energy is exactly conserved. Currently, the barrier between the two chambers separates particles by a speed threshold, but there are plans to simulate this as a mixing engine instead of a thermal engine.
See this paper for more details, specifically the MultiEvent approach.
Install numba to run this program. The program outputs both trajectories of particles in jsonl and energy statistics in a csv for the whole ensemble.