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
    gau-cpp -I/home/peve/g09.13.206/g09 -DDEFMAXRES=25000 -DDEFMAXSEC=2500 -DI64 -DP64 -DPACK64 -DUSE_I2 -DGAUSS_PAR -DGAUSS_THPAR -D_OPENMP_ -D_OPENMP_MM_ -DCHECK_ARG_OVERLAP -DDEFMAXSHL=250000 -DDEFMAXATM=250000 -D_EM64T_ -DNO_SBRK ‘-DX86_TYPE=S’ -DDEFMAXNZ=250000 -DDEFNVDIM=257 -DR4ETIME -DDEFARCREC=1024 -DMERGE_LOOPS -D_I386_ -DLITTLE_END -DUSING_F2C -DSTUPID_ATLAS -DDEFMAXXCVAR=40 -DDEFMAXIOP=200 -DDEFMAXCOORDINFO=32 -DDEFMAXSUB=80 -DDEFMAXCHR=1024 -DDEFMOMEGA=5 -DDEFNOMEGA=6 -DDEFMAXXCNAME=25 -DDEFLMAX=13 -DDEFMINB1P=100000000 -DDEFXGN3MIN=1 -DDEFISEC=16 -DDEFJSEC=512 -DDEFKSEC=128 -DDEFN3MIN=10 -DDEFNBOMAXBAS=10000 -DDEFMAXHEV=2000 -DDEFCACHE=160 -DDEFMAXLECP=10 -DDEFMAXFUNIT=5 -DDEFMAXFFILE=10000 -DDEFMAXFPS=1300 -DDEFMAXINFO=200 -DDEFMAXOP=384 -DDEFMAXTIT=100 -DDEFMAXRTE=4000 -DDEFMAXREDTYPE=3 -DDEFMAXREDINDEX=4 -DDEFMAXOV=500 -DDEFMXDNXC=8 -DDEFMXTYXC=10 -DDEFICTDBG=0 -D_ALIGN_CORE_ -DCA1_DGEMM -DCA2_DGEMM -DCAB_DGEMM -DLV_DSP -DO_BKSPEF -DSETCDMP_OK -DDEFMXTS=2500 -DDEFMXBOND=12 -DDEFMXSPH=250 -DDEFMXINV=2500 -DDEFMXSLPAR=300 -DDEFMXSATYP=4 -DGCONJG=DCONJG -DGCMPLX=DCmplx -DGREAL=DREAL -DGIMAG=DIMAG -DEXT_LSEEK -DAPPEND_ACC gfddir.F gfddir.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
    end

Leave a Reply

Your email address will not be published. Required fields are marked *