import itertools


def getMaxRMSD(md_ensemble):
    """Returns maximum RMSD in given ensemble."""
    max_rmsd = 0
    for x, y in itertools.combinations(md_ensemble.models, 2):
        rmsd = x.rmsd(y, ['CA'])
        if rmsd > max_rmsd:
            max_rmsd = rmsd
    return max_rmsd