  Let N be a nilpotent Lie group and let S be an invariant geometric structure
on N (cf. symplectic, complex or hypercomplex). We define a left invariant
Riemannian metric on N compatible with S to be "minimal", if it minimizes the
norm of the invariant part of the Ricci tensor among all compatible metrics
with the same scalar curvature. We prove that minimal metrics (if any) are
unique up to isometry and scaling, they develop soliton solutions for the
invariant Ricci flow and are characterized as the critical points of a natural
variational problem. The uniqueness allows us to distinguish geometric
structures with Riemannian data, giving rise to a great deal of invariants.
  Our approach proposes to vary Lie brackets and our main tool is the moment
map for the action of a reductive Lie group on the algebraic variety of all Lie
algebras, which we show to coincide with the Ricci operator. We therefore can
use strong results from geometric invariant theory to study compatible metrics
and the moduli space of isomorphism classes of geometric structures.
