  The correlation between transport properties across sub-nanometric metallic
gaps and the optical response of the system is a complex effect which is
determined by the fine atomic-scale details of the junction structure. As
experimental advances are progressively accessing transport and optical
characterization of smaller nanojunctions, a clear connection between the
structural, electronic and optical properties in these nanocavities is needed.
Using ab initio calculations, we present here a study of the simultaneous
evolution of the structure and the optical response of a plasmonic junction as
the particles forming the cavity, two Na$_{380}$ clusters, approach and
retract. Atomic reorganizations are responsible for a large hysteresis of the
plasmonic response of the system, that shows a jump-to-contact instability
during the approach process and the formation of an atom-sized neck across the
junction during retraction. Our calculations demonstrate that, due to the
quantization of the conductance in metal nanocontacts, atomic-scale
reconfigurations play a crucial role in determining the optical response of the
whole system. We observe abrupt changes in the intensities and spectral
positions of the dominating plasmon resonances, and find a one-to-one
correspondence between these jumps and those of the quantized transport as the
neck cross-section diminishes. These results point out to an unforeseen
connection between transport and optics at the atomic scale, which is at the
frontier of current optoelectronics and can drive new options in optical
engineering of signals driven by the motion and manipulation of single atoms.
