An atomic switch realized with the scanning tunnelling microscope