PGI Guide to GAMESS

This guide is intended to help PGI customers build and run the General Atomic and Molecular Electronic Structure System (GAMESS) using PGI 5.1 and 5.2 compilers on a on a AMD64 or Operton 64-bit Linux system.

Version Information
 

This guide was created for the GAMESS December 12, 2003 version and PGI Release 5.1-3 pgf90 and pgcc 64-bit compilers on an AMD64 or Operton system running 64-bit Linux.  The guide was updated on July 14, 2004 for the 5.2 release.

Currently, GAMESS does not support AMD64 and needs to be ported.  In the Configuration Section of this document we describe what source code changes need to be made for the 32-bit x86 version of GAMESS to be ported to AMD64.  The port was developed by AMD and PGI.

Application Notes
  Information about GAMESS can be found at the GAMESS home page. GAMESS is maintained by the members of the Gordon research group at Iowa State University. From the GAMESS Home page:

"GAMESS is a program for ab initio quantum chemistry. Briefly, GAMESS can compute SCF wave functions ranging from RHF, ROHF, UHF, GVB, and MCSCF. Correlation corrections to these SCF wave functions include Configuration Interaction, second order perturbation theory, and Coupled-Cluster approaches, as well as the Density Functional Theory approximation. Analytic gradients are available, for automatic geometry optimization, transition state searches, or reaction path following. Computation of the energy hessian permits prediction of vibrational frequencies. The chart below summarizes the program's present capabilities for obtaining wave functions, applying correlation treatments, and computing derivatives. A variety of molecular properties, ranging from simple dipole moments to frequency dependent hyperpolarizabilities may be computed. Many basis sets are stored internally, and together with effective core potentials, all elements up to Radon may be included in molecules. Several graphics programs are available for viewing of the final results. Many of the computational functions can be performed using direct techniques, or in parallel on appropriate hardware."

Obtaining the Source Code
  Information on obtaining the GAMESS source code can be found at the US Government's Ames Laboratory. The Ames lab requires you to register before downloading the source code.  Note, you should download the 32-bit x86 Linux version and make the porting changes as described in the Configuration Section.
Dependencies
  No known dependencies.
Configuration and Set-up Information
  Once unpacked, please read the enclosed documentation (*.DOC) files and the "readme.unix" file in the "misc" directory.  To build and run GAMESS, you will first need to edit several scripts (compall, comp, lked, rungms, runall) and five source files (ddikick.c, ddisoc.c, trfdm2.src, unport.src, zunix.c).  Due to license restrictions on the source code, we cannot make available pre configured versions of these files. We have submitted these changes to the Ames Laboratory and hope to see them adopted in future GAMESS releases.  Note that the line numbers may change with each release of GAMESS.  Line numbering is progressive so as you add new lines, the next line number reference is for the modified file.

compall
  1. Line 15: set the "TARGET" to "linux-amd64". 
  2. Line 16: replace the "/u1/mike/gamess" with the root directory of your GAMESS package.
  3. Line 34: set "CCOMP" to "pgcc".
    Note: You may need to explicitly set your PATH environment variable as well.
       setenv PATH $PATH\:/usr/pgi/linux86-64/[5.1|5.2]/bin #Set to your path
  4. Line 56: Add a new "extraflag":
    if ($TARGET == linux-amd64)  set extraflags='-DLINUXAMD64'
  5. Line 110: Add a new case for linux-amd64:
    case linux-amd64:
  6. Line 124: Add a new "socketflags":
    if ($TARGET == linux-amd64) set socketflags='-DLINUXAMD64'
  7. If using IPA, add the "-Mipa=[option]" flag to the compilation of zunix (line 67), ddikick (line 135), and ddisoc (line 136).
comp
  1. Line 17: set the "TARGET" to "linux-amd64".
  2. Line 18: replace the "/u1/mike/gamess" with the root directory of your GAMESS package.
  3. Line 44: If you wish to use a BLAS library, i.e. "-lblas" or '-lacml', set "BLAS3=true".
  4. Line 312: Add the following after the "linux-pc" target:
    if ($TARGET == linux-amd64) then
    setenv MACHIN '*I64'
    if ($MODULE == ddi) setenv MACHIN '*SOC'
    if ($MODULE == iolib) setenv MACHIN '*UNX'
    if ($MODULE == unport) setenv MACHIN '*AMD'
    endif
  5. Line 899: After the linux-ia64 target add the following:
    if ($TARGET == linux-amd64) then
    setenv PATH $PATH\:/usr/pgi/linux86-64/5.1/bin #Set to your path
    set OPT = '-fast -i8'
    if ($MODULE == qeigen) then
    mv qeigen.f qeigen.junk
    sed -e "s/Q-/D-/g" \
    -e "s/Q+00/D+00/g" \
    -e "s/REAL\*16/DOUBLE PRECISION/" qeigen.junk > qeigen.f
    rm -f qeigen.junk
    endif
    set echo
    # Compile in the object directory when using IPA
    mv $MODULE.f object/$MODULE.f
    chdir object
    pgf90 $OPT -Mfixed -c $MODULE.f
    chdir ../
    unset echo
    endif
    Be sure to change your path to the location of the PGI compilers.
    Note that we have modified the script to build objects in the object directory to facilitate the use of IPA.  At line 1130, the script attempts to copy the object file from the base directory to the object directory.  Since the object file does not exist in the base directory, an error will be emitted.  You can either comment out line 1130 or ignore the error.
"-i8" must be used when compiling the Fortran source or the program will hang during execution.  You can modify the other option flags as needed but we recommend using "-fast -i8".  You can use either pgf77 or pgf90.  Remove "-Mfixed" if using pgf77.
lked
  1. Line 17: set the "TARGET" to "linux-amd64".
  2. Line 18: replace the "/u1/mike/gamess" with the root directory of your GAMESS package.
  3. Line 55: Add a new case for linux-amd64:
    case linux-amd64:
  4. Line 319: After the linux-ia64 target add the following:
    if ($TARGET == linux-amd64) then
    set LDR='pgf90'
    set LDOPTS='-fast -i8 -lblas -lpthread'
    set VECTOR=' '
    set QUICHE='zunix.o'
    set BLAS=' ' # or set BLAS='blas.o' if BLAS3=false in comp
    set LIBRARIES=' '
    endif
  5. You may also need to explicitly set your path to the compiler binaries:
    setenv PATH $PATH\:/usr/pgi/linux86/[5.1|5.2]
rungms
  1. Determine where your scratch directory is located. For our testing purposes, we created a "scr" directory in the local gamess directory. Set the "SCR" variable (line 33) to this directory. Note that this should be an absolute path.
  2. In the file assignment section, you should change files starting with "~/scr" to the actual directory location. For our tests, we used the local scr directory.
  3. Line 227: Set the "GMSPATH" to the location of the ddikick and gamess executables.
runall Change the "chdir" to the location of the ddikick and gamess executables.
source/ddikick.c Line 57: Add the following case to the the #if statement:
        (defined LINUXAMD64) ||                 \ 
    
source/ddisoc.c After the LINUX definitions add the following (line 204)
    #ifdef LINUXAMD64
    #include <sys/select.h>
    #include <sys/time.h>
    #define SOC_INIT soc_init_
    #define SOC_NPROC soc_nproc_
    #define SOC_SEND soc_send_
    #define SOC_RECV soc_recv_
    #define SOC_ISEND soc_isend_
    #define SOC_IRECV soc_irecv_
    #define SOC_WAIT soc_wait_
    #define SOC_GSEND soc_gsend_
    #define SOC_GRECV soc_grecv_
    #define SOC_RCVANY soc_rcvany_
    #define SOC_WAKEKICK soc_wakekick_
    #define SOC_KILLKICK soc_killkick_
    #define FORTINT long
    #define getsockcast int
    #define SOCK_BUFF_SIZE 32768 /* half RedHat 5.1 default of 64K is better */
    #endif
source/trfdm2.src
  1. Modify lines 585 to 588.  Change
          IMOD=LOCI
    JMOD=LOCJ
    KMOD=LOCK
    LMOD=LOCL
    To:
          IMODAMD=LOCI
    JMODAMD=LOCJ
    KMODAMD=LOCK
    LMODAMD=LOCL
  2. Modify lines 595 to 600.  Change
         IJKLX = NJKL*(IMOD-MINI)+ NKL*(JMOD-MINJ)+
    * NL*(KMOD-MINK)+ (LMOD-MINL)+1+IJKLAD
    XIJKL(LOC ) = VAL
    XIJKL(LOC+LBIN) = IJKLX
    IF(DBUG) WRITE(IW,9995) I,J,K,L,ISH,JSH,KSH,LSH,IBOX,
    * IMOD,JMOD,KMOD,LMOD,IJKLX,VAL,IJKLAD
    To:
         IJKLX = NJKL*(IMODAMD-MINI)+ NKL*(JMODAMD-MINJ)+
    * NL*(KMODAMD-MINK)+ (LMODAMD-MINL)+1+IJKLAD
    XIJKL(LOC ) = VAL
    XIJKL(LOC+LBIN) = IJKLX
    IF(DBUG) WRITE(IW,9995) I,J,K,L,ISH,JSH,KSH,LSH,IBOX,
    * IMODAMD,JMODAMD,KMODAMD,LMODAMD,IJKLX,VAL,IJKLAD
  3. Modify lines 619 to 665 as follows:
      141 IF(.NOT.IANDJ) GO TO 140
    IMODAMD=LOCJ
    JMODAMD=LOCI
    KMODAMD=LOCK
    LMODAMD=LOCL
    GO TO 130
    C
    142 IF(.NOT.KANDL) GO TO 140
    IMODAMD=LOCI
    JMODAMD=LOCJ
    KMODAMD=LOCL
    LMODAMD=LOCK
    GO TO 130
    C
    143 IF(.NOT.IANDJ.OR..NOT.KANDL) GO TO 140
    IMODAMD=LOCJ
    JMODAMD=LOCI
    KMODAMD=LOCL
    LMODAMD=LOCK
    GO TO 130
    C
    144 IF(.NOT.IJNDKL) GO TO 150
    IMODAMD=LOCK
    JMODAMD=LOCL
    KMODAMD=LOCI
    LMODAMD=LOCJ
    GO TO 130
    C
    145 IF(.NOT.KANDL) GO TO 140
    IMODAMD=LOCL
    JMODAMD=LOCK
    KMODAMD=LOCI
    LMODAMD=LOCJ
    GO TO 130
    C
    146 IF(.NOT.IANDJ) GO TO 140
    IMODAMD=LOCK
    JMODAMD=LOCL
    KMODAMD=LOCJ
    LMODAMD=LOCI
    GO TO 130
    C
    147 IF(.NOT.KANDL.OR..NOT.IANDJ) GO TO 150
    IMODAMD=LOCL
    JMODAMD=LOCK
    KMODAMD=LOCJ
    LMODAMD=LOCI
source/unport.src
  1. Add the following after the "PC-UNIX" section around line 202:
    C-----------------------------------------------------------------------
    C AMD64-PGI
    *AMD IF (ICORFL.EQ.1) THEN
    *AMD WRITE(IW,1) 'GDB','BACKTRACE','QUIT'
    *AMD CALL ABORT
    *AMD ELSE
    *AMD WRITE(IW,2)
    *AMD END IF
  2. Add the following around line 340:
    *AMD  NWDVAR = 1
  3. Add the following around line 382:
    *AMD  VERSN = '********* AMD64-PGI VERSION ********'
  4. Add the following around line 495:
    *AMD  LOGAND =  AND(IVAL,JVAL)
  5. Add the following around line 535:
    *AMD  LOGOR =  OR(IVAL,JVAL)
  6. Add the following around line 580:
    *AMD  LOGXOR =  XOR(IVAL,JVAL)
  7. Add the following around line 728:
    C 
    *AMD PARAMETER (MEMSIZ= 1 000 000)
    *AMD COMMON /FMCOM / X(1)
  8. Add the following around line 800:
    *AMD  LOCX = LADDRS(X)
  9. Add the following around line 845:
    *AMD  LOCMEM = MEMGET(MEMLIM)
  10. Add the following around line 875:
    *AMD  LOFFS = (LOFFS+7)/8 + 1
  11. Add the following around line 980:
    *AMD  CALL MEMREL(LOCMEM)
  12. Add the following around line 1154 (after F2C):
    C-----------------------------------------------------------------------
    C
    *AMD DOUBLE PRECISION TIMSTR(3)
    *AMD CHARACTER*24 STAMP
    *AMD CALL FDATE(STAMP)
    *AMD READ(UNIT=STAMP,FMT='(3A8)') TIMSTR
  13. Add the following around line 1454 (after F2C):
    C
    C-----------------------------------------------------------------------
    C * * * * AMD64-PGI SPECIFIC PORTION * * * *
    C
    *AMD DOUBLE PRECISION CPU0,WALL0,CPU,WALL,TIM
    *AMD EXTERNAL ETIME
    *AMD DOUBLE PRECISION ETIME
    *AMD REAL TARRAY(2)
    *AMD LOGICAL FIRST
    *AMD COMMON /TIMING/ CPU,WALL
    *AMD SAVE FIRST,CPU0,WALL0
    *AMD DATA FIRST/.TRUE./
    C
    *AMD IF(FIRST) THEN
    *AMD FIRST=.FALSE.
    *AMD WALL0 = ETIME(TARRAY)
    *AMD CPU0 = TARRAY(1)+TARRAY(2)
    *AMD END IF
    C
    *AMD WALL = ETIME(TARRAY)
    *AMD CPU = TARRAY(1)+TARRAY(2)
    *AMD CPU = CPU - CPU0
    *AMD WALL = WALL - WALL0
    *AMD TIM = CPU
    *AMD RETURN
source/zunix.c Add the following around line 260
    /*----------------- AMD64 running Linux -----------------*/

    #ifdef LINUXAMD64

    #include <stdlib.h>
    #include <malloc.h>

    long memget_(nwords) long *nwords;
    { size_t nbytes;
    nbytes = (*nwords+2)*8;
    return (long) malloc(nbytes); }

    void memrel_(locmem) long *locmem;
    { free((void*)*locmem); }

    long laddrs_(void *arg)
    { return (long) arg; }

    #include <unistd.h>
    void naptime_(nptime) long *nptime;
    { sleep((unsigned int) *nptime); }

    #endif
Building GAMESS
 
Steps to build GAMESS
  1. Configure your installation as described in the Configuration Section.
  2. Build the activate utility in the tools directory:
    cd tools
    cp actvte.code actvte.f
    vi actvte.f
    :%s/^\*UNX/    / <--- 4 blanks between the strokes
    :wq
    pgf77 -o actvte.x actvte.f
    rm actvte.f
    cd ../
  3. Type "compall" from the command line to compile the source.
  4. Type "lked" from the command line to link the source.
  5. 5.1 only: Repeat steps 3 and 4 if using IPA.
Running GAMESS
  To run the 35 example data sets, use the "runall" command.  The output can be found in the "eN.log" files.
Verifying Correctness
  The "TESTS.DOC" file gives a full explanation on verifying the example program's output.  The abbreviated version is as follows.  The "INPUT CARD" portion of each log file contains some expected values.  You need to search the output to see if these values match the actual output. Note that there are difference between the log file's expected answer and the "TESTS.DOC" file's expected answers.  You should use the log file's expected values.  Also, there might be slight precision variances between the actual and expected values. Precision can change depending upon your system and compiler optimization. See the Precision FAQ for more information.
Known Issues and Limitations
  The following are a list of known issues when using the PGI compiler with GAMESS.
  • "-i8" Must be used
    GAMESS uses a mix of both Fortran and C and care must be taken to ensure that integer data type representation matches. "-i8" ensures 8 byte integer representation which is the same as a C "long int".
  • Using "-Minline"
    Using "-Minline" will cause several source files to grow too large for compilation.
  • Using "-Mbyteswapio" and "-Mchkptr"
    Using "-Mbyteswapio" and "-Mchkptr" can cause a few example tests to exit abnormally. They are not needed for GAMESS and should not be used.
  • Incorrect results with "-fastsse" and "-Mvect"
    A bug in the vectorizer can cause GAMESS to produce incorrect results.   Vectorization is enabled using the "-Mvect=[option]" flag and is part of "-fastsse".  You can set your options to "-fast -Mscalarsse -Mcache_align -Mflushz" which is equivalent to "-fastsse" less "-Mvect=sse".
Click me