A theory for the formation of tetrahedral amorphous carbon including deposition rate effects