Subject: Gaussian cube visualization

From: Dongchul Lim <[email-masked]>
Date: Mon, 7 Oct 96 13:47:47 EDT

There have been many questions regarding visualization of
the data generated by Gaussian CUBE.
One way to visualize the CUBE data, e.g., isoelectron
density and electrostatic potential, is to use the PSI88
package, although it's noninteractive.
That is, you convert 3D volume data from a cube file into
a format suitable for PSICON. Then, PSICON generates
contour data, which can be displayed/printed on various
devices.
For more information about the PSI88 package, you may want
to look at our web pages at
http://zarbi.chem.yale.edu/programs/psi88.html

Detailed procedure follows:
1. Rename a cube file as "kubsub.f17".
   Compile the following program and run it.
   (NOTE: This was written by Dan Severance,
   [email-masked])

   --------------- CUT HERE ---------------------------
   	Program kubconv
        double precision input(51)
        character*80 junk
	real output(51,51,51)
        integer ia(30)
	double precision c(30),x(30),y(30),z(30)
	Real cr(30),xr(30),yr(30),zr(30)
        double precision x1,y1,z1,xo,yo,zo
        double precision x2,y2,z2,x3,y3,z3
C
        toang = 0.52917715
	open(7,file='FOR007',form='unformatted')
	open(8,file='kubsub.f17',form='unformatted')
	read(7)Junk
	read(7)Junk
	read(7)Nat,xo,yo,zo
	write(*,*)' end of first',Nat,xo*toang,yo*toang,zo*toang
	read(7)I1,x1,y1,z1
	write(*,*)' end of second',I1,x1*toang,y1*toang,z1*toang
	read(7)I2,x2,y2,z2
	write(*,*)' end of third',I2,x2*toang,y2*toang,z2*toang
	read(7)I3,x3,y3,z3
	write(*,*)' end of four lines ',i3,x3*toang,y3*toang,z3*toang
	read(7)(IA(I),c(I),x(I),y(I),z(I),I=1,nat)
        xo = xo * toang
        yo = yo * toang
        zo = zo * toang
        x1 = x1 * toang
        y1 = y1 * toang
        z1 = z1 * toang
        x2 = x2 * toang
        y2 = y2 * toang
        z2 = z2 * toang
        x3 = x3 * toang
        y3 = y3 * toang
        z3 = z3 * toang
        do I = 1, NAT
c           xr(I) = x(I)*toang
c           yr(I) = y(I)*toang
c           zr(I) = z(I)*toang
            xr(I) = x(I)
            yr(I) = y(I)
            zr(I) = z(I)
        Enddo
        write(*,'(i2,8x,3F10.6)')(IA(I),xr(I),yr(I),zr(I),I=1,nat)
	write(*,*)' end of atom input '
        DO I = 1, I3
           DO J = 1, I2
              read(7)(input(k),K=1,i1)
	      do K = 1, I1
		 output(k,j,i) = input(k)*toang
		enddo
C               write(*,*) I,J
           enddo
        enddo
        close(7)
        xmn = xo
        ymn = yo
        zmn = zo
        xmx = xmn + I1*x1
        ymx = ymn + I2*y2
        zmx = zmn + I3*z3
        write(8)i1,nat
        write(8)(IA(I),I=1,NAT)
        write(8)(Xr(I),Yr(I),Zr(I),I=1,NAT)
        write(8)(((output(i,j,k),k=1,I1),j=1,I2),i=1,I3)
        write(8)xmn,xmx,ymn,ymx,zmn,zmx
        write(*,*)xmn,xmx,ymn,ymx,zmn,zmx
        stop
	end
   --------------- CUT HERE ---------------------------

2. A file named "FOR007" is generated in step 1.
   Create a file named, e.g., "psicon.in".
   Its contents may be
------ CUT HERE -------
PSICON INPUT FILE
 1 1 0 1        
 0.075000       
------ CUT HERE -------

3. Run PSICON.
   On UNIX, you would do
   % PSICON < psicon.in

4. Then run PSI2.