Text this: Energetic formulation of the subgroup commutativity degree