def non_modal_frac_melt(Co, Do, F, P):
    """
    non_modal_frac_melt calculates the composition of a trace element in a melt produced from non modal
    fractional melting of a source rock as described by Rollinson 1993 Eq. 4.13 and 4.14.
        Inputs:
        Co = Concentration of trace element in the original solid
        Do = Bulk distribution coefficient for element when F = 0
        F = Fraction of original solid melted (fraction of melt)
        P = Bulk distribution coefficient of melting mineral assemblage

        Returns:
        Cl = concentration in the extracted liquid. This is different from the 
        concentration of the instantaneous liquid.
        Cs = concentration in the residual solid

    Note: if Do and P are the same, then you effectively have modal fractional melting
    """

    Cl = (Co / F) * (1 - (1 - F * (P / Do)) ** (1 / P))

    return Cl