Atomic structure and spin polarization at the apex of tips used in spin-polarized scanning tunneling microscopy