Subject: GaussView 1.0 and Gaussian98

From: Krzysztof Radacki <[email-masked]>
Date: Wed, 26 May 1999 12:47:28 +0200

Dear CCL'ers,
all who has new Gaussian98 and has old GaussView 1.0 can use the small
program below to convert Gaussian98 log-files to form that is
'comaptible' 
with old and good :) Gaussian94. It took me some time to find what realy 
reads GaussView. The difference is in table "Standard Orientation".
There 
is an additional column "atom type" which should be removed. That what 
makes the program. It's surely very bad code 'cause it first my program 
in C (that's only one compilator we have on all computers in Computation 
Centrum) but it works. 

Regards 
      Krzys Radacki

_________________________--------------------------------------------------
-------------------------   e-mail:     [email-masked] 
---

---------------------------------------------------------------------------

============================================== 
save code below as g98do94.c
compile it with  gcc -o 98do94 98do94.c
================  CUT HERE  ==================

/*  Program  --  98do94 converts Gaussian98 log-files to format
    that can be read in by GaussView 1.0.
    Last mod 19:45 May 16, 1999.

    Copyright (C) 1999  by Krzys Radacki.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA
*/
 
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

void syntax()
    {
    fprintf(stderr,
"\n"
"+--------------------------------------------------------+\n"
"+ Program 98do94 converts Gaussian98 log-files to format +\n"
"+ that can be read in by GaussView 1.0.                  +\n"
"+                                 by Krzys Radacki, 1999 +\n"
"+--------------------------------------------------------+\n\n"
"  Syntax: g98do94 [infile] [outfile] \n\n");
    exit(1);
    }

void main(argc,argv)
int   argc;
char *argv[];
{
    void syntax();

    char  line[85];
    char  test1[30]=" Center     Atomic     Atomic ";
    char  test2[30]=" Number     Number      Type  ";
    FILE *infile, *outfile;
    fpos_t pozycja, pozycja2;
    int ola,ala;

    if(argc!=3)
        syntax();

    if(argc==3)
    {
        if(!(infile=fopen(argv[1],"r")))
            {
            fprintf(stderr,"Can't open input file %s.\n",argv[1]);
            }
        else
        {
        infile=fopen(argv[1],"r");
        outfile=fopen(argv[2],"w");
        for(;;)
          {
          if(NULL==fgets(line,85,infile)) break;
          ala=strncmp(test1,line,30);
          if(0==strncmp(test1,line,30))
             {
             fputs(line,outfile);
             fgets(line,85,infile);
             if(0==strncmp(test2,line,30))
                {
                fputs(line,outfile);
                fgets(line,85,infile);
                fputs(line,outfile);
                fgets(line,85,infile);
                if(line[29]=='0')  ola=1;
                while (ola==1)
                   {
                   line[29]=' ';
                   fputs(line,outfile);
                   fgets(line,85,infile);
                   if(line[29]=='0')  ola=1;
                   else ola=0;
                   }
                fputs(line,outfile);
                }
             else fputs(line,outfile);
             }
             else fputs(line,outfile);
         }
      }
    fclose(infile);
    fclose(outfile);
   }
exit(0);
}