Proteins are among the most complex molecular structures, which have evolved to develop broad functions, such as energy conversion and transport, information storage and processing, communication, and regulation of chemical reactions. However, the mechanisms by which these dynamical entities coordinate themselves to perform biological tasks remain hotly debated. Here, a physical theory is presented to explain how functional dynamical behavior possibly emerge in complex/macro molecules, thanks to the effect that we term bilocalization of thermal vibrations. More specifically, our approach allows us to understand how structural irregularities lead to a partitioning of the energy of the vibrations into two distinct sets of molecular domains, corresponding to slow and fast motions. This shape-encoded spectral allocation, associated to the genetic sequence, provides a close access to a wide reservoir of dynamical patterns, and eventually allows the emergence of biological functions by natural selection. To illustrate our approach, the SPIKE protein structure of SARS-COV2 is considered.