Cube (.cub, .cube)

Background & Context

    • MIME type: chemical/x-cubeGaussian cube file.
    • Used by electronic structure programs to store orbital or density values on a three-dimensional grid.
    • Plain-text format.
    • Can contain volumetric data for an arbitrary number of orbitals.
    • Maintained by Gaussian, Inc.

Import & Export

  • Import["file.cub"] imports a list of molecules from a Cube file.
  • Export["file.cub",expr] exports a molecule or list of molecules to a Cube file.
  • Import["file.cub",elem] imports the specified element from a Cube file.
  • Import["file.cub",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","Cube"] or Import["file",{"Cube",elem,}].
  • Export["file.cub",mol] creates a Cube file from a molecule containing a "VolumetricData" key in its MetaInformation.
  • Export["file.cub",{expr1,expr2,},{{elem1,elem2,}}] treats each expri as specifying the corresponding elemi.
  • Export["file.cub",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
  • Export["file.cub",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
  • When creating a Cube file, volumetric data can be either in the molecule expression as MetaInformation or given to Export as a separate element.
  • See the following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Import Elements

  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties and settings
  • Data elements:
  • "Molecule"a symbolic representation of the molecule model
    "VolumetricData"an Association containing the electronic orbital information
    "Graphics3D"a 3D graphic containing a model of the molecule along with contours representing electronic isosurfaces
  • The "VolumetricData" element contains the following keys:
  • "DataRange"a list of bounding box coordinates {{xmin,xmax},{ymin,ymax},{zmin,zmax}}
    "Data"a list of three-dimensional arrays specifying the value of the orbital wavefunction or density on a grid
    "OrbitalNumber"an optional list specifying numerical values for the orbitals



open allclose all

Basic Examples  (3)

Import and plot the electronic density from a Cube file:

Import and plot a Cube file containing two orbitals:

Import a molecule from a Cube file:

Find a matching Entity for the molecule:

Find the volumetric data in the molecule's MetaInformation:

Export the molecule to a Cube file:

Import Elements  (1)

Import the volumetric data for two molecular orbitals from a Cube file:

Export Elements  (1)

Export a molecule and data to a Cube file:

Import Options  (1)

Specify the value and style for the orbital isosurface:

Use textures for the surfaces: