Distribution of the lattice energy in cubic crystals and its variation with compression or expansion