This repository contains all the necessary files to replicate the simulations and analyse the data presented in the following publication: "Self-organization of mortal filaments and its role in bacterial division ring formation" - C. Vanhille-Campos et al. (DOI: https://doi.org/10.1038/s41567-024-02597-8) See README files for details.ABSTRACT:Filaments in the cell commonly treadmill. Driven by energy consumption, they grow on one end while shrinking on the other, causing filaments to appear motile even though individual proteins remain static. This process is characteristic of cytoskeletal filaments and leads to collective filament self-organization. Here we show that treadmilling drives filament nematic ordering by dissolving misaligned filaments. Taking the bacterial FtsZ protein involved in cell division as an example, we show that this mechanism aligns FtsZ filaments in vitro and drives the formation of the division ring in living Bacillus subtilis cells. We find that ordering via local dissolution also allows the system to quickly respond to chemical and geometrical biases in the cell, enabling us to quantitatively explain the ring formation dynamics in vivo. Beyond FtsZ and other cytoskeletal filaments, our study identifies a mechanism for self-organization via constant birth and death of energy-consuming filaments.