Calculation method for the inhomogeneous electron gas