Dose calculations for external photon beams in radiotherapy