Semiconductor doping is a process of fundamental importance to semiconductor physics and solid-state electronics, but cannot be explicitly simulated from first principles due to the huge system size needed for most doping scenarios. We examine the efficacy of the simulation of doping in silicon by the inclusion of "pseudoatoms" with fractional nuclear charge, introduced via specially constructed pseudopotentials. These provide a net charge carrier concentration matching an arbitrarily chosen doping level, at no increase of the computational cost. By extending this approach to consider minute deviations from the integer charge, we demonstrate that the electron Fermi level can be set to any value within the forbidden gap, at minimal perturbation of the electronic structure. Beyond the bulk scenario, we successfully simulate the development of the space-charge region in a heavily doped p-n junction and the doping dependence of the work function of the hydrogen-passivated (semiconducting) Si(111) surface.