I am trying to derive a version of the Boltzmann distribution from statistical mechanics:
$$n(\mathbf{x}) = n_{0}e^{-q\phi(\mathbf{x})/kT}.$$
This expression is commonly used in the derivation of the Debye length in plasma physics (see Wikipedia).
I have found this article helpful. I have also looked at the discussion around equations (7.29)-(7.31) in Thermal Physics by Daniel Schroeder. However, the results in these sources don't exactly match the equation as given above. Both sources give:
$$P_i = \frac{\left< N_i \right>}{N} = \frac{1}{Z}e^{-\varepsilon_i/kT},$$
where $\left< N_i \right>$ is the average number of particles in the $i$th state. Obviously, this is close to the expression above.
I have tried the following with energies that are not discrete. I assume a canonical ensemble and a single particle of charge $q$ in a potential $\phi(\mathbf{x})$. The probability density is
$$P(\mathbf{x}, \mathbf{p}) = \frac{\exp\left[-q \phi(\mathbf{x})/kT\right] \exp\left[-p^2 / 2mkT\right]}{\int d\mathbf{x} \, d\mathbf{p} \, \exp\left[-q \phi(\mathbf{x})/kT\right] \exp\left[-p^2 / 2mkT\right]}$$
Integrating over momentum space gives the probability density over configuration space:
$$\int d\mathbf{p} \, P(\mathbf{x}, \mathbf{p}) = P(\mathbf{x}) = \frac{\exp\left[-q \phi(\mathbf{x})/kT\right]}{\int d\mathbf{x} \, \exp\left[-q \phi(\mathbf{x})/kT\right]}$$
I interpret this as the probability per unit volume that particle q will be located at $\mathbf{x}$. If I multiply now by the number of particles, $N$, I have the average number of particles per unit volume at $\mathbf{x}$, which I interpret as $n(\mathbf{x})$:
$$n(\mathbf{x}) = N \frac{\exp\left[-q \phi(\mathbf{x})/kT\right]}{\int d\mathbf{x} \, \exp\left[-q \phi(\mathbf{x})/kT\right]. }$$
Comparing to the equation that I gave above, it seems that I am close. What am I missing?