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`](http://gaussian.com/formchk/) utility. I have used the [`cubegen`](http://gaussian.com/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. 




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](http://paulbourke.net/dataformats/cube/) (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.


 15