Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Optimizing electronic structure

Here we consider the optimization of the electronic structure using Hartree--Fock (HF) and Kohn-Sham density functional theory (KS-DFT), and how to plot the resulting molecular orbitals. Our example is methanol, using the xTB structure from the previous section.

Specify structure

The molecular geometry is written in xyz-coordinates, and visualized using py3Dmol.

Loading...

SCF optimization

At the HF/6-311G level of theory, the electronic structure is optimized by creating the molecule and basis objects, setting up an unrestricted SCF driver, and performing the SCF calculation:

The total (HF) energy is -115.01894 Hartree

Visualizing molecular orbitals

The MOs can be visualized using the OrbitalViewer function:

Here you can only see the default MO selection (the HOMO), but if you run this in a notebook you can visualize any MO, change isovalues, and more.

KS-DFT optimization

With the B3LYP exchange-correlation functional, the SCF is optimized using:

The total (B3LYP) energy is -115.71437 Hartree

And the MOs are visualized as: