Chemistry C API *************** IMF functions ============= .. c:function:: static double get_imf(double m) This function returns the mass fraction of a star of mass m using the current IMF .. math:: \Phi(m) = b\, m^a .. c:function:: static double get_imf_M(double m1, double m2) This function returns the mass fraction between m1 and m2 per mass unit, using the current IMF .. math:: \int^{m_1}_{m_2} \Phi(m)\,dm = \frac{b}{a+1} \left( m_2^{a+1} - m_1^{a+1} \right) .. c:function:: static double get_imf_N(double m1, double m2) This function returns the number fraction between m1 and m2 per mass unit, using the current IMF .. math:: \int^{m_1}_{m_2} \frac{\Phi(m)}{m}\,dm = \frac{b}{a} \left( m_2^{a} - m_1^{a} \right) .. c:function:: static double imf_sampling() Sample the imf using monte carlo approach .. c:function:: void init_imf(void) This function initializes the imf parameters defined in the chemistry file. It compute the normalization factor :math:`b` ensuring: .. math:: \int^{M_{\rm{min}}}_{M_{\rm{max}}} \Phi(m)\,dm = \int^{M_{\rm{min}}}_{M_{\rm{max}}} b\, m^a \,dm = 1