The Pauli exclusion principle allows us to approximate the wave functions of valence electrons by treating the inner electrons and nucleus together as a single source of potential; and then by treating the ionic cores as fixed we can solve the Schrodinger equation for the valence electrons and calculate its lowest energy level as a function of the relative coordinates of the cores. Minimizing that function then allows us to determine the optimal bond lengths and their relative orientations.