def dnet(dd, dm, zhm, xmm, xm):
    '''
/*       TURBOPAUSE CORRECTION FOR MSIS MODELS
 *        Root mean density
 *         DD - diffusive density
 *         DM - full mixed density
 *         ZHM - transition scale length
 *         XMM - full mixed molecular weight
 *         XM  - species molecular weight
 *         DNET - combined density
 */
 '''
    a  = zhm / (xmm-xm)
    if( not((dm>0) and (dd>0))): # pragma: no cover
        if((dd==0) and (dm==0)):
            dd=1
        if(dm==0):
            return dd
        if(dd==0):
            return dm

    ylog = a * log(dm/dd)
    if(ylog < -10.0):
        return dd
    if(ylog>10.0): # pragma: no cover
        return dm
    a = dd*pow((1.0 + exp(ylog)),(1.0/a))
    return a
/*       TURBOPAUSE CORRECTION FOR MSIS MODELS
 *        Root mean density
 *         DD - diffusive density
 *         DM - full mixed density
 *         ZHM - transition scale length
 *         XMM - full mixed molecular weight
 *         XM  - species molecular weight
 *         DNET - combined density
 */