I attempt to understand the parity and dipole operator from Daniel Steck's notes: Quantum and Atom Optics (page no. 152, section 5.1.1). I have also attached a screenshot at the end of the question.
At the beginning of the section 5.1.1, the author defines the parity operator and derives some basic properties. Based on the fact that the parity operator commutes with a Hamiltonian with an even potential function: $$ \left[\Pi, \frac{p_e^2}{2m_e} - \frac{\alpha}{\left\vert \textbf{r}_e\right\vert}\right] = 0,$$ he eventually states that the diagonal matrix elements of dipole operator $\textbf{d} = -e \textbf{r}_e$ vanish, where $\textbf{r}_e$ is the atomic electron position: $$\langle g | \textbf{d} | g \rangle = \langle e | \textbf{d} | e\rangle = 0.$$
Here, $|g \rangle$ and $|e \rangle$ are eigenstates of a two-level Hamiltonian $H = H_A + H_{AF}$, where $H_A = \hbar\omega_0 | e\rangle \langle e|$ is the free atomic Hamiltonian, and $H_{AF} = -\textbf{d} \cdot \textbf{E}$ is the atom-field interaction Hamiltonian with the assumption that the ground state energy $E_g = 0$.
My Question: I don't see how $\langle g | \textbf{d} | g \rangle = \langle e | \textbf{d} | e\rangle = 0$ is true. Could you show me the details?
The author then uses the results to rewrite the total Hamiltonian $$H = H_A + H_{AF} = \hbar\omega_0 + e \, \textbf{r}_e \cdot \textbf{E}.$$ But I don't see how this Hamiltonian $H$ commutes with the parity operator $\Pi$.
My Question: How is it then justified to apply results to the total Hamiltonian $H$ even if it doesn't commute with the parity operator $\Pi$, whereas the results were derived from a Hamiltonian that commutes with the parity operator?