  Two-dimensional transition-metal dichalcogendes $MX_2$ (es. MoS$_2$, WS$_2$,
MoSe$_2$, \ldots) are among the most promising materials for bandgap
engineering. Widely studied in these compounds, by means of ab-initio
techniques, is the possibility of tuning the direct-indirect gap character by
means of in-plane strain. In such kind of calculations however the lattice
degrees of freedom are assumed to be classical and frozen. In this paper we
investigate in details the dependence of the bandgap character (direct vs.
indirect) on the out-of-plane distance $h$ between the two chalcogen planes in
each $MX_2$ unit. Using DFT calculations, we show that the bandgap character is
indeed highly sensitive on the parameter $h$, in monolayer as well as in
bilayer and bulk compounds, permitting for instance the switching from indirect
to direct gap and from indirect to direct gap in monolayer systems. This
scenario is furthermore analyzed in the presence of quantum lattice fluctuation
induced by the zero-point motion. On the basis of a quantum analysis, we argue
that the direct-indirect bandgap transitions induced by the out-of-plane strain
as well by the in-plane strain can be regarded more as continuous crossovers
rather than as real sharp transitions. The consequences on the physical
observables are discussed.
