# What XCint does¶

XCint integrates the exchange-correlation (XC) energy $$E_\text{xc}$$ and the elements of the XC potential matrix $$V_\text{xc}$$, as well as their derivatives with respect to electric field and/or geometric perturbations. The integration is performed on a standard numerical grid.

Before the XC energy can be computed, we require the densities. This is done in two steps:

$n_b = \sum_k \chi_{kb} \sum_l D_{kl} \chi_{lb} = \sum_k \chi_{kb} X_{kb}$
$X_{kb} = \sum_l D_{kl} \chi_{lb}$

Then the XC energy is computed using the XC energy density $$\epsilon_\text{xc}$$ evaluated with the help of XCFun:

$E_\text{xc} = \sum_b w_b \epsilon_\text{xc} (n_b)$

A similar strategy is used to compute $$V_\text{xc}$$ matrix elements, again in two steps:

$(V_\text{xc})_{kl} = \sum_b w_b \chi_{kb} v_\text{xc} (n_b) \chi_{lb} = \sum_b W_{kb} \chi_{lb}$
$W_{kb} = w_b \chi_{kb} v_\text{xc} (n_b)$

Note that XCFun is called only once and returns $$\epsilon_\text{xc}$$ and $$v_\text{xc}$$ in one go.

In the above scheme we work with batches of points in order to exploit vectorization and screening, making use of BLAS level 3 libraries to compute $$X_{kb}$$ and $$(V_\text{xc})_{kl}$$.