Cube file -- density gradient

87 views
Skip to first unread message

Olaseni Sode

unread,
Apr 4, 2021, 2:59:13 PM4/4/21
to molpro-user

Hi,

I have a question about the cube file output format. The manual states that when the density gradient is specified, "there is first a record of length n_3 containing the density, then one of length 3n3 containing the gradient, with the three cartesian components contiguous." 

I did a simple helium calculation (below) and even though the gradient and density cube files have different grid values they both have the same length. I'm wondering if I'm misunderstanding the manual and how best I should interpret the density gradient cube output, since it doesn't have the 3 n_3 length.

***,helium


ANGSTROM

GEOMETRY={

He

}


gexpec,ekin

BASIS=6-31G*

KS,B3LYP


{cube,he1;gradient}


Thanks for your help.

Seni


andreas...@gmail.com

unread,
Apr 5, 2021, 2:26:31 PM4/5/21
to molpro-user
Dear Seni,

there is indeed something wrong in the corresponding subroutine 'writeblock' for the
case that the gradient shall be written to the cube file. I have no idea whether this
was ever tested some time. The fix, however, is easy and I am going to make a patch
which I will mark so it gets backported also to the current users version.

I am generally wondering, however, if it would not be better to have separate cube
files for drho/dx, drho/dy and drho/dz since already a cube file for a single quantity
can get quite large. Are there external programs which understand cube files
with gradient values? Let me know what you think?

If you only need the values for Helium and do not plan to read in the cube file
with an external program like Jmol or Molden you can save disk space by
using, e.g.:

{cube,he1,,1,1,40; ...}

in which case only 40 points along the z-direction will be written to the cube file.

Best wishes,
Andreas

Olaseni Sode

unread,
Apr 6, 2021, 3:24:12 AM4/6/21
to molpro-user
Hi Andreas,

Thanks for addressing this.

For my purposes, the format of the cube file doesn't really matter, nor does the size really. I'm just going to do some simple analysis on it. The helium example was just to see if I was making some obvious mistake with the density gradient, but I'm planning on evaluating the density for more complex and less symmetric molecules in the future. 

I'm not sure what other programs out there make use of the gradient, but the standard format seems to be what is described in the manual. This seems like it's OK, since it's only 4x larger than the regular density cube file.

Thanks.
Seni

andreas...@gmail.com

unread,
Apr 6, 2021, 3:11:58 PM4/6/21
to molpro-user
Dear Seni,

I have made a patch for this and marked it to be backported to 2020.2.
Note that it is currently done such that the density and the density gradient
are written to separate cube files (like he_density.cube and he_gradient.cube).
So the current description in the manual is not quite correct about this.
Reply all
Reply to author
Forward
0 new messages