Fast method for force computations in electronic structure calculations