  We present a method to constrain local charge multipoles within
density-functional theory. Such multipoles quantify the anisotropy of the local
charge distribution around atomic sites and can indicate potential hidden
orders. Our method allows selective control of specific multipoles,
facilitating a quantitative exploration of the energetic landscape outside of
local minima. Thus, it enables a clear distinction between electronically and
structurally driven instabilities. We demonstrate the effectiveness of this
method by applying it to charge quadrupoles in the prototypical orbitally
ordered material KCuF$_3$. We quantify intersite multipole-multipole
interactions as well as the energy-lowering related to the formation of an
isolated local quadrupole. We also map out the energy as a function of the size
of the local quadrupole moment around its local minimum, enabling
quantification of multipole fluctuations around their equilibrium value.
Finally, we study charge quadrupoles in the solid solution
KCu$_{1-x}$Zn$_x$F$_3$ to characterize the behavior across the
tetragonal-to-cubic transition. Our method provides a powerful tool for
studying symmetry breaking in materials with coupled electronic and structural
instabilities and potentially hidden orders.
