  We present a general method of constructing \textit{in-situ} pseodopotentials
from first principles, all-electron, full-potential electronic structure
calculations of a solid. The method is applied to bcc Na, at equilibrium
volume. The essential steps of the method involve (i) calculating an
all-electron Kohn-Sham eigenstate. (ii) Replacing the oscillating part of the
wavefunction (inside the muffin-tin spheres) of this state, with a smooth
function. (iii) Representing the smooth wavefunction in a Fourier series, and
(iv) inverting the Kohn-Sham equation, to extract the pseudopotential that
produces the state generated in steps (i)-(iii). It is shown that an
\textit{in-situ} pseudopotential can reproduce an all-electron, full-potential
eigenvalue up to the sixth significant digit. A comparison of the all-electron
theory, \textit{in-situ} pseudopotential theory and the standard nonlocal
pseudopotential theory demonstrates good agreement, e.g., in the energy
dispersion of the 3$s$ band state of bcc Na.
