def mjd2gmst(mjd):
    """Convert Modfied Juian Date (JD = 2400000.5) to GMST
    
    Take from P.T. Walace routines"""
    
    D2PI= 6.2831853071795864769252867665590057683943387987502
    DS2R= 7.2722052166430399038487115353692196393452995355905e-5
    
    tu = (mjd-51544.5)/36525.0;
    
    st = fmod(mjd,1.0) * D2PI + ( 24110.54841 + ( 8640184.812866 + ( 0.093104 - 6.2e-6 * tu ) * tu ) * tu ) * DS2R 
    
    w = fmod(st,D2PI)
    if w >= 0.0 :
        return w
    else:
        return w+D2PI
Convert Modfied Juian Date (JD = 2400000.5) to GMST
    
    Take from P.T. Walace routines