Under what conditions can molecules exist? I am curious to know the conditions required for any two or more atoms to bond together and form a stable molecule. Is there a set of rules that should be satisfied?
 A: In computational chemistry, we approach this question from the Born-Oppenheimer approximation perspective, in a very pragmatic way.
Consider we have an ensemble of electrons and nuclei.
First, we assume that the nuclear and electronic wavefunctions can be separated.
Then, we solve the Schrödinger equation for the electrons in the field of fixed nuclei. The eigenvalues are the potential electronic energies $E$. And to answer the question, we need to focus only on the lowest eigenvalue, the ground state electronic energy.
If we repeat this procedure for all possible nuclear configurations R, we form a multidimensional potential energy surface $E\left(\mathbf{R}\right)$. (For $N$ nuclei, this surface has $3N-6$ dimensions.)
A necessary (but not sufficient) condition for the molecule to exist is there is at least one region $\mathbf{R}_0$ of this surface with energy lower than the energy of the nuclei separated by an infinite distance.
$$E\left(\mathbf{R_0}\right) < E\left(\mathbf{R_{\infty}}\right),$$
where $\mathbf{R_{\infty}}$ means a nuclear geometry in which at least one of the dimentions of $\mathbf{R}$ tends to infinite.
We determine such bound regions using geometry optimization methods, which search for minima of $E\left(\mathbf{R}\right)$.
Now that we solved the electrons, we go back to the nuclei. Their potential energy is given by $E\left(\mathbf{R}\right)$. We check what is their quantum zero-point energy, $\varepsilon_{ZP}$. Usually, we use a harmonic approximation around $E\left(\mathbf{R_0}\right)$ to do that.
Finally, we estimate thermal effects (entropy, enthalpy, and Gibbs corrections) coming from finite temperatures. These corrections give an additional energy term $\varepsilon_T$.
The sum of all those contributions is an approximation for the Gibbs free energy
$$G\left(\mathbf{R}\right) = E\left(\mathbf{R}\right) + \varepsilon_{ZP} + \varepsilon_T.$$
The molecule will exist if (and only if)
$$G\left(\mathbf{R_0}\right) < G\left(\mathbf{R_{\infty}}\right).$$
If you don't work with computational chemistry, all these calculations may sound abstract. However, we have many efficient approximations to perform them, even for molecules with a few hundred nuclei.
A good entry point to know more is the ChemCompute platform, which
provides tutorials, software, and computer time for running these calculations.
