Search the Site Index:





cubegen g16

[wonderplugin_tabs id=”16″ inline=”1″]
[wonderplugin_tab_content]

Description

Gaussian includes a standalone utility for generating cubes from the data in a formatted checkpoint file (equivalent to the previous Cube keyword). The utility is named cubegen, and it has the following syntax:

cubegen kind  inputfile  outputfile  cubespec  format  inputfile2  iprint UseB

All arguments are optional, although at least the first three are generally specified for non-interactive mode (see “Additional Notes on Arguments” below). The arguments have the following meanings:

kind

A keyword specifying the type of cube to generate:

MO=list The specified list of molecular orbital(s). The list, which is required, can include orbital numbers and ranges, with entries separated by commas; no internal spaces are allowed. The keywords Homo (for open shell systems, selects both alpha and beta orbitals), Lumo, All, OccA (all alpha occupied), OccB (all beta occupied), Valence (all valence orbitals) and Virtuals (all virtual orbitals) may be included in the list. AMO and BMO can be used to select only alpha or beta orbitals (respectively). For UHF wavefunctions, all alpha MOs are numbered first, followed by all beta; however for BMO, numbering starts at 1.
Density=type Total density of the specified type. The type keyword is one of the single density selection options that are valid with the Density keyword: SCF, MP2, CC, CI, and so on (note that Current is not supported). The FDensity form requests the use of the full instead of frozen core density. The default density type is the SCF density.
Alpha=type Alpha spin density of the specified type. The FAlpha form requests the use of the full instead of frozen core density.
Beta=type Beta spin density of the specified type. The FBeta form requests the use of the full instead of frozen core density.
If the density is from a semi-empirical model, orbitals are transformed from the orthogonalized AO basis to the AO basis so that their integrated square values will be normalized.
Spin=type Spin density (difference between α and β densities) of the specified type. The fspin form requests the use of the full instead of frozen core density.
VSpin Spin vector evaluated at each point, producing X, Y and Z values. Generally only of interest for GHF wavefunctions.
AtDens Density from the superposition of spherical atomic densities. Typically used to form the difference between the molecular density and this superposition using the CubMan utility.
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.
Potential=type Electrostatic potential using the density of the specified type.
Field=type Electrostatic potential and electric field (i.e., the potential and its first derivative), using the density of the specified type. 4 quantities are stored for each point.
EFG=type Electrostatic potential, electric field and electric field gradient (i.e., the potential and its first and second derivatives), using the density of the specified type. 10 quantities are stored for each point.
CurrentDensity=I Magnitude of the magnetically-induced (GIAO) current density, where I is the applied magnetic field direction (X, Y or Z).
ShieldingDensity=IJN Magnetic shielding density. I is the direction of the applied magnetic field, J is the direction of the induced field (X, Y or Z), and N is the number of the nucleus for which the shielding density (GIAO) is to be calculated.
AllXC[=density] Evaluate all the variables used in XC functionals at each grid point. The desired density can be specified (the default is the SCF density). If the density is spin-aligned (RHF or UHF), then there are 12 values generated at each point: Rho, Grad-RhoX, Y, Z, Tau and the Laplacian, first for alpha spin and then beta spin. For GHF densities there are 24 values: the preceding list for alpha and for beta, followed by 12 more for X and Y, from the symmetric real and symmetric imaginary parts of the alpha-beta block of the density.
VXC=IExCor Evaluate the XC potential and XC field for functional number IExCor, where the latter is the number of the functional used in IOp(3/74) (which can be displayed using TestRt). There are always 4 values for each point. For collinear densities, the X and Y components of the field are all zero.
ELF[=density] The Electron Localization Function for the total spin density from the specified model (the default is the SCF density). The forms ELA and ELB select the alpha or beta spin density instead of the total spin density (respectively).
EDR[=density] The Electron Delocalization Range for the total spin density from the specified model (the default is the SCF density). The forms EDA and EDB select the alpha or beta spin density instead of the total spin density (respectively).
EDM[=density] The maximum value of the Electron Delocalization Range at each point for the total spin density from the specified model (the default is the SCF density). The forms EMA and EMB select the alpha or beta spin density instead of the total spin density (respectively).
UMax[=density] The length at which the Electron Delocalization Range has its maximum value at each point for the total spin density from the specified model (the default is the SCF density). The forms UMA and UMB select the alpha or beta spin density instead of the total spin density (respectively).
NCI[=density] Evaluate the NCI for the total spin density from the specified model (the default is the SCF density). The forms NCA and NCB select the alpha or beta spin density instead of the total spin density (respectively).
Basis[=N] Evaluate the AO basis functions and up to their Nth derivatives at each point, where N≤4. The default is to evaluate just the functions and no derivatives (N=0). There will be 1, 4, 10, 20, or 35 values for each basis function at each point. The components of the 2nd-4th derivatives can be addressed using the following arrays (1=X, 2=Y, 3=Z for I,J,K,L), with indexing starting at 1 (the function value):
   Ind2(I,J) = 5,8,9,8,6,10,9,10,7
 
   Ind3(I,J,K) = 20,19,18,19,17,16,18,16,15,19,17,16,17,14,13,16,13,12,18,16,15,16,13,12,15,12,11
 
   Ind4(I,J,K,L) = 35,34,33,34,32,31,33,31,30,34,32,31,32,29,28,31,28,27,33,31,30,
            31,28,27,30,27,26,34,32,31,32,29,28,31,28,27,32,29,28,29,25,
            24,28,24,23,31,28,27,28,24,23,27,23,22,33,31,30,31,28,27,30,
            27,26,31,28,27,28,24,23,27,23,22,30,27,26,27,23,22,26,22,21

inputfile

File containing the results from a calculation. The type of file is specified by the extension: .fchk (formatted checkpoint file, the default), .chk (binary checkpoint file), .baf (binary array file) or .faf (Fortran unformatted array file). cubegen will prompt for this filename if it is not specified.

outputfile

Name of the output file; the file type is determined by the extension: .faf or .baf for a binary array file is written, .cube (the default) for a text cube file or .ucube for a Fortran unformatted cube file. test.cube is the default if this argument is omitted; note that specifying the name of the checkpoint file does not change the base name of the default cube file.

The results in a BAF or FAF will be in an array labeled “Evaluated Properties.” The file will also contain either the specifications for a rectangular grid (labeled “Cube Dimensions” and “Cube Origin and Axes”) or an array of coordinates of the points specified for an arbitrary list of points (labeled “Points for property evaluation”) if a list of points was provided in the input stream or an input BAF, or an array of the quadrature weights and coordinates (labeled “3D Quadrature Grid”) if this was read from an input BAF.

cubespec

This parameter specifies where to find or how to compute the coordinates of the points in the cube: i.e., where properties are to be evaluated. A positive integer specifies the number of points per dimension (“side”) in the cube, based on a 10-6 e/Bohr3 isodensity surface: e.g., 100 specifies a grid of 1,000,000 (1003) points. A value of 0 selects the default value of 803 points distributed evenly over a rectangular grid generated automatically by the program (not necessarily a cube).

If the specified value is negative and of the form -IIIIJJJJJJ -6 e/Bohr3 isodensity surface and will have JJJJJJ*0.0001 Angstroms between points in each direction. If IIII is non-zero, then both the box dimensions and the number of points in each direction will be scaled up by a factor of 1 + IIII*0.1.

Other negative values >-8 are equivalent to defined keywords selecting specific cube dimensions or cube specification source locations. The keywords CoarseCube (-2), MediumCube (-3) and FineCube (-4) correspond to values of 3 points/Bohr, 6 points/Bohr and 12 points/Bohr (respectively).

InputList (-5) says to read the list of coordinates for the points to use from the input stream (if entered manually, terminate the list with an end-of-file character (i.e., Ctrl-D under Unix). The coordinates should be specified in Angstroms. FileList (-7) similarly says to read the point list from the file specified as inputfile2. If the latter is a BAF/FAF or if the FromBAF keyword (-6) is used, then the points are retrieved from the BAF/FAF file inputfile2 from the array labeled “Points for property evaluation” if present, or else the one labeled “3D Quadrature Grid.”

The keyword CubeRead (-1) says to read the cube specification from the input stream or from a second input file, 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 1-direction.
N2, X2, Y2, Z2   Number of points and step-size in the 2-direction.
N3, X3, Y3, Z3   Number of points and step-size in the 3-direction.

|IFlag| is the output unit number. If IFlag is less than 0, then a formatted file will be produced; otherwise, an unformatted file will be written.

If N1<0, the input cube coordinates are assumed to be in Bohr, otherwise, they are interpreted as Angstroms. |N1| is used as the number of X-direction points in any case; N2 and N3 specify the number of points in the Y and Z directions, respectively. Note that the three axes are used exactly as specified; they are not orthogonalized, so the grid need not be rectangular.

format

For formatted cube files, the value h means include the header (this is the default); n means don't include the header. This parameter is ignored when unformatted cube files are produced. If output file is a BAF/FAF, the keywords i4 and i8 indicate whether the file should use 4 or 8 byte integers, respectively. The default is i4 for a BAF and i8 for a FAF.

inputfile2

Specifies a second input file whose contents are used as described for the various arguments.

iprint

Debug print level: successive positive values turn on more and more debugging print in the output. The default is 0 (no debug messages).

UseB

If this keyword is specified, then the default cube parameters will be based on only those atoms which have basis functions. This is useful when calculating a cube based on an ONIOM model system calculation.

Additional Notes on Arguments

  • The utility also accepts the bare digit 0 as the first argument (i.e., preceding the cube type keyword) for compatibility with previous versions. It is ignored.
  • If no arguments are specified, cubegen will prompt for input file and run the following command which generates a cube of the SCF density over a rectangular grid of 803 points into a text file named test.cube (with header): cubegen density=scf inputfile test.cube 80 h
  • The defined keywords for cubegen arguments are not case-sensitive.

Output File Formats

In general, all values in the cube file are in atomic units, regardless of the input units. The exception to this are the cube files created with a user-provided arbitrary list of points (npts=-5). In this case, the output cube will contain one line per point, with the first 3 values of each line being the Cartesian coordinates of the point in Angstroms (just as given in the input), followed by the values of the reported properties (density, ESP, etc) in atomic units.

Densities, the norm of the density gradient, the Laplacian of the density, and the potential are scalars (i.e. one value per point, NVal=1). A gradient cube contains the density plus the vector gradient of the density, so it has four values per point (NVal=4): i.e. the value of the density plus the X, Y, and Z components of its gradient.

Cube files have one row per record (i.e., N1*N2 records each of length N3*NVal). For formatted output, each row is written out in format (6E13.5). In this case, if N3*NVal is not a multiple of six, then there may be blank space in some lines.

For example, schematically, cube files will look like this:

NAtoms, X-Origin, Y-Origin, Z-Origin, NVal NVal is the # of values/point
N1, X1, Y1, Z1 # of increments in the slowest running direction
N2, X2, Y2, Z2  
N3, X3, Y3, Z3 # of increments in the fastest running direction
IA1, Chg1, X1, Y1, Z1 Atomic number, charge, and coordinates of the first atom
…  
IAn, Chgn, Xn, Yn, Zn Atomic number, charge, and coordinates of the last atom
(N1*N2) records, each length N3*NVal Values at each point in the grid

Note that a separate write is used for each record.

For molecular orbital output, NAtoms will 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

If NMO orbitals were evaluated, then each record is NMO*N3 long and has the values for all orbitals at each point together (in this case NMO=NVal).

Reading Cube Files with Fortran Programs

If one wishes to read the values of a cube file back into an array dimensioned X(NVal,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(IVal,I3,I2,I1),IVal=1,NVal)I3=1,N3)
10 Continue

where n is the unit number corresponding to the cube file.

[/wonderplugin_tab_content]
[wonderplugin_tab_content]

Note that these options must be placed immediately after the cubegen command, before all required and optional parameters.

-m=n

Specifies the amount of memory to allocate to the utility, where n is an amount optionally followed by units (the default unit is bytes).

-c=cpulist

Specifies the list of CPUs/cores that can be used by the utility. On the command line, the list will typically need to be enclosed in quotation marks to protect it from the shell.

-p=n

Use n processors (deprecated in favor of -c).

[/wonderplugin_tab_content]
[wonderplugin_tab_content]

The following command creates cubes for the HOMO and LUMO from the data in the file ts.chk. The cubes use the default dimensions and will be stored into the file mo.cube.

cubegen mo=homo,lumo ts.chk mo.cube

The following command creates an excited state density cube, using a grid of 6 points/Bohr, taking the data from the checkpoint file named exited.chk. The output will be a BAF file, and processors 0 through 3 will be used for the job.

cubegen -c=0-3 density=ci excited.chk vertex.baf mediumcube

The following command creates the file sden.cube (with header) from the SCF spin density in the file vs.fchk. The dimensions for the cube will be read from the file cubespec.txt.

cubegen spin vs.fchk sden.cube cuberead h cubespec.txt

These are the contents of the cube specification file cubespec.txt:

   -1   -3.779452    0.000000   -3.779452    
   59    0.000000    0.000000    0.188972
    1    0.000000    0.000000    0.000000
   62    0.188972    0.000000    0.000000

The following command computes the XC potential and XC field for the functional PBEPBE for each point in the grid defined in the file test0983.cubedim, storing it in test0983-bxc.cube. The results file used is test0983.fchk.

cubegen vxc=10009 test0983a.fchk test0983-bxc.cube -1 h test0983.cubedim

[/wonderplugin_tab_content]
[/wonderplugin_tabs]

Last updated on: 13 May 2025. [G25 Rev. A.01]

SideMenu

SideMenu