How to write your own DFT code

As a computational scientist, we are used to use other people’s code (e.g. Quantum Espresso, VASP, etc.), but we are seldomly told to learn how to write the DFT code by ourselves. So the purpose of this article is to show the fundamental theory and the practical knowledge about how to write a DFT code yourselves.