On-Surface Atomic Wires and Logic Gates