4.5 Visualizing charge densities and orbitals

Charge densities, orbitals, etc. can be written onto a cartesian grid in the “cube” file format (see below, as well as Section 3.52, specifically the output keyword and the cube subkeyword described there). The visualization described in this section pertains to a simple H2O molecule, and can be repeated for example for the relaxed geometry obtained in the relaxation testrun for H2O in this distribution.

After running FHI-aims for the desired target geometry with the appropriate output flags (see Section 3.52), some files will be generated, all of which have the extension “*.cube". In the H2O example shown in this section, the calculation was run with tier 2 basis set, which should produce a more accurate charge density, and the parameters entered in the control.in file were:

 output cube total_density
   cube origin 0.0  0.0  0.0
   cube edge 29  0.15 0.0  0.0
   cube edge 29  0.0  0.15 0.0
   cube edge 29  0.0  0.0  0.15
 output cube eigenstate 5
 output cube eigenstate 6

The “Gaussian CUBE" files are written in a file format originally defined by the “Gaussian” program package, but now implemented as a de facto standard by many visualization programs. In this section, an example of how to visualize them using jmol program [159] is presented.

The CUBE files are composed of a header and the volumetric data. The header is divided in the following manner:

  • 1st and 2nd lines: text ignored by visualization programs

  • 3rd line: number of atoms in the file followed by the origin around which the volumetric data will be plotted.

  • 4th, 5th, and 6th lines: number of points to be plotted, followed by the axis vector.

  • 7th line on, until the end of the header: one line for each atom of the system, consisting of atomic number, followed by the atom xyz position.

An example of such a header with the beginning of the volumetric data is given below:

 CUBE FILE written by FHI-AIMSΨΨΨΨ
 *****************************
    3   -2.100000   -2.100000   -2.100000
   29    0.150000    0.000000    0.000000
   29    0.000000    0.150000    0.000000
   29    0.000000    0.000000    0.150000
    8    0.000000    0.000000    0.000000    0.000000
    1    0.000000    0.707000   -0.707000    0.000000
    1    0.000000   -0.707000   -0.707000    0.000000
  0.12810E-04  0.18208E-04  0.25394E-04  0.34819E-04  0.46974E-04  0.62322E-04
  0.81196E-04  0.10365E-03  0.12928E-03  0.15704E-03  0.18520E-03  0.21135E-03
  0.23277E-03  0.24687E-03  0.25180E-03  0.24687E-03  0.23277E-03  0.21135E-03
  .
  .
  .

In order to visualize these files in jmol, open the program and open the script console. Load a cube file, for example the total electronic density, by typing the following command:

> load "total_density.cube"

This will show your molecule. In order to visualize the surfaces, one must use the “isosurface" command. It has a myriad of options, all of which are explained in the jmol documentation [159], as of this writing located at http://chemapps.stolaf.edu/jmol/docs/#isosurface. As an example, in order to plot a volume, the command is:

> isosurface cutoff <cutoff> "total_density.cube"

The field <cutoff> specifies a radius for the surface, since all values equal too or less than this one will be plotted.

Although these files are written by default in Å, some programs (including jmol), read them in atomic units (bohr) by default. In the utilities/ folder, one can find the angstrom_to_bohr.pl script that converts the CUBE files to atomic units.

Plotting planes is also very easy, and the command is, for example:

> isosurface plane <plane_position> <other_options> "total_density.cube"

The field <plane_position> can either specify the axis that define your plane (e.g. xy) or three atoms, whose centers will specify the plane (syntax: (atomno=1) (atomno=2) (atomno=3)). The field <other_options> may contain all sorts of color scheme and/or cutoff specifications.

One can plot as many isosurfaces simultaneously as one wishes. The command to delete them is simply:

> isosurface delete

Some example images and their respective commands are shown in Figure 4.9. The CUBE files shown were all converted to atomic units.

Refer to caption
Refer to caption
Refer to caption
Refer to caption
Figure 4.9: Jmol plots of charge densities and orbitals.