<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://sagacioushours.org.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Mod%3AHunt_Research_Group%2Fcube_files</id>
	<title>Mod:Hunt Research Group/cube files - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://sagacioushours.org.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Mod%3AHunt_Research_Group%2Fcube_files"/>
	<link rel="alternate" type="text/html" href="https://sagacioushours.org.uk/wiki/index.php?title=Mod:Hunt_Research_Group/cube_files&amp;action=history"/>
	<updated>2026-05-26T09:28:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://sagacioushours.org.uk/wiki/index.php?title=Mod:Hunt_Research_Group/cube_files&amp;diff=2355&amp;oldid=prev</id>
		<title>Wikiadmin: Created page with &quot;=Manipulating Cube Files=  ==cubegen== *use the cubegen utility to generate cube files, [http://gaussian.com/cubegen/ link] *command format is &lt;b&gt;cubegen nprocs  kind  fchkfil...&quot;</title>
		<link rel="alternate" type="text/html" href="https://sagacioushours.org.uk/wiki/index.php?title=Mod:Hunt_Research_Group/cube_files&amp;diff=2355&amp;oldid=prev"/>
		<updated>2020-11-25T04:34:12Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;=Manipulating Cube Files=  ==cubegen== *use the cubegen utility to generate cube files, [http://gaussian.com/cubegen/ link] *command format is &amp;lt;b&amp;gt;cubegen nprocs  kind  fchkfil...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Manipulating Cube Files=&lt;br /&gt;
&lt;br /&gt;
==cubegen==&lt;br /&gt;
*use the cubegen utility to generate cube files, [http://gaussian.com/cubegen/ link]&lt;br /&gt;
*command format is &amp;lt;b&amp;gt;cubegen nprocs  kind  fchkfile  cubefile npts header&amp;lt;/b&amp;gt;&lt;br /&gt;
*OR &amp;lt;b&amp;gt;cubegen nprocs  kind  fchkfile  cubefile npts header cubefile2&amp;lt;/b&amp;gt;&lt;br /&gt;
*some simple examples:&lt;br /&gt;
:: cubegen 0 density=scf file.chk file_dens.cube 0 h (density)&lt;br /&gt;
:: cubegen 0 potential=scf file.chk file_esp.cube 0 h (electrostatic potential ESP)&lt;br /&gt;
:: cubegen 0 mo=14 file.chk file_mo14.cube 0 h (molecular orbital no 14)&lt;br /&gt;
*nprocs &lt;br /&gt;
::use 0 for the default to use machine specific default value&lt;br /&gt;
*kind&lt;br /&gt;
::use density=gradient to generate the density and gradient&lt;br /&gt;
::use density=lablacian to compute the laplacian&lt;br /&gt;
*npts&lt;br /&gt;
::normally you would use npts=0 (the default)&lt;br /&gt;
::npts default of 0 selects a default value of 80&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; points distributed evenly over a rectangular grid generated automatically by the program, frequently not a cube! &lt;br /&gt;
::npts a positive value specifies the number of points per &amp;quot;side&amp;quot;; e.g., 100 specifies a grid of  100&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; points&lt;br /&gt;
::npts a negative value of -2, -3 and -4 correspond to  Coarse, Medium and Fine grids and to 3 points/Bohr, 6 points/Bohr and 12 points/Bohr (respectively). &lt;br /&gt;
::npts a negative values  &amp;lt; -5 specifies spacing of npts*10&amp;lt;sup&amp;gt;-3&amp;lt;/sup&amp;gt; Angstroms between points in the grid.&lt;br /&gt;
::npts a negative value of -1 lets you manipulate the files more exactly, information is provided in the input stream&lt;br /&gt;
::you can provide the key information yourself in this format&lt;br /&gt;
&amp;lt;pre&amp;gt;IFlag, X0, Y0, Z0 Output unit number, the reference point for the following&lt;br /&gt;
N1, X1, Y1, Z1 Number of points and step-size in the X-direction.&lt;br /&gt;
N2, X2, Y2, Z2 Number of points and step-size in the Y-direction.&lt;br /&gt;
N3, X3, Y3, Z3 Number of points and step-size in the Z-direction.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::IFlag=output unit number, positive IFlag produces an unformatted file, negative IFlag produces a formatted file&lt;br /&gt;
::N1,N2,N3 &amp;lt;0 the input coordinates are in Bohr, otherwise they are in Angstrom&lt;br /&gt;
::there are issues with the EOF so in unix terminate with a &amp;lt;b&amp;gt;^D&amp;lt;/b&amp;gt; command if you enter by hand&lt;br /&gt;
::example&lt;br /&gt;
::we want a box, ie orthogonal vectors &lt;br /&gt;
&amp;lt;pre&amp;gt;-22, 1.0, 1.0, 1.0 &lt;br /&gt;
20, 0.25, 0.0,  0.0 &lt;br /&gt;
20, 0.0, 0.25, 0 &lt;br /&gt;
20, 0.0, 0.0, 0.25 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: output will be a fort.22 file&lt;br /&gt;
:: the box is positioned to start at 1.0,1.0,1.0&lt;br /&gt;
:: we take 20 points and place them along the x-direction in intervals of 0.25 ie at 1.0, 1.25, 1.50, 1.75 ...&lt;br /&gt;
:: we take 20 points and place them along the y-direction in intervals of 0.25 ie at 1.0, 1.25, 1.50, 1.75 ...&lt;br /&gt;
:: we take 20 points and place them along the z-direction in intervals of 0.25 ie at 1.0, 1.25, 1.50, 1.75 ...&lt;br /&gt;
::you can put all of this information into a file and pipe it into the cubgen command&lt;br /&gt;
::cubegen 0 MO=14 file.chk file_mo14.cube -1 h (density) &amp;lt; cubegen.dat (NOTE not sure about this!)&lt;br /&gt;
*h means include a header, n means don't include a header&lt;br /&gt;
*when combining two cube files they must be &amp;lt;b&amp;gt;exactly the same size/type&amp;lt;/b&amp;gt;&lt;br /&gt;
::you must also have generated the original chk files with the keyword &amp;lt;b&amp;gt;nosymm&amp;lt;/b&amp;gt; so that atomic centers are not reoriented&lt;br /&gt;
::luckily you don't have to specify the cube file size exactly, there is a shortcut, you can specify an already generated cube file and the new file cube generated will use exactly the same parameters taken from this file&lt;br /&gt;
::the first file must have been generated &amp;lt;b&amp;gt;with a header&amp;lt;/b&amp;gt;&lt;br /&gt;
::and you must use &amp;lt;b&amp;gt;npts=-1&amp;lt;/b&amp;gt;&lt;br /&gt;
::&amp;lt;b&amp;gt;cubegen 0  density=scf  fchkfile  cubefile1 -1 h cubefile2&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==cubman==&lt;br /&gt;
*use the cubeman utility to generate cube files, [http://gaussian.com/cubman/ link]&lt;br /&gt;
*if manipulating cube files they must have the same number of points!&lt;br /&gt;
*an example output is below cubman	 &lt;br /&gt;
*the information presented is all in shorthand&lt;br /&gt;
::input cubes are A and B&lt;br /&gt;
::output cube is O&lt;br /&gt;
::N for “negative values” or for “nuclear”, depending on the context&lt;br /&gt;
::P for “positive values” &lt;br /&gt;
::E for “electronic” &lt;br /&gt;
::C for “charge”&lt;br /&gt;
::Dip for “dipole”&lt;br /&gt;
::Sum for ~ldq∑rdq~&lt;br /&gt;
::Max for “maximum”&lt;br /&gt;
::Min for “minimum.” &lt;br /&gt;
*for example &lt;br /&gt;
::SumAP is the sum of the positive values in the first cube&lt;br /&gt;
::SumBN is the sum of the negative values in the second cube&lt;br /&gt;
::SumOP is the sum of the positive values in the output cube&lt;br /&gt;
::CBMax is the maximum charge for the second cube&lt;br /&gt;
::CBMin is the minimum charge for the second cube&lt;br /&gt;
::SumO is the sum of the values in the output cube, including both positive and negative values.&lt;br /&gt;
::DipOE is the electronic contribution to the dipole moment in output cube&lt;br /&gt;
::DipON is the nuclear contribution to the dipole moment in output cube. &lt;br /&gt;
::DipO is the total dipole moment in the output cube&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Action [Add, Copy, Difference, Properties, SUbtract, SCale, SQuare, SProd, Vprod, Magnitude, Normalize, SElect, ToXYZ ]? SU&lt;br /&gt;
First input? bmimCl_front_esp.cube&lt;br /&gt;
Is it formatted [no,yes,old,veryold,unfold]? y&lt;br /&gt;
 Opened formatted file bmimCl_front_esp.cube.&lt;br /&gt;
Second input? bmimCl_front_add_esp.cube&lt;br /&gt;
Is it formatted [no,yes,old,veryold,unfold]? y&lt;br /&gt;
 Opened formatted file bmimCl_front_add_esp.cube.&lt;br /&gt;
Output file? bmimCl_front_diff_esp.cube&lt;br /&gt;
Should it be formatted [no,yes]? y&lt;br /&gt;
 Opened formatted file bmimCl_front_diff_esp.cube.&lt;br /&gt;
Input file titles:&lt;br /&gt;
 Title Card Required potential=scf&lt;br /&gt;
 Electrostatic potential from Total SCF Density&lt;br /&gt;
Input file titles:&lt;br /&gt;
  Title Card Required potential=scf ||  Title Card Required potential=scf&lt;br /&gt;
  Electrostatic potential from Total SCF +  Electrostatic potential from Total S&lt;br /&gt;
Warning:  Mismatch in files:&lt;br /&gt;
NAtomA=   26 NAtomB=   25&lt;br /&gt;
N1A=      99 N1B=      99&lt;br /&gt;
N2A=      88 N2B=      88&lt;br /&gt;
N3A=      59 N3B=      59&lt;br /&gt;
N4A=       1 N4B=       1&lt;br /&gt;
&lt;br /&gt;
 SumAP=  475.8505107503 SumAN= -130.8410024346 SumA=  345.0095083157&lt;br /&gt;
 CAMax=  106.5150000000 XYZ=    1.3813040000    5.4385200000   -0.3367420000&lt;br /&gt;
 CAMin=   -0.1237780000 XYZ=    1.0991260000    7.6959440000   -2.5941660000&lt;br /&gt;
&lt;br /&gt;
 SumBP=  516.9086440282 SumBN= -186.5554469490 SumB=  330.3531970792&lt;br /&gt;
 CBMax=  106.4860000000 CBMin=   -0.1676300000&lt;br /&gt;
&lt;br /&gt;
 SumOP=   63.0963538336 SumON=  -48.4400425970 SumO=   14.6563112365&lt;br /&gt;
 COMax=    0.0670800000 COMin=   -0.0387900000&lt;br /&gt;
&lt;br /&gt;
 DipAE=  -96.0692206364 1848.0174549921  -60.0829076681&lt;br /&gt;
 DipAN=    0.0000060000   -0.0000250000   -0.0000120000&lt;br /&gt;
 DipA=   -96.0692146364 1848.0174299921  -60.0829196681&lt;br /&gt;
&lt;br /&gt;
 DipBE=  -94.9632888467 2577.9330800437  -90.2148993076&lt;br /&gt;
 DipBN=  -22.7263250000  -94.0295580000    6.4423760000&lt;br /&gt;
 DipB=  -117.6896138467 2483.9035220437  -83.7725233076&lt;br /&gt;
&lt;br /&gt;
 DipOE=   -1.1059317897 -729.9156250516   30.1319916394&lt;br /&gt;
 DipON=    0.0000060000   -0.0000250000   -0.0000120000&lt;br /&gt;
 DipO=    -1.1059257897 -729.9156500516   30.1319796394&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==cube file format ==&lt;br /&gt;
If one wishes to read the values of the density, Laplacian, or potential back into an array dimensioned X(N3,N2,N1), code like the following Fortran loop may be used:&lt;br /&gt;
&lt;br /&gt;
      Do 10 I1 = 1, N1&lt;br /&gt;
      Do 10 I2 = 1, N2&lt;br /&gt;
         Read(n,'(6E13.5)') (X(I3,I2,I1),I3=1,N3)&lt;br /&gt;
      10 Continue&lt;br /&gt;
where n is the unit number corresponding to the cube file.&lt;br /&gt;
&lt;br /&gt;
If the origin is (X0,Y0,Z0), and the increment is (X1,Y1,Z1), then point (I1,I2,I3) has the coordinates:&lt;br /&gt;
&lt;br /&gt;
X-coordinate: X0+(I1-1)*X1+(I2-1)*X2+(I3-1)*X3&lt;br /&gt;
&lt;br /&gt;
Y-coordinate: Y0+(I1-1)*Y1+(I2-1)*Y2+(I3-1)*Y3&lt;br /&gt;
&lt;br /&gt;
Z-coordinate: Z0+(I1-1)*Z1+(I2-1)*Z2+(I3-1)*Z3&lt;br /&gt;
&lt;br /&gt;
The output is similar if the gradient or gradient and Laplacian of the charge density are also requested, except that in these cases there are two or three records, respectively, written for each pair of I1, I2 values. Thus, if the density and gradient are to be read into arrays D(N3,N2,N1), G(3,N3,N2,N1), RL(N3,N2,N1), a correct set of Fortran loops would be:&lt;br /&gt;
&lt;br /&gt;
      Do 10 I1 = 1, N1&lt;br /&gt;
      Do 10 I2 = 1, N2&lt;br /&gt;
         Read(n,'(6F13.5)')  (D(I3,I2,I1),I3=1,N3)&lt;br /&gt;
         Read(n,'(6F13.5)')  ((G(IXYZ,I3,I2,I1),IXYZ=1,3), I3=1,N3)&lt;br /&gt;
 10   Continue&lt;br /&gt;
where again n is the unit number corresponding to the cube file.&lt;/div&gt;</summary>
		<author><name>Wikiadmin</name></author>
		
	</entry>
</feed>