Identification of switching mechanism in molecular junctions by inelastic electron tunneling spectroscopy