I don't know what you had in mind, but the only way to do it theoretically is roughly:
1) Solve the molecular Schrödinger equation.
2) Calculate the derivatives with respect to nuclear coordinates to get the forces
3) Minimize using the steepest-descent or other minimization method
4) Repeat until the nuclei are at equilibrium bond distance.