Gaussian includes a standalone utility for generating cubes from the data in a formatted checkpoint file (equivalent to the previousCubekeyword). The utility is namedcubegen, and it has the following syntax:
cubegennprocs kind fchkfile cubefile npts formatcubefile2
The parameters, which are not case-sensitive, have the following meanings:
nprocs
Number of shared memory processors used for electrostatic potential calculations. A value of 0 is equivalent to 1 (it is the default). Note that this parameter must be included if other parameters are specified. Previously this parameter was used to specify the amount of memory to allocate. TheGAUSS_MEMDEFenvironment variable should be used instead.
kind
A keyword specifying the type of cube to generate:
MO=n | Molecular orbitaln. The keywordsHomo,Lumo,All,OccA(all alpha occupied),OccB(all beta occupied),Valence(all valence orbitals) andVirtuals(all virtual orbitals) may also be used in place of a specific orbital number. There is no default forn, and an error will occur if it is omitted.AMOandBMOcan be similarly used to select only alpha or beta orbitals (respectively). For open shell systems,Homoselects both alpha and beta orbitals. | |
Density=type | Total density of the specified type. Thetypekeyword is one of the single density selection options that are valid with theDensitykeyword:SCF,MP2,CI,QCI,and so on (note thatCurrentis not supported). TheFDensity=variation requests the use of the full instead of the frozen core density. The defaulttypekeyword isSCF. | |
Spin=type | Spin density (difference between α and β densities) of the specified type. | |
Alpha=type | Alpha spin density of the specified type.FAlpha=requests the use of the full instead of the frozen core density. | |
Beta=type | Beta spin density of the specified type.FBeta=requests the use of the full instead of the frozen core density. | |
Potential=type | Electrostatic potential using the density of the specified type. | |
Gradient | Compute the density and gradient. | |
Laplacian | Compute the Laplacian of the density (∇2ρ). | |
NormGradient | Compute the norm of the density gradient at each point. | |
CurrentDensity=I | Magnitude of the magnetically-induced (GIAO) current density, whereIis the applied magnetic field direction (X, Y or Z). | |
ShieldingDensity=IJN | Magnetic shielding densit}.Iis the direction of the applied magnetic field,Jis the direction of the induced field (X, Y or Z), andNis the number of the nucleus for which the shielding density (GIAO) is to be calculated. |
fchkfile
Name of the formatted checkpoint file.cubegenwill prompt for this filename if it is not specified.
cubefile
Name of the output cube file;test.cubeis the default if it is not explicitly specified (i.e., specifying the name of the checkpoint file does not change the default cube filename).
npts
Number of points per side in the cube. A value of0selects the default value of 803points distributed evenly over a rectangular grid generated automatically by the program (not necessarily a cube). Positive values ofnptssimilarly specify the number of points per “side”; e.g., 100 specified a grid of 1,000,000 (1003) points.
The values-2,-3and-4correspond to the keywordsCoarse,MediumandFineand to values of 3 points/Bohr, 6 points/Bohr and 12 points/Bohr (respectively). Negative values ofnpts≤-5 specify spacing ofnpts*10-3Angstroms between points in the grid.
A value of-1says to read the cube specification from the input stream, according to the following format:
IFlag, X0,Y0,Z0 | Output unit number and initial point. | |
N1,X1,Y1,Z1 | Number of points and step-size in the X-direction. | |
N2,X2,Y2,Z2 | Number of points and step-size in the Y-direction. | |
N3,X3,Y3,Z3 | Number of points and step-size in the Z-direction. |
format
Format of formatted output files:hmeans include header (this is the default);nmeans don’t include header. This parameter is ignored when unformatted cube files are produced.
cubefile2
If specified, the size for the generated cube is taken from this file. This option is useful when creating cubes for later arithmetic operations such as difference densities where you need the exact same grid to be used for all cubes. In order for the cube dimensions to be taken from the specified cube file, thenptsparameters must be -1 and the specified file must have been created with a header.
If no parameters are specified,cubegenwill prompt forfchkfileand run the following:
cubegen 1 density=scftest.cube 80 h
This generates a file namedtest.cube(with header) containing the SCF density in a rectangular grid of 803points.
All values in the cube file are in atomic units, regardless of the input units.
For density and potential grids, unformatted files have one row per record (i.e.,N1*N2records each of lengthN3). For formatted output, each row is written out in format (6E13.5). In this case, ifN3is not a multiple of six, then there may be blank space in some lines.
The norm of the density gradient and the Laplacian are also scalar (i.e., one value per point), and are written out in the same manner. Density+Gradient grids are similar, but with two writes for each row (of lengthsN3and 3*N3). Density+Gradient+Laplacian grids have 3 writes per row (of lengthsN3, 3*N3, andN3).
For example, for a density cube, the output file looks like this:
NAtoms, X-Origin, Y-Origin, Z-Origin NValNVal is the #points/valueN1, X1, Y1, Z1# of increments in the slowest running directionN2, X2, Y2, Z2 N3, X3, Y3, Z3# of increments in the fastest running directionIA1, Chg1, X1, Y1, Z1Atomic number, charge, and coordinates of the first atom… IAn, Chgn, Xn, Yn, ZnAtomic number, charge, and coordinates of the last atom(N1*N2) records, each of length N3Values of the density at each point in the grid
Note that a separate write is used for each record.
For molecular orbital output,NAtomswill be less than zero, and an additional record follows the data for the final atom (in format 10I5 if the file is formatted):
NMO, (MO(I),I=1,NMO)Number of MOs and their numbers
IfNMOorbitals were evaluated, then each record isNMO*N3long and has the values for all orbitals at each point together.
If one wishes to read the values of the density, Laplacian, or potential back into an array dimensioned X(N3,N2,N1), code like the following Fortran loop may be used:
Do 10 I1 = 1, N1 Do 10 I2 = 1, N2 Read(n,'(6E13.5)') (X(I3,I2,I1),I3=1,N3) 10 Continue
wherenis the unit number corresponding to the cube file.
If the origin is (X0,Y0,Z0), and the increment is (X1,Y1,Z1), then point (I1,I2,I3) has the coordinates:
X-coordinate:X0+(I1-1)*X1+(I2-1)*X2+(I3-1)*X3
Y-coordinate:Y0+(I1-1)*Y1+(I2-1)*Y2+(I3-1)*Y3
Z-coordinate:Z0+(I1-1)*Z1+(I2-1)*Z2+(I3-1)*Z3
The output is similar if the gradient or gradient and Laplacian of the charge density are also requested, except that in these cases there are two or three records, respectively, written for each pair of I1, I2values. Thus, if the density and gradient are to be read into arrays D(N3,N2,N1), G(3,N3,N2,N1), RL(N3,N2,N1), a correct set of Fortran loops would be:
Do 10 I1 = 1, N1 Do 10 I2 = 1, N2 Read(n,'(6F13.5)') (D(I3,I2,I1),I3=1,N3) Read(n,'(6F13.5)') ((G(IXYZ,I3,I2,I1),IXYZ=1,3), I3=1,N3) 10 Continue
where againnis the unit number corresponding to the cube file.
Last update: 3 November 2014