The wavefunctions are expanded using a basis of localised orbitals, , where

(17) |

which converts the Kohn-Sham equations into matrix equations for . A set of Gaussian functions are used, multiplied by spherical functions to set the orbital quantum number:

(18) |

The choice of *n _{1}*,

The charge density for a given spin state can then be described in
terms of the *density matrix*, *b*_{ij,s} (the total charge
density is simply the sum of the spin dependent charge densities):

Here, *s* gives the spin state and is an occupied orbital.
Substituting this expression for *n*(*r*) back into
Equation 2.4.14 is only simple for the kinetic and
pseudopotential energy terms:

However the Hartree energy requires *O*(*N ^{4}*) integral terms, and when