  The theories of flexoelectricity and that of nonlocal elasticity are closely
related, and are often considered together when modeling strain-gradient
effects in solids. Here I show, based on a first-principles lattice-dynamical
analysis, that their relationship is much more intimate than previously
thought, and their consistent simultaneous treatment is crucial for obtaining
correct physical answers. In particular, I identify a gauge invariance in the
theory, whereby the energies associated to strain-gradient elasticity and
flexoelectrically induced electric fields are individually reference-dependent,
and only when summed up they yield a well-defined result. To illustrate this, I
construct a minimal thermodynamic functional incorporating strain-gradient
effects, and establish a formal link between the continuum description and ab
initio phonon dispersion curves to calculate the relevant tensor quantities. As
a practical demonstration, I apply such a formalism to bulk SrTiO$_3$, where I
find an unusually strong contribution of nonlocal elasticity, mediated by the
interaction between the ferroelectric soft mode and the transverse acoustic
branches. These results have important implications towards the construction of
well-defined thermodynamic theories where flexoelectricity and ferroelectricity
coexist. More generally, they open exciting new avenues for the implementation
of hierarchical multiscale concepts in the first-principles simulation of
crystalline insulators.
