Benzene — export molecular orbitals
See shared setup for STO-3G installation and output paths.
This tutorial runs restricted Hartree–Fock (RHF) for benzene and exports its occupied and virtual molecular orbitals so you can inspect their shapes.
Create a directory named benzene with an inputs subdirectory. Save the
geometry as benzene/benzene.xyz.
12
Benzene, PubChem CID 241, 3D conformer from PubChem PUG REST
C -1.2131 -0.6884 0.0000
C -1.2028 0.7064 0.0001
C -0.0103 -1.3948 0.0000
C 0.0104 1.3948 -0.0001
C 1.2028 -0.7063 0.0000
C 1.2131 0.6884 0.0000
H -2.1577 -1.2244 0.0000
H -2.1393 1.2564 0.0001
H -0.0184 -2.4809 -0.0001
H 0.0184 2.4808 0.0000
H 2.1394 -1.2563 0.0001
H 2.1577 1.2245 0.0000
Save the runfile as benzene/inputs/calculation.toml. Its geometry path resolves
relative to the TOML file, one directory up.
[basis]
name = "sto-3g"
[molecule]
geometry = "../benzene.xyz"
charge = 0
multiplicity = 1
units = "Angstrom"
[method.hf]
max_iterations = 150
convergence_threshold = 1e-10
[method.hf.guess]
type = "CoreHamiltonian"
[method.hf.diis]
enabled = true
max_history = 10
Benzene needs both carbon and hydrogen in its STO-3G basis. From inside
benzene, run RHF and export the converged orbitals.
rustiq run inputs/calculation.toml --artifact hf.rustiq --format json > hf.json
rustiq artifact export hf.rustiq --format molden -o benzene.molden
The total RHF energy is −227.8908322166 Hartree. Neutral benzene has
42 electrons, giving 21 doubly occupied spatial orbitals. In the Molden
file these have occupation 2, and the 15 virtual orbitals have occupation 0.
HOMO means highest occupied molecular orbital, and LUMO means lowest
unoccupied molecular orbital. The 21st record is the HOMO and the 22nd is the
LUMO. Their neighboring records are HOMO−1 and LUMO+1.
Read the frontier energies in Hartree from the Ene= fields in
benzene.molden. Jmol numbers these records starting at 1.
| Molden record | Orbital | Occupation | Energy (Hartree) |
|---|---|---|---|
| 20 | HOMO−1 | 2 | −0.27982092 |
| 21 | HOMO | 2 | −0.27978734 |
| 22 | LUMO | 0 | 0.26875127 |
| 23 | LUMO+1 | 0 | 0.26879226 |
The RHF orbital gap, ε(LUMO) − ε(HOMO), is 0.54853861 Hartree.
Experimental excitation energies are differences between many-electron
states and include effects outside this orbital-energy difference.
Ideal hexagonal benzene (D₆h) has a doubly degenerate frontier pair on
each side of the gap. The supplied coordinates approximate this symmetry.
The occupied pair splits by about 3.36 × 10⁻⁵ Hartree and the virtual pair
by about 4.10 × 10⁻⁵ Hartree. The exported symmetry labels are placeholders.
See Molden export.
Open hf.json in a text editor to inspect calculation.hf.converged and
calculation.hf.total_energy. The orbital energies and occupations are in
the Molden file. Benzene is not independently compared in the reference suite;
see reference checks.
Render the frontier orbitals in Jmol
The surfaces in each figure mark opposite signs of the orbital amplitude, with red for negative and blue for positive. An orbital’s overall sign is arbitrary. Within an exactly degenerate subspace, rotations give equally valid canonical orbitals. With a small energy splitting, the canonical orbitals can still be sensitive to small geometry changes.

Benzene HOMO (MO 21), RHF/STO-3G. Jmol 16.5.7, orbital amplitude isosurfaces at ±0.04 Bohr⁻³ᐟ².

Benzene LUMO (MO 22), RHF/STO-3G. Jmol 16.5.7, orbital amplitude isosurfaces at ±0.04 Bohr⁻³ᐟ².
Save the script as benzene/plot_molden_jmol.spt, beside benzene.molden.
If you use the project Nix environment, enter nix develop .#full from the
repository and run jmol -n -x -s plot_molden_jmol.spt from the benzene
directory. The shell supplies Jmol on PATH.
If you use a release binary without that Nix environment, install Java,
download the Jmol 16.5.7 binary archive,
and extract Jmol.jar. The figures in this manual were generated with Java
21.0.13.1 and Jmol 16.5.7 on Linux.
load "benzene.molden"
background white
set frank off
set antialiasDisplay true
set perspectiveDepth false
center all
rotate x 55
rotate z 20
zoom 80
spacefill 18%
wireframe 0.12
color atoms cpk
mo titleFormat ""
mo cutoff 0.04
mo resolution 10
mo color [xB33B32] [x2369A6]
mo fill noMesh
mo 21
write image 1400 1100 png "benzene-homo-jmol.png"
mo 22
write image 1400 1100 png "benzene-lumo-jmol.png"
From inside benzene, run the command below with the path to your Jmol
JAR. Use a graphical desktop session or a virtual display on Linux.
java -jar /path/to/Jmol.jar -n -x -s plot_molden_jmol.spt
The script loads the Molden file, sets the same camera and colors for
both views, selects orbitals 21 and 22, and writes
benzene-homo-jmol.png and benzene-lumo-jmol.png at 1400 × 1100 pixels.
Confirm that both files exist and have those dimensions after Jmol exits.
Jmol 16.5.7 preserves the orbital energy values and leaves their units
unlabeled. Read them in Hartree using the Molden export and table above.
Optional orbital slice with PySCF
Save the following script as benzene/plot_molden.py.
"""Plot a molecular orbital in a plane parallel to the benzene ring."""
import argparse
import matplotlib
import numpy as np
from pyscf.tools import molden
matplotlib.use("Agg")
import matplotlib.pyplot as plt
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("molden")
parser.add_argument("output")
args = parser.parse_args()
molecule, energies, coefficients, occupations, *_ = molden.load(args.molden)
homo = np.flatnonzero(occupations > 0)[-1]
axis = np.linspace(-7, 7, 201)
x, y = np.meshgrid(axis, axis)
points = np.column_stack((x.ravel(), y.ravel(), np.full(x.size, 1.0)))
atomic_orbitals = molecule.eval_gto("GTOval", points)
orbital = (atomic_orbitals @ coefficients[:, homo]).reshape(x.shape)
limit = np.max(np.abs(orbital))
figure, plot = plt.subplots(figsize=(5, 4.5), layout="constrained")
contours = plot.contourf(
x, y, orbital, levels=np.linspace(-limit, limit, 25), cmap="RdBu_r"
)
coords = molecule.atom_coords()
plot.scatter(coords[:, 0], coords[:, 1], c="black", s=8)
plot.set(
aspect="equal",
xlabel="x (Bohr)",
ylabel="y (Bohr)",
title=f"Benzene HOMO at z = 1 Bohr\n{energies[homo]:.3f} Hartree",
)
figure.colorbar(contours, ax=plot, label="Orbital amplitude (Bohr⁻³ᐟ²)")
figure.savefig(args.output, dpi=150)
if __name__ == "__main__":
main()
From inside benzene, use Python 3 to create an isolated environment.
These commands use a POSIX shell. On Windows, use
.venv\Scripts\python.exe in place of .venv/bin/python.
python -m venv .venv
.venv/bin/python -m pip install numpy pyscf matplotlib
.venv/bin/python plot_molden.py benzene.molden benzene-homo.png
PySCF reads the exported orbitals and the script plots the HOMO in the
plane z = 1 Bohr, about 1 Bohr above the ring. Open the PNG in an image
viewer. The colors mark opposite signs of the orbital amplitude and the
dots show projected atomic positions.
