A general method to obtain well localized Wannier functions for composite energy bands in LCAO periodic calculations