Mod:Hunt Research Group/cube format
Cube File Format
An example of a cube file for a water molecule is shown below. All the values are in atomic units.
water_test potential=scf Electrostatic potential from Total SCF Density 3 -4.970736 -4.970736 -4.745502 80 0.125841 0.000000 0.000000 80 0.000000 0.125841 0.000000 80 0.000000 0.000000 0.125841 8 8.000000 0.000000 0.000000 0.225233 1 1.000000 0.000000 1.434843 -0.900934 1 1.000000 0.000000 -1.434843 -0.900934 6.36109E-03 6.35763E-03 6.34801E-03 6.33185E-03 6.30877E-03 6.27839E-03 6.24033E-03 6.19421E-03 6.13966E-03 6.07631E-03 6.00381E-03 5.92182E-03 5.83003E-03 5.72815E-03 5.61590E-03 5.49307E-03 5.35946E-03 5.21493E-03 . . . -5.29768E-03 -5.43186E-03 -5.55576E-03 -5.66954E-03 -5.77340E-03 -5.86760E-03 -5.95239E-03 -6.02805E-03 -6.09489E-03 -6.15321E-03 -6.20336E-03 -6.24565E-03 -6.28043E-03 -6.30805E-03 -6.32884E-03 -6.34316E-03 -6.35135E-03 -6.35374E-03 -6.35067E-03 -6.34246E-03
(Optional) Lines 1-2: Comments
Format:
[comment_1] [comment_2]
Example:
water_test potential=scf Electrostatic potential from Total SCF Density
The first two lines in the file are comments. Conventionally, [comment_1] includes the name of the system and [comment_2] represents the content of the file.
Line 3: Number of atoms, the coordinates of the origin, the number of values
Format:
[N_atoms] [x_origin] [y_origin] [z_origin] [N_vals (opt)]
Example:
3 -4.970736 -4.970736 -4.745502
[N_atoms] represents the number of atoms in the system. This can be either a positive or negative number. In the case of molecular orbital output, [N_atoms] is negative and the cube file contains an additional section with the numbers of the orbitals before the lines containing the values at each point.
[x_origin], [y_origin] and [z_origin] are the coordinates of the reference point which represents the origin of the x, y and z vectors defined later on.
[N_vals] (if present) represents the number of values recorded at each point. If absent, the default value is 1. If [N_atoms] is negative, [N_vals] is either absent or 1. [N_vals] is 1 for densities, the norm of the density gradient, the Laplacian of the density and the potential, since they are all scalars. In the case of a gradient cube, [N_vals] is 4, since for each point it contains the density and the x, y and z components of the vector gradient of the density.
Lines 4-6: Number of voxels and the coordinates of the increment vector along each axis
Format:
[N_x] [x_x] [y_x] [z_x] [N_y] [x_y] [y_y] [z_y] [N_z] [x_z] [y_z] [z_z]
defines a set of unit vectors relative to the origin
Example:
80 0.125841 0.000000 0.000000 80 0.000000 0.125841 0.000000 80 0.000000 0.000000 0.125841
[N_x] represents the number of data points recorded along the x axis. [x_x], [y_x] and [z_x] represent the x, y and z coordinates of the increment vector along the x direction.
[N_y] represents the number of data points recorded along the y axis. [x_y], [y_y] and [z_y] represent the x, y and z coordinates of the increment vector along the y direction.
[N_z] represents the number of data points recorded along the z axis. [x_z], [y_z] and [z_z] represent the x, y and z coordinates of the increment vector along the z direction.
The X, Y and Z vectors defined in this section need not necessarily be orthogonal (i.e. [y_x],[z_x], [x_y], [z_y], [x_z], [y_z] can be non-zero).
Lines 7-([N_atoms]+6): Atoms
Format:
[atomic_number_1] [nuclear_charge_1] [x_1] [y_1] [z_1] [atomic_number_2] [nuclear_charge_2] [x_2] [y_2] [z_2] . . . [atomic_number_n] [nuclear_charge_n] [x_n] [y_n] [z_n]
Example:
8 8.000000 0.000000 0.000000 0.225233 1 1.000000 0.000000 1.434843 -0.900934 1 1.000000 0.000000 -1.434843 -0.900934
The following [N_atoms] lines contain information about the atoms in the system: the atomic number, the nuclear charge (can be different from the atomic number when an Effective Core Potential is used) and the x, y and z coordinates of each atom.
(Optional) Line(s) starting at ([N_atoms]+7) and ending before the lines containing the values: molecular orbitals
Format:
[N_MO] [id_1] [id_2] ... . . . ... [id_N_MO]
Example:
25 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
These lines are only present if [N_atoms] is negative (so for molecular orbital files). The first number (positive integer) represents the number of values that follow (i.e. the number of molecular orbitals). The following numbers are non-negative integers and represent the numbers of the molecular orbitals that are evaluated. The values can be displayed in one or multiple lines.
The rest of the lines in the file: values
Format:
[val_1_1_1] [val_1_1_2] [val_1_1_3] [val_1_1_4] [val_1_1_5] [val_1_1_6]
[val_1_1_7] [val_1_1_8] [val_1_1_9] [val_1_1_10] [val_1_1_11] [val_1_1_12]
.
.
.
... [val_1_1_[N_z]]
[val_1_2_1] [val_1_2_2] [val_1_2_3] [val_1_2_4] [val_1_2_5] [val_1_2_6]
[val_1_2_7] [val_1_2_8] [val_1_2_9] [val_1_2_10] [val_1_2_11] [val_1_2_12]
.
.
.
... [val_[N_x]_[N_y]_[N_z]]
Example:
6.36109E-03 6.35763E-03 6.34801E-03 6.33185E-03 6.30877E-03 6.27839E-03 6.24033E-03 6.19421E-03 6.13966E-03 6.07631E-03 6.00381E-03 5.92182E-03 5.83003E-03 5.72815E-03 5.61590E-03 5.49307E-03 5.35946E-03 5.21493E-03 . . . -5.29768E-03 -5.43186E-03 -5.55576E-03 -5.66954E-03 -5.77340E-03 -5.86760E-03 -5.95239E-03 -6.02805E-03 -6.09489E-03 -6.15321E-03 -6.20336E-03 -6.24565E-03 -6.28043E-03 -6.30805E-03 -6.32884E-03 -6.34316E-03 -6.35135E-03 -6.35374E-03 -6.35067E-03 -6.34246E-03
The values in the cube file are displayed in lines of (maximum) 6 values each, with the z indices in the innermost loop and the x indices in the outermost loop (i.e. for a given x index and a given y index, all the possible [N_z] values are displayed in lines of 6; when all the values have been displayed, a new line is inserted, the value of the y index is increased and all the [N_z] values for this new {x index, y index} pair are displayed in lines of 6).
The total number of values is [N_x]*[N_y]*[N_z]*[N_MO] for molecular orbital files and [N_x]*[N_y]*[N_z]*[N_vals] for all other files. The format and example shown above are for a non-molecular orbital file with [N_vals]=1.
The information on this page is adapted from http://h5cube-spec.readthedocs.io/en/latest/cubeformat.html and http://gaussian.com/cubegen/