Modelling radiation damage to pixel sensors in the ATLAS detector