Modern locomotives use electric traction instead of gears as electric traction is much more flexible than gears. Diesel fuels generators from the combustion engine and transform the energy using an alternator, which runs the traction motors.