# How is magnetization of a solid obtained from electron density in a DFT framework?

What's the theory behind these kind of calculation? What are keywords and concepts I have to search for?

The main keyword you are looking for is the spin-polarized DFT. Other keywords that might help you are the spin-density matrix, the Hubbard model (DFT+U), the Stoner Model, von Barth-Hedin spin-polarized Kohn-Sham equation, etc.

A very good introductory resource on this topic is Ch1: Density-functional Theory of Magnetism by Gustav Bihlmayer in Handbook of Magnetism and Advanced Magnetic Materials (vol1): Fundamentals and Theory. Below I will try to summarize briefly.

The magnetization density can be written as: $$\mathbf{m(r)} = -\mu_{B} \sum_{\alpha, \beta}^{} \langle \Psi|\langle\psi_{\beta}^{\dagger}\mathbf{\sigma}_{\alpha\beta}\psi_{\alpha}|\Psi\rangle = -\mu_{B}\, \mathbf{s(r)}$$ where $$\psi_{\alpha}$$ is the field operator for an electron with spin $$\alpha$$ and $$\sigma$$ is the Pauli matrices. Notice that the magnetization density is a product of the negative of the Bohr magneton and spin density.

The key point is that the density matrix can be decomposed into two parts: a scalar particle density, and a vectorial spin density. Similarly, the potential matrix can be decomposed into a scalar potential and magnetic field, i.e.,

$$\underline{n}(\mathbf{r})=\frac{1}{2}\left( n(\mathbf{r})\underline{I} \, + \, \mathbf{\underline{\sigma}}\cdot\mathbf{s(r)} \right)$$

$$\underline{v}(\mathbf{r}) = v(\mathbf{r})\underline{\mathbf{I}} \, + \, \mu_B\,\underline{\mathbf{\sigma}}\cdot \mathbf{B(r)}$$

Then instead of using the non-spin-polarized Hohenberg-Kohn version of DFT, if we use these spin-polarized matrices, we will get a spin-polarized Kohn-Sham equation (derived by von Barth and Hedin, paper).

This type of DFT is called spin-polarized DFT. Using this, you can obtain the magnetization of solids. Different DFT codes have different ways to enable spin-polarized DFT. For example, in Quantum ESPRESSO, one needs to set nspin=2 in the &SYSTEM namelist for colinear magnetic materials. There are other advanced options too such as noncolinear magnetic materials. You can find some of the examples by searching in this SE with keywords such as "Quantum ESPRESSO LDA+U".