  The total energy is the most fundamental quantity in ab initio studies. To
include electron-phonon interaction (EPI) contribution to the total energy, we
have recast Allen's equation, for the case of semiconductors and insulators.
This equivalent expression can be computed using available software, leading to
more accurate total energy. We calculate the total energies and their
differences for carbon-diamond and carbon-hexagonal polytypes. Contrary to the
current understanding, where per-atom quantities are computed from the
primitive unit cell, our results, unexpectedly, show that the per-atom total
energy (EPI included) depends on the unit cell size and violates the unit cell
independence. For example, it differs for carbon-diamond by 1eV/atom between
the primitive unit cell and supercells. This norm-violating behaviour arises
from the partial Fan-Migdal (FM) self-energy term present in Allen's equation.
Consequently, to determine the total energy differences between polytypes,
supercells with identical number of atoms are necessary. A crucial inference of
general validity is that any equation that contains a partial Fan-Migdal
self-energy term violates the unit cell independence, contrary to the current
understanding. Further theoretical studies are needed to establish if the total
energy (EPI included) is an exception or can be reconciled with the unit cell
independence.
