def cal_p_bm3(v, k, p_ref=0.0):
    """
    calculate pressure from 3rd order Birch-Murnaghan equation

    :param v: volume at different pressures
    :param k: [v0, k0, k0p]
    :param p_ref: reference pressure, default = 0.
    :return: static pressure
    """
    vvr = v / k[0]
    p = (p_ref - 0.5 * (3. * k[1] - 5. * p_ref) * (1. - vvr**(-2. / 3.)) +
         9. / 8. * k[1] * (k[2] - 4. + 35. / 9. * p_ref / k[1]) *
         (1. - vvr**(-2. / 3.))**2.) * vvr**(-5. / 3.)
    return p
def cal_p_bm3 ( v , k , p_ref = 0.0 ) : vvr = v / k [ 0 ] p = ( p_ref - 0.5 * ( 3. * k [ 1 ] - 5. * p_ref ) * ( 1. - vvr ** ( - 2. / 3. ) ) + 9. / 8. * k [ 1 ] * ( k [ 2 ] - 4. + 35. / 9. * p_ref / k [ 1 ] ) * ( 1. - vvr ** ( - 2. / 3. ) ) ** 2. ) * vvr ** ( - 5. / 3. ) return p
calculate pressure from 3rd order Birch-Murnaghan equation

    :param v: volume at different pressures
    :param k: [v0, k0, k0p]
    :param p_ref: reference pressure, default = 0.
    :return: static pressure