Numerical construction of Wannier functions for crystals