# How to visualise the total electron density from a Gaussian 16 calculation?

I am trying to generate a 3D visualisation of the total electron density of a molecule. Using Gaussian 16, I have optimised this structure, with DFT, and formatted the resulting .chk file into a .fchk using the formchk utility. I have used the cubegen utility:

cubegen 0 fdensity=scf molecule.fchk molecule.cube -5 h <0.20_3d_cube.xyz


to generate a .cube file with 0.20 angstrom spacing about a cube of the molecule.

However, the resulting .cube file fails to visualise any total electron density in visualisation software. Gaussview 6 fails to create a surface, prompting an error:

Surface build failed! Processing mesh, No data to plot. IsoValue may be out of range

VMD allows the visualisation of an isosurface, but visually nothing appears.

• Can you try with npts -1 instead of -5? According to the gaussian manual it has to be set to -1 in case you are using the cubefile2 option – DSVA Apr 5 '18 at 11:49
• The syntax appears to be in order. I have never used this approach before, i.e. specifying the box manually. Have you tried something simpler, like cubegen 0 fdensity=scf molecule.fchk molecule.cube -4 h? Did that work? You should be able to visualise the scf density from within GV only reading in the output, checkpoint, or formatted checkpoint file. – Martin - マーチン Apr 5 '18 at 11:51
• You can also visualize the electron density directly in Avogadro using just the fchk file. See this video for a short (3 min) tutorial. youtube tutorial video – Charlie Crown Jul 9 at 5:18

When GaussView gives you the error

Surface build failed! Processing mesh, No data to plot. IsoValue may be out of range

it means that the data in your .cube file doesn't have values of density at that isovalue. So when it tries to plot a surface, it cannot plot anything.

The IsoValue (default is 0.00040, I believe) means that you construct a surface at every place in the density where the density equals the IsoValue ('iso' = 'same'). So for the default, it opens up your .cube file and looks for the cube coordinates that have density at (or near) 0.00040, and plots a surface that connects these points (this is your 'mesh').

Most likely, your density values are too small large to plot an isosurface at this value. Try making the default density isovalue in GaussView to be something smaller larger and go from there. (Practically, I'd keep shifting an order of magnitude until a surface builds, e.g. try a value of 0.004 next).

Even better, you should look into the .cube file itself to see what your volumetric data looks like. The first few lines define the grid spacing and dimensions of the cube, but then you will see a bunch of floating point values. Here's an example .cube I took from this site (also a good reference):

CPMD CUBE FILE.
OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
3    0.000000    0.000000    0.000000
40    0.283459    0.000000    0.000000
40    0.000000    0.283459    0.000000
40    0.000000    0.000000    0.283459
8    0.000000    5.570575    5.669178    5.593517
1    0.000000    5.562867    5.669178    7.428055
1    0.000000    7.340606    5.669178    5.111259
-0.25568E-04  0.59213E-05  0.81068E-05  0.10868E-04  0.11313E-04  0.35999E-05
:             :             :           :            :            :
:             :             :           :            :            :
:             :             :           :            :            :
In this case there will be 40 x 40 x 40 floating point values
:             :             :           :            :            :
:             :             :           :            :            :
:             :             :           :            :            :


Look at the value of your floating point numbers at the end. As a starting point, pick a number for your isovalue that is about an order of magnitude less than your largest values, and adjust from there.

If your values are all at or near zero (so, practically speaking, on the order of 1E-8 or lower) then you need to revisit how you are generating the .cube file, since your cube is not capturing any density---then it's a cubegen issue not an isosurface issue.