Local field effects in semiconductors are studied through the inversion of the dielectric matrix in real space, using a Wannier function basis. The method will be useful when the translational symmetry is broken, e.g. where there are impurities, dislocations or surfaces. The method is applied to the calculation of the potential produced for a static impurity in diamond. The results show the importance of local field effects, which, in this case, appear as oscillations of the potential with the periodicity of the lattice.