  The electronic nematic phase emerging with spontaneous rotation symmetry
breaking is a central issue of modern condensed matter physics. In particular,
various nematic phases in iron-based superconductors and high-$T_{\rm c}$
cuprate superconductors are extensively studied recently. Electric quadrupole
moments (EQMs) are one of the order parameters characterizing these nematic
phases in a unified way, and elucidating EQMs is a key to understanding these
nematic phases. However, the quantum-mechanical formulation of the EQMs in
crystals is a nontrivial issue because the position operators are non-periodic
and unbound. Recently, the EQMs have been formulated by local thermodynamics,
and such {\it thermodynamic EQMs} may be used to characterize the fourfold
rotation symmetry breaking in materials. In this paper, we calculate the
thermodynamic EQMs in iron-based superconductors LaFeAsO and FeSe as well as a
cuprate superconductor La$_2$CuO$_4$ by a first-principles calculation. We show
that owing to the orbital degeneracy the EQMs in iron-based superconductors are
mainly determined by the geometric properties of wave functions. This result is
in sharp contrast to the cuprate superconductor, in which the EQMs are
dominated by distortion of the Fermi surface.
