  We propose a microscopic effective interaction to treat pairing correlations
in the $^{1}S_0$ channel. It is introduced by recasting the gap equation
written in terms of the bare force into a fully equivalent pairing problem.
Within this approach, the proposed interaction reproduces the pairing
properties provided by the realistic $AV18$ force very accurately. Written in
the canonical basis of the actual Bogolyubov transformation, the force takes
the form of an off-shell in-medium two-body matrix in the superfluid phase
multiplied by a BCS occupation number $2 \rho_{m}$. This interaction is finite
ranged, non local, total-momentum dependent and density dependent. The factor
$2 \rho_{m}$ emerging from the recast of the gap equation provides a natural
cut-off and makes zero-range approximations of the effective vertex meaningful.
Performing such an approximation, the roles of the range and of the density
dependence of the interaction can be disentangled. The isoscalar and isovector
density-dependences derived ab-initio provide the pairing force with a strong
predictive power when extrapolated toward the drip-lines. Although finite
ranged and non local, the proposed interaction makes HFB calculations of finite
nuclei in coordinate space tractable. Through the two-basis method, its
computational cost is of the same order as for a zero-range force.
