We now solve Poisson's equation for the Gaussian charge distributions
above. Because the energy of a periodic system is infinite if each
unit cell contains a net charge, we will consider the charge
distribution rho=rho1-rho2 from part 3.2.1. This net
distribution has one unit of positive charge in a peak of width
and one unit of negative charge in a more spread-out peak
of width
, as in Figure 1.
Figure 1: Distribution of charges for three-dimensional solution of Poisson's equation
The total electrostatic energy of any distribution of charges is
Note that, because
is real, the complex conjugation `*'
does not do anything. We include it for convenience so that we may
use the
and
operators as defined in
lecture.
If we have the coefficients,
and
, for the expansions of these fields
then, substituting into Eq. (1) we find (in the notation from lecture),
As discussed in lecture, we can always find the vectors of expansion coefficients from vectors of sample values by using our inverse transform operator,
Thus our final result for the potential energy is
After the check of the integrals of rho1, rho2 and rho (from part 3.2.1) in physics.C, have your code determine and print out the total potential energy of the total charge-density distribution rho using the one-line solution of Poisson's equation from class
and the computational representation of Eq. 2 for U,phi=I(Linv((-4*pi)*O(J(rho))));
Note that we need to take the real part of the complex result of the `^' operator so that we can store the answer in U, a double precision value.U=0.5*real(J(rho)^O(J(phi)));
Compare your computed result for U with the analytic result for the
total potential energy of a sum of two Gaussian distributions, one of
width
with positive unit charge and one of width
with negative unit charge: