Calculations of energy losses due to atomic processes in tokamaks with applications to the International Thermonuclear Experimental Reactor divertor