Gaussian: Tutorial on Using LSF Scripts to Automate Jobs

Introduction

When Gaussian starts running jobs for relatively big molecules, it requires more disk space in saving some intermediate results during the course of the computation. It is always better to start up the job in scratch space to take advantage of unlimited disk space. In order to avoid moving files back and forth between your home directory and scratch disk space, one can make use of an LSF script to automate the process. The LSF script will copy the Gaussian input file to scratch space, start up the Gaussian job, and copy the Gaussian outfile file back to your home directory after the job is done. The following example demonstrates how it works.

Example

The following lines are saved in the file “spe_hf_6-31g-1.com”. The D-Glucose molecule is described in the form of a Z-matrix in the following file. This file is saved in the present working directory the name of which is in the variable $PWD.

#P  HF/6-31G(d)  GFINPUT  IOP(6/7=3)
Title: D-Glucose  HF  Single  Point  Energy  at 6-31G Level
0  1
O
C  1  r2
O  2  r3  1  a3
H  3  r4  2  a4  1  t4
C  2 r5  1  a5 3  t5
O  5  r6  2  a6  1  t6
H  6  r7  5  a7  2  t7
C  5  r8  6  a8 2  t8
O 8  r9  5  a9  6  t9
H  9  r10  8  a10  5  t10
C  8  r11  9  a11  5 t11
O  11  r12 8  a12  9  t12
H  12  r13  11  a13  8  t13
C  1  r14  2  a14 3  t14
C  14  r15 1  a15  11  t15
O  15  r16  14  a16  1  t16
H  16  r17  15 a17  14  t17
H  15 r18  16  a18  14  t18
H  15  r19  16  a19  14  t19
H  14 r20  1  a20  11  t20
H  11  r21  12  a21  8  t21
H  8  r22  9  a22  5  t22
H 5  r23  6  a23  2  t23
H 2  r24  1  a24  3  t24
 r2  1.303574
 r3  1.298226
 r4 0.850225
 r5  1.401960
 r6 1.298701
 r7  0.850235
 r8  1.392940
 r9 1.300643
 r10  0.850707
 r11  1.386620
 r12  1.301202
 r13  0.849796
 r14 1.306056
 r15  1.390957
 r16  1.298774
 r17 0.848606
 r18  0.960596
 r19 0.936184
 r20  0.950411
 r21  0.950256
 r22 0.949451
 r23  0.950228
 r24 0.950122
 a3  109.319578
 a4  109.385639
 a5  109.863677
 a6 109.748417
 a7 109.354478
 a8  109.349516
 a9  109.896724
 a10  109.414549
 a11 109.523328
 a12 109.883054
 a13  109.421468
 a14  111.325303
 a15  108.497049
 a16  107.851163
 a17  109.464034
 a18  109.651174
 a19  109.941113
 a20  109.983436
 a21 109.659068
 a22  110.241250
 a23  109.869155
 a24  109.243157
 t4  59.537921
 t5 -121.234485
 t6  178.724698
 t7  -60.147617
 t8  120.271772
 t9  63.132358
 t10 59.288324
 t11  -118.583004
 t12  -62.488448
 t13  -179.458424
 t14  59.961913
 t15  117.947758
 t16  -59.347246
 t17  59.294388
 t18  -119.311642
 t19 119.740094
 t20  -121.527332
 t21  -120.436061
 t22  120.868366
 t23  -119.922213
 t24  119.164313
-------- THIS IS A BLANK LINE  -------- (Really)------

#P switches on printing SCF convergence. A restricted (R) Hartree-Fock (HF) calculation using the 6-31G(d) (6-31G(d))basis set is chosen. GFINPUT switches on printing of Basis Set Info, and IOP(6/7=3) switches on printing all MO’s. A blank line after the #P line is a one-line description of the calculation. After another blank line, the d-glucose molecule is then specified. The first line of the molecule specifications gives the charge and spin multiplicity for the molecule as two free-format integers. For d-glucose, the molecule is neutral (charge 0) and has spin multiplicity 1 (singlet). Then, the d-glucose molecule is represented by Z-matrix format. Notice that there is a blank line at the end of the file.

The LSF script is listed in the following box. The filename of this file is “spe_hf_6-31g” and it is kept in the same directory as “spe_hf_6-31g.com”.

#!/bin/tcsh
# Compose Gaussian com file locally, copy it to killdevil, run Gaussian,
# and copy the log file back to the local machine.
# Set up the input and output filenames, use the same filename locally and remotely.
setenv GAUSINFILE spe_hf_6-31g.com
# Define the computing resource and the queue name
#BSUB -q week
g09 $GAUSINFILE

Once the com file and LSF script are in place, Gaussian can then be run to do the calculation. At the prompt, type the following command to start the calculation.

  bsub < spe_hf_6-31g

Once the job is done, an email message similar to the following will be sent to you telling that the Gaussian job is completed. The Gaussian outfile with filename “spe_hf_6-31g.log” is created. You can also type the following LSF command to check the status of the job.

  bjobs

Here is the content of the email message.

Subject:  Job 131932: <command> Done
Date:  Thu, 16 Mar 2009 09:57:32 -0500 (EST)
From:  LSF
To:  $USER@email.unc.edu
Job was submitted from host by user <$USER>.
Job was executed on host(s) <hostname>, in queue <week>, as user <$USER>.
<$HOME> was used as the home directory.
<$PWD> was used as the working directory.
Started at Thu Mar16 09:51:49 2009
Results reported at Thu Mar 16 09:57:17 2009
Your job looked like:
------------------------------------------------------------
# LSBATCH:  User input
#!/bin/tcsh
# Compose Gaussian com file locally, run Gaussian,
# and copy the log file back to local machine
# Set up input filename, use same filename locally and remotely
setenv GAUSINFILE spe_hf_6-31g.com
#BSUB -J "Gaussian Job"
#BSUB -q week
g09 $GAUSINFILE
------------------------------------------------------------
Successfully completed.
Resource usage  summary:
CPU time  :  204.13 sec.
Max Memory  :  22  MB
Max Swap  :  143  MB
Max Processes  :  5
The output (if any) follows:

Return to List of Scientific Applications Available

Additional Help

Research Computing home page