def _ref_potential_walls_plumed(cv, at, kappa, offset=0.0, exp=2.0, eps=1.0, upper_wall=True):
    """A reference implementation of PLUMED UPPER/LOWER_WALLS restraint for testing."""
    if upper_wall and cv <= at - offset:
        return 0.0
    elif not upper_wall and cv >= at - offset:
        return 0.0
    dist = cv - at + offset
    if not upper_wall:
        dist = -dist
    return kappa * (dist / eps)**exp