Inconsistent? hamiltonians for a scalar field in the presence of a classical source
Consider a real scalar field \begin{equation} \phi(x)=\int\frac{d^3p}{(2\pi)^3}\frac{1}{\sqrt{2E_p}}\left(a_pe^{-ip\cdot x}+a_p^{\dagger}e^{ip\cdot x} \right). \end{equation}
In Chapter 2 of <PERSON>, right after Eq. 2.64, we have the form of the hamiltonian for a real scalar field coupled to a classical source $j(x)$: $$1) \qquad H =\int \frac{d^3p}{(2\pi)^3}E_p\left(a_p^{\dagger}-\frac{i}{\sqrt{2E_p}}\tilde{j}^*(p) \right)\left(a_p+\frac{i}{\sqrt{2E_p}}\tilde{j}(p) \right),$$ where $\tilde{j}(p)=\int d^4y e^{ip\cdot y}j(y)$.
On the other hand, the hamiltonian which describes such a system is given by \begin{equation} 2) \qquad H=H_0-\int d^3x j(x)\phi(x). \end{equation}
I want to see that these two expressions for the hamiltonian are indeed equivalent. 281
By expanding the first one we obtain \begin{eqnarray} H&=&\int \frac{d^3p}{(2\pi)^3}E_p a_p^{\dagger}a_p+\int \frac{d^3p}{(2\pi)^3}i\sqrt{\frac{E_p}{2}}\left(a_p^{\dagger}\tilde{j}(p) -a_p\tilde{j}^(p)\right)+\int\frac{d^3p}{(2\pi)^3}\frac{|\tilde{j}(p)|^2}{2}\ &=&H_0+\int \frac{d^3p}{(2\pi)^3}i\sqrt{\frac{E_p}{2}}\left(a_p^{\dagger}\tilde{j}(p) -a_p\tilde{j}^(p)\right)+\langle 0|H| 0 \rangle. \end{eqnarray}
Since $\langle 0|H| 0 \rangle$ is a constant term we can ignore it. Therefore, \begin{equation} H=H_0+\int \frac{d^3p}{(2\pi)^3}i\sqrt{\frac{E_p}{2}}\left(a_p^{\dagger}\tilde{j}(p) -a_p\tilde{j}^*(p)\right). \end{equation}
Notice \begin{eqnarray} \int \frac{d^3p}{(2\pi)^3}i\sqrt{\frac{E_p}{2}}\left(a_p^{\dagger}\tilde{j}(p) -a_p\tilde{j}^*(p)\right)&=&\int \frac{d^3p}{(2\pi^3)}i\sqrt{\frac{E_p}{2}}\left(\int d^4x j(x)\left(a_p^{\dagger}e^{ip\cdot y}-a_pe^{-ip\cdot y} \right)\right)\ &=&\int d^4x j(x)\left[\int \frac{d^3p}{(2\pi)^3}i\sqrt{\frac{E_p}{2}}\left(a_p^{\dagger}e^{ip\cdot x}-a_pe^{-ip\cdot x} \right)\right]\ &=&\int d^4x j(x)\dot{\phi}(x). \end{eqnarray} That would leave us with the expression \begin{equation} 1) \quad H = H_0+\int d^4x j(x)\dot{\phi}(x). 374