Finding optimal basis states for variation after projection nuclear wave functions