  We introduce a local order metric (LOM) that measures the degree of order in
the neighborhood of an atomic or molecular site in a condensed medium. The LOM
maximizes the overlap between the spatial distribution of sites belonging to
that neighborhood and the corresponding distribution in a suitable reference
system. The LOM takes a value tending to zero for completely disordered
environments and tending to one for environments that match perfectly the
reference. The site averaged LOM and its standard deviation define two scalar
order parameters, $S$ and $\delta S$, that characterize with excellent
resolution crystals, liquids, and amorphous materials. We show with molecular
dynamics simulations that $S$, $\delta S$ and the LOM provide very insightful
information in the study of structural transformations, such as those occurring
when ice spontaneously nucleates from supercooled water or when a supercooled
water sample becomes amorphous upon progressive cooling.
