Coarse-grained description of protein internal dynamics: An optimal strategy for decomposing proteins in rigid subunits