We describe an efficient procedure for calculating the rates of bimolecular chemical reactions in the gas phase within the ring polymer molecular dynamics approximation. A key feature of the procedure is that it does not require that one calculate the absolute quantum mechanical partition function of the reactants or the transition state: The rate coefficient only depends on the ratio of these two partition functions which can be obtained from a thermodynamic integration along a suitable reaction coordinate. The procedure is illustrated with applications to the three-dimensional H+H-2, Cl+HCl, and F+H-2 reactions, for which well-converged quantum reactive scattering results are computed for comparison. The ring polymer rate coefficients agree with these exact results at high temperatures and are within a factor of 3 of the exact results at temperatures in the deep quantum tunneling regime, where the classical rate coefficients are too small by several orders of magnitude. This is probably already good enough to encourage future applications of the ring polymer theory to more complex chemical reactions, which it is capable of treating in their full dimensionality. However, there is clearly some scope for improving on the ring polymer approximation at low temperatures, and we end by suggesting a way in which this might be accomplished. (C) 2009 American Institute of Physics. [DOI: 10.1063/1.3127145]