Optimal Electron Density Mechanism for Hydrogen on the Surface and at a Vacancy in Tungsten