Surface plasmon resonance and magnetism of thiol-capped gold nanoparticles