Just what you wanted for Christmas – a compiler for Gaussian

One of Roger’s main interests is compilation as applied to code, SMARTS patterns, and indeed anything else. Indeed, for a period back in the noughties, Roger moonlighted as a middle-end maintainer for the GCC project.

So when, during a sabbatical, he was faced with the task of compiling Gaussian, he naturally turned to GFortran. However, given that this would not compile it, he tweaked the compiler and submitted patches to the FSF (see for example, the MOPAC changes on page 43 of this summary). When not all of these patches were accepted into mainline GFortran, he packaged the remaining pieces into a Fortran pre-processor that emulates the (non-standard) behaviour of commercial compilers.

The result, gXXfortran, is now available on GitHub. In theory, it should work for a standard Linux or Mac system. However, as we don’t have access to the Gaussian source code, your mileage may vary.

This package provides a “pgf77” script that emulates the Portland Group’s PGI fortran 77 compiler, instead using the Free Software Foundation’s GNU gfortran compiler instead. This emulation is sufficient to allow packages such as Gaussian03, that would otherwise require a commercial compiler, to be built using open source tools.

In addition, this package also allows Gaussian03 to be built on a case-insensitive file system (such as when using Mac OS X, cygwin or a FAT32 drive) by overriding the behaviour of “cp” and “gau-cpp” such that they don’t cause problems when used by Gaussian’s build scripts on non case-sensitive file systems.

4 thoughts on “Just what you wanted for Christmas – a compiler for Gaussian”

  1. First of all, thank you for the Christmas gift!
    I’m trying to compile Gaussian 09 on Linux (Ubuntu), but it’s not as straightforward as I was hoping.
    First, it is complaining about the -r8 flag in the compiler. This flag is only in pgf77, so I changed it to the generic -fdefault-real-8 in the make file and it is now at least compiling 99% of the source code. I still have a couple of points where it is complaining about arguments, such as:

    Error: Type of argument ‘a’ in call to ‘dreal’ at (1) should be COMPLEX(16), not COMPLEX(8)

    I’m trying to work around those errors, but if someone has any suggestion on how to solve them permanently it would be very much appreciated!

  2. I was actually able to get around those errors by using the flag -freal-8-real-16 in place of -r8. However, now I’m having more serious errors that seems related with the blas or lapack components:

    pgf77 -Bstatic_pgi -i8 -freal-8-real-16 ‘-mcmodel=medium’ -mp=nonuma -tp nehalem-64 -Mreentrant -Mrecursive -Mnosave -Minfo -Mneginfo -time -fast -O2 -Munroll -Mvect=assoc,recog,cachesize:2621440 -g -o g09 ml0.o util.a bsd/libf77blas-corei764sse3.a bsd/libatlas-corei764sse3.a -lpthread -lm -lc
    gfortran -m32 -O3 -ffast-math -fopenmp -Bstatic_pgi -fdefault-integer-8 -freal-8-real-16 -g -o g09 ml0.o util.a bsd/libf77blas-corei764sse3.a bsd/libatlas-corei764sse3.a /home/rpv/gXXfortran-master/bin/../lib/pgf77.o -lgomp -lpthread -lm -lc
    /usr/bin/ld: i386:x86-64 architecture of input file `util.a(mdutil.o)’ is incompatible with i386 output

    Any idea of how to solve this?

  3. Thanks Roger, sorry to bother, but still no luck, although a slightly different error now, every single file failed to compile with the following message:

    ../bsd/updatelink1 ../bsd/g09.make JUNK1=JUNK DO-LIB gfddir.F gfdir2.F gfloat.F gfmm.F gfname.F ggeev.F ggemv.F ggemvt.F gger.F ggesdd.F ggesv.F ggesvd.F ggesvx.F ggete2.F ggetrf.F ggetri.F
    pgf77 -Bstatic_pgi -i8 -r8 ‘-mcmodel=medium’ -mp=nonuma -tp nehalem-64 -Mreentrant -Mrecursive -Mnosave -Minfo -Mneginfo -time -fast -O2 -Munroll -Mvect=assoc,recog,cachesize:2621440 -c gfddir.f
    gfortran -m64 -march=nehalem -mtune=native -O3 -ffast-math -fopenmp -Bstatic_pgi -fdefault-integer-8 -freal-8-real-16 -c gfddir.f
    f951: error: bad value (nehalem) for -march= switch
    make: *** [gfddir.o] Error 1
    ar: No match.
    rm: No match.
    set noglob

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.