  Shell corrections of the finite deformed Woods-Saxon potential are calculated
using the Green's function method and the generalized Strutinsky smoothing
procedure. They are compared with the results of the standard prescription
which are affected by the spurious contribution from the unphysical particle
gas. In the new method, the shell correction approaches the exact limit
provided that the dimension of the single-particle (harmonic oscillator) basis
is sufficiently large. For spherical potentials, the present method is faster
than the exact one in which the contribution from the particle continuum states
is explicitly calculated. For deformed potentials, the Green's function method
offers a practical and reliable way of calculating shell corrections for weakly
bound nuclei.
