Structure-property relationships at the atomic scale are usually understood in terms of recurrent structural motifs formed by atoms and molecules, and how they transform and interact with each other. We introduce with this thesis a novel analysis approach, capable of determining such patterns automatically. This analysis provides a unique fingerprint for metastable motifs, that is based exclusively on structural information. The rational behind the method and its functioning will be presented, followed by a discussion regarding its application to a wide range of problems in materials science and biology. We will begin by showing how it is possible to use our methodology to define adaptively the hydrogen bond in some different systems, including water, ammonia and peptides. We will then demonstrate how such definition can be used to probe the topological defects in the 3-dimensional hydrogen bond network of liquid water and will propose a method to study the non-trivial correlations among them. Furthermore, we will apply our framework to the identification of coordination environments in nanoclusters, and to the recognition of secondary-structure patterns in oligopeptides and proteins. We will prove that it is not only possible to obtain an algorithmic definition, which is unbiased and adaptive, of local motifs of matter, but also to identify and classify structures in their entirety. We will also demonstrate that a clear interpretation of the stability of the system can be obtained through the automatic analysis of atomistic simulation results, and will discuss possible applications, such as the definition of collective variables for enhanced-sampling simulation techniques or the identification of recurrent patterns in complex systems that escape an interpretation in terms of conventional structural motifs, such as intrinsically disordered proteins.