First-principles calculation of transport coefficients