A general method to obtain well localized Wannier functions for composite energy bands in linear combination of atomic orbital periodic calculations