@staticmethod
def _sort_interactions(all_interactions):
    """
        Returns keys in interactions sorted by (number_of_atoms, name). Keys
        with no interactions are skipped.
        """
    sort_keys = {}
    for interaction_type, interactions in all_interactions.items():
        if not interactions:
            continue
        sort_keys[interaction_type] = len(interactions[0].atoms
            ), interaction_type
    return sorted(sort_keys, key=lambda k: sort_keys[k])
