  We consider the quantum completeness problem, i.e. the problem of confining
quantum particles, on a non-complete Riemannian manifold $M$ equipped with a
smooth measure $\omega$, possibly degenerate or singular near the metric
boundary of $M$, and in presence of a real-valued potential $V\in
L^2_{\mathrm{loc}}(M)$. The main merit of this paper is the identification of
an intrinsic quantity, the effective potential $V_{\mathrm{eff}}$, which allows
to formulate simple criteria for quantum confinement. Let $\delta$ be the
distance from the possibly non-compact metric boundary of $M$. A simplified
version of the main result guarantees quantum completeness if $V\ge -c\delta^2$
far from the metric boundary and \[
  V_{\mathrm{eff}}+V\ge \frac3{4\delta^2}-\frac{\kappa}{\delta}, \qquad
\text{close to the metric boundary}. \] These criteria allow us to: (i) obtain
quantum confinement results for measures with degeneracies or singularities
near the metric boundary of $M$; (ii) generalize the
Kalf-Walter-Schmincke-Simon Theorem for strongly singular potentials to the
Riemannian setting for any dimension of the singularity; (iii) give the first,
to our knowledge, curvature-based criteria for self-adjointness of the
Laplace-Beltrami operator; (iv) prove, under mild regularity assumptions, that
the Laplace-Beltrami operator in almost-Riemannian geometry is essentially
self-adjoint, partially settling a conjecture formulated in [Boscain, Laurent -
Ann. Inst. Fourier, 2013] .
