Running Gaussian

This section describes the operating system commands required to execute Gaussian on Unix-based computer systems. See the additional instructions accompanying the program for the equivalent information for other operating systems. This discussion assumes that the program has already been installed.

Running Gaussian involves the following activities:

  • Creating Gaussian input describing the desired calculation.
  • Specifying the locations of the various scratch files.
  • Specifying resource requirements.
  • Initiating program execution, in either interactive or batch mode.

In this section, we will assume that a basic Gaussian input file has been created, and our discussion will examine the remaining three items on the list.

Specifying Scratch File Handling and Location

Gaussian uses several scratch files in the course of its computation. They include:

  • The Checkpoint file: name.chk
  • The Read-Write file: name.rwf
  • The Two-Electron Integral file: name.int (empty by default)
  • The Two-Electron Integral Derivative file: name.d2e (empty by default)
  • The scratch file: name.skr

By default, these files are given a name generated from the process ID of the Gaussian process, and they are stored in the scratch directory, designated by the GAUSS_SCRDIR environment variable (UNIX). You may also see files of the form name.inp in this directory. These are the internal input files used by the program. If the environment variable is unset, the location defaults to the current working directory of the Gaussian process.

By default, these files are deleted at the end of a successful run. However, you may wish to save the checkpoint file for later use in another Gaussian job, for use by a visualization program, to restart a failed job, and so on. This may be accomplished by naming the checkpoint file, providing an explicit name and/or location for it, via a %Chk command within the Gaussian input file. Here is an example:

%Chk=water

This command, which is placed at the beginning of the input file (before the route section) gives the checkpoint file the name water.chk, overriding the usual generated name and causing the file to be saved at job conclusion. In this case, the file will reside in the current directory. However, a command like this one will specify an alternate directory location as well as filename:

%Chk=/chem/scratch2/water

If disk space in the scratch directory is limited, but space is available elsewhere on the system, you may want to split the scratch files among several disk locations. The following commands allow you to specify the names and locations of the other scratch files:

%RWF=path    Read-Write file
%Int=path    Integral file
%D2E=path    Integral Derivative file

In general, the read-write file is by far the largest, and so it is the one for which an alternate location is most often specified.

Splitting Scratch Files Across Disks

Gaussian 09 can address single scratch files of up to 16 GB on 32-bit operating systems such as Windows and IA32 Linux. There is no need to split scratch files into 2 GB files. The 16 GB total scratch space limit is inherent in 32-bit integers, however, and splitting the scratch file will not overcome it.

An alternate syntax is provided for splitting the read-write file, the Integral file, and/or the Integral Derivative file among two or more disks (or file systems). Here is the syntax for the %RWF command:

%RWF=loc1,size1,loc2,size2, …

where each loc is a directory location or a file pathname, and each size is the maximum size for the file segment at that location. Gaussian will automatically generate unique filenames for any loc which specifies a directory only. On UNIX systems, directory specifications (without filenames) must include a terminal slash.

By default, the sizes are in units of 8-byte words. This value may also be followed by KB, MB, GB, TB, KW, MW, GW or TW (without intervening spaces) to specify units of kilo-, mega-, giga- or tera-bytes or words. Note that 1 MB = 10242 bytes = 1,048,576 bytes (not 1,000,000 bytes).

A value of -1 for any size parameter indicates that any and all available space may be used, and a value of 0 says to use the current size of an existing segment. -1 is useful only for the last file specified, for which it is the default.

For example, the following directive splits the read-write file across three disks:

%RWF=/dalton/s0/,4GB,/scratch/,3GB,/temp/s0/my_job,-1

The maximum sizes for the file segments are 4 GB, 3 GB, and unlimited, respectively. Gaussian will generate names for the first two segments, and the third will be given the name my_job. Note that the directory specifications include terminal slashes.

Due to limitations in current UNIX implementations, -1 should be used with caution, as it will attempt to extend a file segment beyond all remaining disk capacity on these systems; using it will also have the side effect of keeping any additional file segments included in the list from ever being used.

Saving and Deleting Scratch Files

By default, unnamed scratch files are deleted at the end of the Gaussian run, and named files are saved. The %NoSave command may be used to change this default behavior. When this directive is included in an input file, named scratch files whose directives appear in the input file before %NoSave will be deleted at the end of a run (as well as all unnamed scratch files). However, if the % directive naming the file appears after the %NoSave directive, the file will be retained. For example, these commands specify a name for the checkpoint file, and an alternate name and directory location for the read-write file, and cause only the checkpoint file to be saved at the conclusion of the Gaussian job:

%RWF=/chem/scratch2/water    Files to be deleted go here.
%NoSave
%Chk=water                   Files to be saved go here.

Note that all files are saved when a job terminates abnormally.

Initialization Files

The Gaussian system includes initialization files to set up the user environment for running the program. These files are:

$g09root/g09/bsd/g09.login   C shell
$g09root/g09/bsd/g09.profile Bourne shell

Note that the g09root environment variable must be set up by the user. Thus, it is customary to include lines like the following within the .login or .profile file for Gaussian users:

.login files:
setenv g09root location
source $g09root/g09/bsd/g09.login

.profile files:
g09root=location
export g09root
. $g09root/g09/bsd/g09.profile

Once things are set up correctly, the g09 command is used to execute Gaussian 09 (see below).

Controlling Memory Usage

The %Mem command controls the amount of dynamic memory to be used by Gaussian. By default, 256 MB (32MW) are used. This can be changed to n double-precision words by specifying:

%Mem=n

For example, the following command sets memory use to 320 million bytes:

%Mem=40000000

This value may also be followed by KB, MB, GB, TB, KW, MW, GW or TW (without intervening spaces) to specify units of kilo-, mega-, giga- or tera-bytes or words. For example, the following command also sets the amount of dynamic memory to 1 GB:

%Mem=1GB

Even larger allocations may be needed for very large direct SCF calculations, at least 3N2 words, where N is the number of basis functions.

Warning: Requesting more memory than the amount of physical memory actually available on a computer system will lead to very poor performance.

If Gaussian is being used on a machine with limited physical memory, so that the default of 256 MB is not available, the default algorithms as well as the default memory allocation should be set appropriately during installation.

Running Gaussian on UNIX Systems

Once all input and resource specifications are prepared, you are ready to run the program. Gaussian 09 may be run interactively using one of two command styles:

g09 job-name
g09 <input-file >output-file

In the first form, the program reads input from job-name.com and writes its output to job-name.log. When job-name is not specified, the program reads from standard input and writes to standard output, and these can be redirected or piped in the usual UNIX fashion. Either form of command can be forced in the background in the same manner as any shell command using the ampersand.

Scripts and Gaussian

Scripts designed to run Gaussian 09 may also be created in several ways (we will use the C shell in these examples). First, g09 commands like those above may be included in a shell script. Secondly, actual Gaussian input may be included in the script using the << construct:

#!/bin/csh
g09 <<END >water.log
%Chk=water
#RHF/6-31G(d)
 
water energy
 
0  1
O
H  1  1.0
H  1  1.0  2  120.0
 
END
echo "Job done. "

All lines preceding the string following the << symbols are taken as input to the g09 command.

Finally, loops may be created to run several Gaussian jobs in succession. For example, the following script runs all of the Gaussian input files specified as its command line arguments, and it maintains a log of its activities in the file Status:

#!/bin/csh
echo &quot;Current Job Status:" > Status
foreach file ($argv)
   echo "Starting file $file at `date`" >> Status
   g09 < $file > $file:r.log
   echo "$file Done with status $status" >> Status
end
echo "All Done." >> Status

The following more complex script creates Gaussian input files on-the-fly from the partial input in the files given as the script’s command line arguments. The latter are lacking full route sections; their route sections consist of simply a # sign or a # line containing special keywords needed for that molecular system, but no method, basis set, or calculation type.

The script creates a two-step job for each partial input file—a Hartree-Fock optimization followed by an MP2 single point energy calculation—consisting of both the literal commands included in the script and the contents of each file specified at script execution time. It includes the latter by exploiting the Gaussian 09 @ include file mechanism:

#!/bin/csh
echo "Current Job Status:" > Status
foreach file ($argv)
echo "Starting file $file at `date`" >> Status
g09 <<END> $file:r.log
%Chk=$file:r
# HF/6-31G(d) FOpt
@$file/N
 
--Link1--
%Chk=$file:r
%NoSave
# MP2/6-31+G(d,p) SP Guess=Read Geom=AllCheck
END
echo "$file Done with status $status" >> Status
end # end of foreach
echo "All Done." >> Status

Batch Execution with NQS

Gaussian may be run using the NQS batch facility on those UNIX systems that support it. The subg09 command, defined in the initialization files, submits an input file to a batch queue. It has the following syntax:

subg09 queue-name  job-name [-scrdir dir1] [-exedir dir2] [-p n]

The two required parameters are the queue and job names. Input is taken from job-name.com and output goes to job-name.log, just as for interactive runs. The NQS log file is sent to job-name.batch-log. The optional parameters -scrdir and -exedir are used to override the default scratch and executable directories, respectively. Any other parameters are taken to be NQS options. In particular, -p n can be used to set the priority within the queue to n. This is priority for initiation (1 being lowest), and does not affect the run-time priority.

To submit an NQS job from an interactive session, a file like the following should be created (with filename name.job):

# QSUB -r name -o name.out -eo
# QSUB -lt 2000 -lT 2100
# QSUB -lm 34mw -lM 34mw
g09 <name.com

where name should be replaced with a name that is appropriate to your calculation. The first line names the running job, names the output file, and causes errors to be included in the output file. The time parameters are different to allow addition of job control for cleanup, (for example, archiving the checkpoint file in the event that the job exceeds its time limit). The memory parameters are used both for initial scheduling of your job for execution and by the program to determine dynamic memory use.

This job would then be submitted by issuing the command,

$ qsub name.job

and the output would be placed in your current working directory.

 


Last update: 26 June 2013