See orbitals and electron density from a cube file

Status: draft. Verified steps and screenshots to come.

In this lesson you will draw a molecule's electron density and one of its orbitals as surfaces, choosing the surface value yourself. Time: 10 to 15 minutes, depending on the program · Branch: Densities and volumes

Quantum-chemistry programs compute numbers on a 3-D grid: the electron density, orbitals, the electrostatic potential. A cube file stores that grid, along with the positions of the atoms, and each program below turns it into a surface.

Note

Cluster details. Highlighted values are placeholders. AMA27's queue names, module versions, paths and addresses go in when the cluster is deployed.

Choose your program

Each version is a complete lesson on its own page. Pick the program you use.

Choose your program
Program Lesson What it suits Minutes
GaussView Orbitals and density in GaussView (page to come) Work that already runs in Gaussian. Its license covers a named group: AMA27 Gaussian access, to come 10
ParaView Orbitals and density in ParaView Pictures you want to script, or a pipeline you are already using 15
ChimeraX Orbitals and density in ChimeraX (page to come) Work that also involves proteins or cryo-EM maps. It reads the grid from a cube file, but not the atoms, so the molecule comes from the PDB file 10
PyMOL Orbitals and density in PyMOL (page to come) Figures for a paper, in the style PyMOL gives protein pictures 10
What each program's result looks like

The same orbital, from the same cube files, drawn by the ParaView and PyMOL lessons' scripts. The lobes have the same shapes and sizes; the programs draw them differently. Pictures from GaussView and ChimeraX follow once the lesson has been run in them.

Formaldehyde's HOMO in ParaView: four see-through red and blue lobes, larger around the hydrogens, with the four atoms visible inside
Figure 1. ParaView: see-through lobes, with the atoms showing inside.
Formaldehyde's HOMO in PyMOL: four solid red and blue lobes around the sticks, the pair around the hydrogens (left) larger than the oxygen's
Figure 2. PyMOL: solid lobes around the molecule's sticks. In your own pictures, red and blue may come out swapped: an orbital's overall sign is arbitrary.

Get the cube files

Every version starts from the same calculation of formaldehyde, H₂CO. It writes density.cube and homo.cube, which all four programs read, and formaldehyde.pdb, which PyMOL and ChimeraX use for the atoms.

The script needs PySCF, which comes with one of the cluster's Python modules. It also needs a copy of the lesson's scripts in your home directory (AMA27 copy of the lesson files, to come). It writes into ~/scratch, so make that folder first with step 2 of the data lesson.

Run in: the OnDemand desktop terminal. Load AMA27's Python module with PySCF in place of the first line.

module load python-with-pyscf
python ~/ama27-curriculum/tutorials/visualization/scripts/make_cubes_pyscf.py --out ~/scratch/cubes --check

You should see: six lines starting check:, each ending in PASS. Your ~/scratch/cubes folder now holds five files: the three above, plus esp.cube and lumo.cube for later lessons. The calculation takes about a minute.

If Python reports ModuleNotFoundError: No module named 'pyscf', the module isn't loaded in this terminal: run the module load line again.

What every version teaches

A surface shows where a value is reached. An isosurface is the surface where the grid equals one chosen number, its isovalue. The number you pick decides the shape you get. For the density, 0.0004 e/bohr³ encloses almost all of the electrons, so the surface is about the size of the molecule. A larger value, 0.05, hugs the atoms and bonds, because the density only reaches it close to the nuclei. An orbital is different. Its values are positive in some regions and negative in others. It therefore takes two surfaces, at +0.02 and −0.02, drawn in two colors. The density is never negative, so one surface is enough for it.

Next