The problem becomes a matter of defining the ℎ ̂𝐾𝑆 operator using a density then solving the resulting equation (eq. 6) with an eigenvalue solver to self-consistency. A discussion of how to obtain each term of ℎ ̂𝐾𝑆 is described in detail in the notebook, including the finite-difference 61,62 representation of kinetic energy, LDA exchange, Chachiyo's simple equation for LDA correlation, 66,67 PBE exchange, and so on. DFT codes typically perform numerical integrations on a discrete grid. The approach used here is actually to use a 3D real-space mesh as the basis, instead of coding overlap matrices between gaussian functions. This method is used by DFT codes like Octopus and RMG 69 and has the advantages of being conceptually simple and easy to impose boundary conditions (but comes with some drawbacks relating to symmetry-breaking and non-variational energy). After explaining how each term is found, the equations are combined into an interactive DFT calculator with two implemented functionals, LDA and PBE.