Accurate and efficient structure factors in ultrasoft pseudopotential and projector augmented wave DFT