def weighting_sum(distances, cutoff, exp):

    """
       Returns generated feature.

    Parameters:
       distances (numpy array):Distances between ligand and protein atoms.
       cutoff (float): Distance cutoff.
       exp (float): Weighting exponent

    Returns:
       feature(float): Generated feature.
    """

    selected_distances = distances[distances < cutoff]

    feature = sum(list(map(lambda x: 1.0 / (x ** exp), selected_distances)))

    return feature