def thermal_speed(temp, abar=1.0, spec='e'):
    """
    Calculate the thermal speed for electrons or ions

    Parameters
    ----------
     - temp [eV]
     - abar: mean atomic number
     - spec: species

    Returns
    -------
      speed in cm/s

    Source: https://en.wikipedia.org/wiki/Plasma_parameters
    """
    if spec == 'e':
        return 4.19e7*temp**0.5
    elif spec == 'i':
        return 9.79e5*abar**(-0.5)*temp**0.5
    else:
        raise ValueError