import math


def write_troe_dt(lang, rxn, beta_0minf, E_0minf, k0kinf):
    """Writes section of line for temperature partial derivative of Troe falloff.

    Parameters
    ----------
    lang : str
        Programming language, {'c', 'cuda'}
    rxn : `ReacInfo`
        Reaction of interest; pressure dependence expressed with Troe falloff.
    beta_0minf : float
        Low-pressure limit temperature exponent minus high-pressure value.
    E_0minf : float
        Low-pressure limit activation energy minus high-pressure value.
    k0kinf : float
        Low-pressure limit reaction coefficient divided by high-pressure value.

    Returns
    -------
    jline : str
        Line fragment with Troe temperature derivative

    """
    jline = (' + (((1.0 / '
             '(Fcent * (1.0 + A * A / (B * B)))) - '
             'lnF_AB * ('
             '-{:.16e}'.format(0.67 / math.log(10.0)) +
             ' * B + '
             '{:.16e} * '.format(1.1762 / math.log(10.0)) +
             'A) / Fcent)'
             ' * ({:.16e}'.format(-(1.0 - rxn.troe_par[0]) /
                                 rxn.troe_par[1]) +
             ' * exp(T / '
             '{:.16e}) - '.format(-rxn.troe_par[1]) +
             '{:.16e} * '.format(rxn.troe_par[0] /
                                rxn.troe_par[2]) +
             'exp(T / '
             '{:.16e})'.format(-rxn.troe_par[2])
             )
    if len(rxn.troe_par) == 4 and rxn.troe_par[3] != 0.0:
        jline += (' + ({:.16e} / '.format(rxn.troe_par[3]) +
                  '(T * T)) * exp('
                  '{:.16e} / T)'.format(-rxn.troe_par[3])
                  )
    jline += '))'

    jline += (' - lnF_AB * ('
              '{:.16e}'.format(1.0 / math.log(10.0)) +
              ' * B + '
              '{:.16e}'.format(0.14 / math.log(10.0)) +
              ' * A) * '
              '({:.16e} + ('.format(beta_0minf) +
              '{:.16e} / T) - 1.0) / T'.format(E_0minf)
              )

    return jline