Subject: Re: CCL:G:G94 cube file to gnuplot (3D data)

From: Timm Lankau <[email-masked]>
Date: Fri, 4 Sep 1998 19:37:00 +0200 (DFT)

Dear Doctor Glossman,

here're the replys. I am sorry for the delay.

Best wishes
Timm Lankau

==========================================================================

Timm Lankau                            phone  (+)40 4123 3686
Institut fuer Physikalische Chemie     fax    (+)40 4123 3452
Universitaet Hamburg                   e-mail [email-masked]
Bundesstr. 45
20146 Hamburg
Germany

On Wed, 5 Aug 1998, Dr. M. Daniel Glossman wrote:

> 
> Hello!!!
> 
>  Will you share the answers you receive?
> 
>  Thanks in advance
> 
> 
> 						Daniel Glossman
> 
> 	                                       [email-masked]
> 
> 
> 
> At 19:13 5/08/98 +0200, you wrote:
> >Hello,
> >
> >I am looking for a simple program / shell script, which converts density 
> >data from a G94 cube file to a data file suitable for gnuplot to generate 
> >a 3D surface plotable with 'splot'.
> >Thank you very much.
> >
> >Timm
> >
> >==========================================================================
> >
> >Timm Lankau                            phone  (+)40 4123 3686
> >Institut fuer Physikalische Chemie     fax    (+)40 4123 3452
> >Universitaet Hamburg                   e-mail [email-masked]
> >Bundesstr. 45
> >20146 Hamburg
> >Germany
> >
> >
> >-------This is added Automatically by the Software--------
> >-- Original Sender Envelope Address: [email-masked]
> >-- Original Sender From: Address: [email-masked]
> >[email-masked]: Everybody | [email-masked]: Coordinator
> >[email-masked]: HELP CHEMISTRY or HELP SEARCH | Gopher: www.ccl.net 73
> >Anon. ftp: www.ccl.net   | [email-masked] -- archive search
> >             Web: http://www.ccl.net/chemistry.html 
> >
> >
> 
> 

My orinal mail was:

Hello,

I am looking for a simple program / shell script, which converts density 
data from a G94 cube file to a data file suitable for gnuplot to generate 
a 3D surface plotable with 'splot'.
Thank you very much.

Timm

Replys:

From: [email-masked]

Hi Timm, 

I am attaching a fortran file to this e-mail. In theory it Should work.
There will be one slight problem in the last write commands
write(*, '(/)') you drop me a line if these do not work.

Take care buddy.

      Implicit real*8 (a-h, o-z)
      Integer RTrac
      DIMENSION NPTS(4), XYZ(4, 3), Rho(100 000)

C.... The first two lines are just BullShit
      Read(*, *)
      Read(*, *)

      Do 10 I=1, 4 
       Read(*, *)NPTS(I), XYZ(I,1),XYZ(I,2),XYZ(I,3)
 10   Continue

      Do 189 II=1, NPTS(1)
       Read(*, *)
 189  Continue

      Read(*, *, end=20)(Rho(I), I=1, NPTS(2)*NPTS(3)*NPTS(4))

 20   Continue

C.... But seriously !

      X0     = XYZ(1, 1)
      Y0     = XYZ(1, 2)
      Z0     = XYZ(1, 3)
      RTrac  = 0 

      Do 40 K=1, IABS(NPTS(2))
       XRhoK = X0 + (K-1)*XYZ(2, 1)
       YRhoK = Y0 + (K-1)*XYZ(2, 2)
       ZRhoK = Z0 + (K-1)*XYZ(2, 3)
       Do 45 J=1, NPTS(3)
        XRhoJ = XRhoK + (J-1)*XYZ(3, 1)
        YRhoJ = YRhoK + (J-1)*XYZ(3, 2)
        ZRhoJ = ZRhoK + (J-1)*XYZ(3, 3)
        Do 50 I=1, NPTS(4)
         XRho = XRhoJ + (I-1)*XYZ(4, 1)
         YRho = YRhoJ + (I-1)*XYZ(4, 2)
         ZRho = ZRhoJ + (I-1)*XYZ(4, 3)

         RTrac = RTrac + 1
         Write(*, '(3(1PE14.6))')XRho, ZRho, Rho(RTrac)

 50     Continue
        If(NPTS(3) .NE. 1)Write(*, '(\)')
 45    Continue
        Write(*, '(\)')
 40   Continue

      End

From: Alexander Klinsky <[email-masked]>

Dear Timm !

If you do not want to stick with gnuplot then you might try the following
programs (freeware) for displaying cube-file data as a 3d isosurface plot:
Please search the web because i do not have the urls in mind:

1.) gOpenMol 1.1 from Leif Laaksonen: Very high resolutions; many options;
available for PC (Linux, W95,NT) and major Unixes
2.) PGV ( Polygon Viewer from goofy.ims.ac.jp )
3.) SciAn for SGIs

Hope this has helped a little bit

Alexander Klinsky
Institute of theoretical chemistry
Department of applied theoretical biochemistry
University of Vienna
Austria

From: "Dr. M. Daniel Glossman" <[email-masked]>

Hello!!!

 Will you share the answers you receive?

 Thanks in advance

						Daniel Glossman

	                                       [email-masked]

From: Drake Diedrich <[email-masked]>

   In general it cannot be done.  gnuplot surfaces are single-valued.  An
isosurface has at least 2 z values for each x,y coordinate (front and back
face, and possible holes for further surfaces).  I'm developing a program to
render G94 cubes using an enhanced povray, but it is neither simple nor
finished.  The first release will be under Debian/GNU Linux where I can
assure the presence of all the required libraries.

-- 
Dr. Drake Diedrich, Research Officer - Computing, (02)6279-8302
John Curtin School of Medical Research, Australian National University 0200
Replies to other than [email-masked] will be routed off-planet

From: Guido Germano <[email-masked]>

Write this into a file called e.g. grid.awk, setting N to the
appropriate value:

BEGIN {N = 100}
NF == 1 {print $0; i++}
i == N {print ""; i = 0}

Then issue the command (I suppose you are working under Unix)

awk -f grid.awk g94_file.grid > gnu_file.grid

You can also avoid writing gnu_file.grid to disk, issuing directly from
the gnuplot prompt the command:

splot '< awk "BEGIN {N = 100}; NF == 1 {print $0; i++}; i == N {print
\"\"; i = 0} g94_file.grid' notitle w l 

You can write the above line into a file called e.g. splot.gnu and then
issue from the gnuplot prompt:

load 'splot.gnu'

Freundliche Gruesse

Dr. Guido Germano