Manual.v0.2.0

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 15

DownloadManual.v0.2.0
Open PDF In BrowserView PDF
Manual for tools-for-g16.bash (0.2.0, 2019-03-19)
Martin C Schwarzer
March 19, 2019

Contents
1 Introduction
1.1

2

Preliminary notes on the usage of this manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2 Installation & Configuration
2.1

2
2

Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3 Utilities

3
3

3.1

Input preparation: g16.prepare.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4

3.2

Input preparation: g16.dissolve.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5

3.3

Input preparation: g16.freqinput.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

3.4

Input preparation: g16.ircinput.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

3.5

Input preparation: g16.optinput.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

3.6

Input preparation: g16.spinput.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

3.7

Pre-processing: g16.testroute.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

3.8

Input submission: g16.submit.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

3.9

Post-processing: g16.getenergy.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.10 Post-processing: g16.getfreq.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.11 Post-processing: g16.chk2xyz.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4 Usage examples

11

4.1

Basic molecular structure optimisations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4.2

Transition state search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

5 Author, Bugs, and the Rest

15

1

Preamble
The following document is currently little more than the already existing reference sheet. As documentation
often goes, it takes a bit more time to do it properly. I apologise for the inconvenience.

1

Introduction

The essence of quantum chemistry is performing calculations with a variety of different methods and programs.
Quite a few of these programs use low level input and output systems. In principle you are usually dealing with
text-based files.
It is in the nature of the problem, that some of the regular tasks are quite repetitive. In order to ease these
tasks, but more importantly also secure a certain level of consistency, some steps can and should be automated.
This is where this repository, tools-for-g16.bash, comes into play. Within it are contained a few scripts written
in bash, which are targeted to aid the use of the quantum chemistry software package Gaussian 16. They cover
automatic generation of input files, submission of these to a queueing system, and post-processing of output
files to archive and extract results.
Please understand that this project started out to help me with my everyday work. I am happy to hear
about suggestions and bugs. I am also fairly certain, that it is and will be a work in progress for quite some
time. Be aware that it could be in constant flux.
This ’software’ comes with absolutely no warrenty. None. Nada. If you decide to use any of the scripts, it
is entirely your resonsibility.

1.1

Preliminary notes on the usage of this manual

To make the manual easier to understand a few abreviations and common notations are used: Anything set
in brackets [ ] indicates optional arguments or inputs. Arguments in angles < > require human input, and a
vertical bar | indicates alternatives between the inputs or options.
The following abbreviations will be used throughout:
opt
Short for option(s)

2

ARG

String type argument

INT

Positive integer (including zero)

NUM

Signed whole number (including zero, the plus sign can be omitted)

FLT

Signed floating point number (the plus sign can be omitted)

DUR

Duration in format [[HH:]MM:]SS

Installation & Configuration

The scripts of this repository are not self-contained, they each need access to the resources directory and it has
to be called like that.
The easiest way to install the script is to clone the git repository from GitHub:
github.com/polyluxus/tools-for-g16.bash. Alternatively you can download the tarball archive of the latest
release from there, too:
github.com/polyluxus/tools-for-g16.bash/releases/latest.
After unpacking it only needs to be configured. There are a two kinds of file names recognised: g16.tools.rc
and the hidden .g16.toolsrc. The repository comes with an example of the former, therefore updating the
repository will (probably) overwrite the file. The latter file is excluded from this process, and therefore has
always precedence, so it is generally a safer option to configure.
The scripts will search for these configuration settings in the following order of directories:
1. the path to the script itself

2

2. the user’s home directory
3. the .config directory in the user’s home directory
4. the current working directory, i.e. from where the script is called.
Only the last found file will be applied.
The repository comes with a configuration script in the configure directory. It produces a formatted file
like g16.tools.rc from old or the default settings. While you can assign an arbitrary filename, I recommend
to store as .g16.toolsrc in the root directory of the repository.
To make the scripts accessible from anywhere, the directory where they have been stored must be found in
the PATH variable. Alternatively, you can create softlinks to them in a directory, which is already recognised by
PATH. A common setting for this is the local $HOME/bin. The configure script will, if desired, try to create these
softlinks (omitting the sh suffix).

2.1

Dependencies

For displaying the help files, the command line utility grep is required.
Some scripts need access to an istallation of Open Babel;1 it is mainly used to interface to the TurboMole
coord file format, and the post-processing scripts.
It should be no surprise that an installation of Gaussian 16 is necessary for some of the scripts, currently
used are the utilities testrt and formchk. While a main wrapper (see next chapter) is still not included in the
repository, the scripts will accept these. Otherwise the Gaussian environment has to be set up, and the utilities
must be found in the PATH directories. The direct path to these utilities might work, too.
The following example is a very simple wrapper script when using software modules.
# !/ bin / bash
module load gaussian
" $@ "
For the RWTH clusters, which have such an environment installed, there is a separate repository with such
wrapper scripts: github.com/polyluxus/rwth-tools.

3

Utilities

There are essentially three different kinds of scripts contained in this repository: input generation scripts,
execution/submission scripts, and post-processing scripts.
The input generation scripts will, as the description may hint, parse a given file and write an input file for
Gaussian 16. These scripts are designed to be chained, so that a generated input file may act as a template for
a new input file. For example, an input file created with g16.prepare (3.1) can be used with g16.freqinput
(3.3), or with g16.dissolve (3.2). In the next chapter the interplay of the utilities is further explained with
example usages. This of course makes these files dependending on each other, more precisely the newly generated
input relies on the successful creation of a checkpoint file of the previous job. The mechanism employed by
the scripts was introduced in Gaussian 09 Rev. E.01, with the %OldChk directive, which essentially copies the
checkpoint file of a completed calculation to the new location. The contents of which can then be read, or
accessed, with the geom/guess keywords. That actually means, that the input files of a calculation chain can
be prepared in advance without knowing the actual outcome, then submitted with these dependencies.
In Gaussian there is a mechanism to do this with one input file, so called compound jobs, but I (personally)
discourage everyone from using this. There are a few reasons for this, but the most important is that nonstandard route commands will not be copied to a second job, depending on what was done, the level of theory
1 For

more information see http://openbabel.org/.

3

may actually vary.2 Second most important is that any of these steps may fail; if they do, you loose the fallback
and with it results and calculation time. Another inconvenience is that some visualisation programs are not
able to parse these kind of output files.
Essentially the scripts emulate this process, but split it up and externalise the dependencies.
The second group of scripts are execution or submission scripts. Working with a queueing system often
comes with some waiting time. Adjusting the parameters of the calculations to reasonable values can lead
to significant reductions of these times (see g16.submit, 3.8). To further avoid failing in early stages, it is
reasonable to check the route section for syntax errors before submission (see g16.testroute, 3.7). Nothing is
worse than waiting for a job to start, only to realise that a keyword is misspelt.
In this category one crucial example is yet missing: A multipurpose wrapper (or shortcut) script, to actually
call the utilities without having them permanently accessible in the environment. The whole repository was
intended to be based on this, however, it is still the one thing that is missing.3
The last category are post-processing scripts, which help extract data, or transform data files into file
formats, which are more suitable for archiving.

3.1

Input preparation: g16.prepare.sh

This tool reads in a file containing a set of cartesian coordinates and writes a Gaussian inputfile with predefined
keywords. The script interfaces to simple Xmol4 format as it is understood by most molecular editors, but it
understands the Turbomole (or in extension GFN-xTB) coord format, too, if Open Babel is installed on the
system.
Since the implementation actually only looks for lines containing a string (at least one letter) and four
floating point numbers separated by spaces (or tabs), it is therefore also suitable to also parse already generated
input files. This was necessary due to the incapabilities of GaussView to produce actual coordinate files; it
rather produces Gaussian input data files (*.gjf) containing structural information.
This tool is incapable of parsing/producing z-matrix style input.
Usage:
g16.prepare.sh [opt] 
Options:
-T 

Temperature (kelvin). This switch adds the temperature keyword to the route section.

-P 

Pressure (atmosphere). This switch adds the pressure keyword to the route section.

-r 

Add ARG to route section. This keyword may be used to add any keyword to the route
section.

-R 

Specific route section ARG. With this option, you can specify a complete route section. It
will be checked for syntax errors, and it can further be modified with -r .

-l 

Load predefined route section. The basic configuration (and the default values) comes
with a couple predefined route sections (as examples). They can be changed in the
configuration files and eith the configuration script. I still have not gotten around to
write a route section building script, so this has to be done by hand.

-l list

Show all predefined route sections. This is a special argument to the above.

2 See

the Gaussian website http://gaussian.com/input/ for details about multistep jobs.
comparison, the wrapper script existed in the now deprecated github.com/polyluxus/tools-for-g09.bash repository; and it
may be implemented some time in the future.
4 The prepare script is currently limited to a very simple version of the Xmol file format, and currently only supports the fourfield format. Each file therefore should contain a two line “header”, with the number (integer) of atoms in the first, and a free
form comment in the second. This header, however, will be discarded by g16.prepare.sh. The “body” of the file contains the
positions of the atoms, one line each, in Cartesian coordinates: Element-Symbol xx.xxx yy.yyy zz.zzz, where the element symbol
is a string and the other fields are floating point numbers. The five-field format, which includes an optional charge for the element,
or the eight-field format, which assigns an optional vector associated with the element, as well as the seven-field format, which is
the same as before, but without the charge, are not yet recognised. (If there were implemented, everything except the first four
fields would be discarded.)
3 For

4

-t 

Adds ARG to end of file. Sometimes it is necessary to add additional lines to the end of an
input file. This option can be used to do that. Fair warning though: this is still somewhat
experimental and not very convenient to use. To include an empty line, the argument has
to be set explicitly empty: -t ’’.

-C 

Specify caption/title of job. Gaussian requires a title section, which must not be empty.
Replacements: %F input filename; %f input filename without .xyz; %s like %f, also filtering
start; %j jobname; %c charge (with indicator chrg); %M multiplicity (with indicator mult);
%U unpaired electrons (with indicator uhf)
The script defaults to using Calculation: %j; %c; %M; %U; (date).

-j 

Jobname of the calculation. The script selects this on the basis of the given molecular
structure file name () and derives all other file names from it. This switch can be
used to explicitly ovewrite this.

-j %f
-j %s

Jobname is  filtering the extension .xyz
Jobname is  filtering the extension start.xyz

-f 

Filename of generated input. This is normally derived from the jobname, but ocasionally
it is worthwhile to set it explicitly.

-c 

Charge (default: 0).

-M 

Multiplicity (default: 1; ≥ 1).

-U 

Unpaired electrons (unset; ≥ 0). This option will overwrite a multipliity and vice versa.

-m 

Memory (megabyte). This will add %Mem=INTMB to the input file.

-p 

Processors. This will add %NProcShared=INT to the input file.

-d 

Disksize (megabyte). This will add the MaxDisk keyword to the input file.

--

Explicitly close reading script options.

-s

Silence script (incremental) to supress messages, warnings, errors.

-h

Print a small help file.

3.2

Input preparation: g16.dissolve.sh

This tool reads in a Gaussian 16 input file to extract the current route section and adds relevant keywords for
solvent corrections and produce a new input file. Since this again utilises the %OldChk directive in conjunction
with the geom/guess keywords, the calculation it is based on should be completed.
The list of options regarding the scrf keyword is long and for specifics it is referred to the Gaussian online
manual.
If nothing but a file name is specified, the script defaults to writing a single point calculation input file with
the scrf(pcm,solvent=water) keyword and options.
Usage:
g16.dissolve.sh [opt] 
Options:
-o 

Adds option ARG to the SCRF keyword. This may be used to specify the method (like PCM,
SMD, dipole, etc.). The default is PCM. The solevent should no be set with this switch,
but with -S  instead. This option may be specified multiple times, the input stack
will be collated and written to file.

-S 

Adds option solvent=ARG to the SCRF option list. The default solvent is water. This
option will cause an error if specified more than once.

-O

Runs an optimisation (preserves or adds OPT). The default of this script is to run a singlepoint calculation. Rather than adding the opt keyword anew (with -r opt()),
this switch prevents deleting it in the first place.

-r 

Add ARG to route section. This keyword may be used to add any keyword to the route
section; it can be specified multiple times.
5

-t 

Adds ARG to end of file. This switch functions the same way as in the prepare script.

-f 

Filename of generated input.

-m 

Memory (megabyte). This will add %Mem=INTMB to the input file.

-p 

Processors. This will add %NProcShared=INT to the input file.

-d 

Disksize (megabyte). This will add the MaxDisk keyword to the input file.

--

Explicitly close reading script options.

-s

Silence script (incremental) to supress messages, warnings, errors.

-h

Print a small help file.

3.3

Input preparation: g16.freqinput.sh

This tool reads in a Gaussian 16 inputfile to extract the current route section and adds relevant keywords for a
frequency calculation and produce a new input file. Since this again utilises the %OldChk directive in conjunction
with the geom/guess keywords, the calculation it is based on should be completed.
There are some options regarding the freq keyword, some common ones are mentioned below, but for
specifics it is referred to the Gaussian online manual. If nothing further is specified, no additional options will
be activated.
Usage:
g16.freqinput.sh [opt] 
Options:
-o 

Adds option ARG to the freq keyword. This option may be specifie multiple times, the
input stack will be collated and written to file. Example options are NoRaman, VCD,
Anharmonic, etc..
Writes a property run input file to redo a frequency calculation. This adds the option

-R

ReadFC to the freq option list, which is most comonly used to repeat the statistical
thermodynamics at different temperatures and pressures (see below). Note that this
behaves similar to opt(RCFC), but is spelt differently.
-T 

Temperature (kelvin). This switch adds the temperature keyword to the route section.

-P 

Pressure (atmosphere). This switch adds the pressure keyword to the route section.

-r 

Add ARG to route section. This keyword may be used to add any keyword to the route
section; it can be specified multiple times.

3.4

-t 

Adds ARG to end of file. This switch functions the same way as in the prepare script.

-f 

Filename of generated input.

-m 

Memory (megabyte). This will add %Mem=INTMB to the input file.

-p 

Processors. This will add %NProcShared=INT to the input file.

-d 
--

Disksize (megabyte). This will add the MaxDisk keyword to the input file.
Explicitly close reading script options.

-s

Silence script (incremental) to supress messages, warnings, errors.

-h

Print a small help file.

Input preparation: g16.ircinput.sh

This tool parses a Gaussian 16 inputfile from a previous frequency calculation and adds relevant keywords to
produce two input files for separate IRC calculations, i.e. the forward and the reverse direction. Since this
again utilises the %OldChk directive in conjunction with the geom/guess keywords, the calculation it is based on
should be completed. The script will assume it is based on a successful frequency calculation, and will therefore
write a file that will retrieve calculated Cartesian force constants from the checkpoint file. This means that
RCFC will always be included as an option to the irc keyword. If there is no freq keyword in the input stream,
the script will issue a warning, and the created input files should be checked manually.
6

Therefore the script defaults to adding irc(RCFC,forward/reverse) to the respective route sections.
There are some more options regarding the irc keyword, some common ones are mentioned below, but for
specifics it is referred to the Gaussian online manual.
Usage:
g16.ircinput.sh [opt] 
Options:
-o 

Adds option ARG to the irc keyword. This option may be specifie multiple times, the
input stack will be collated and written to file. Example options are MaxPoints=10,
StepSize=10, etc.. Please note that, as described above, the option RCFC will alway be
written; therefore specifying CalcFC will lead to an error in the calculations.

-r 

Add ARG to route section. This keyword may be used to add any keyword to the route
section; it can be specified multiple times.

-t 
-f 

Adds ARG to end of file. This switch functions the same way as in the prepare script.
Filenametemplate of generated input files; If =jobname.suffix then it produces
jobname.fwd.suffix and jobname.rev.suffix.

-m 

Memory (megabyte). This will add %Mem=INTMB to the input file.

-p 

Processors. This will add %NProcShared=INT to the input file.

-d 

Disksize (megabyte). This will add the MaxDisk keyword to the input file.

--

Explicitly close reading script options.

-s

Silence script (incremental) to supress messages, warnings, errors.

-h

Print a small help file.

3.5

Input preparation: g16.optinput.sh

This tool parses a Gaussian 16 inputfile and writes a new inputfile for a structure optimisation. Originally this
was desingend to be chained onto a previously completed IRC calculation to converge the structure into a local
minimum. This has since changed and the utility of this script is apparently wider. It can also, for example, used
to write an input file to remove imaginary modes that were discovered during a frequency calculation. Another
use would be chaining it onto a successful single point calculation, e.g. after applying solvent corrections. Since
this again utilises the %OldChk directive in conjunction with the geom/guess keywords, the calculation it is
based on should be completed. Another usage is performing scans, or unfreezing scans, etc..
There are many options for the opt keyword, some common ones are mentioned below, but for specifics it
is referred to the Gaussian online manual.
If no options are specified, this just defaults to adding the opt keyword.
Usage:
g16.optinput.sh [opt] 
Options:
-o 

Adds option ARG to the opt keyword. This option may be specifie multiple times, the input
stack will be collated and written to file. Example options are TS, AddGIC/ModRedundant,
MaxStep=10, MaxCycles=300, etc..

-r 

Add ARG to route section. This keyword may be used to add any keyword to the route
section; it can be specified multiple times.

-t 

Adds ARG to end of file. This switch functions the same way as in the prepare script.

-f 

Filename of generated input.

-m 

Memory (megabyte). This will add %Mem=INTMB to the input file.

-p 

Processors. This will add %NProcShared=INT to the input file.

-d 

Disksize (megabyte). This will add the MaxDisk keyword to the input file.

--

Explicitly close reading script options.
7

-s

Silence script (incremental) to supress messages, warnings, errors.

-h

Print a small help file.

3.6

Input preparation: g16.spinput.sh

This tool is the counterpart to g16.optinput.sh, and it creates a new inputfile for a subsequent single point
calculation from a specified Gaussian 16 inputfile. If nothing is specified as options, i.e. a new route section or
additional keywords, it will simply remove the opt keyword along with its options.
It is possible to overwrite the existing route section to e.g. use a different level of theory. It is still based on
the %OldChk directive add the geom/guess keywords. This means that data from a previous calculation will be
retrieved.
Usage:
g16.spinput.sh [opt] 
Options:
-r 

Add ARG to route section. This keyword may be used to add any keyword to the route
section; it can be specified multiple times.

-R 

Specific route section ARG. With this option, you can specify a complete route section. It
will be checked for syntax errors, and it can further be modified with -r .

3.7

-t 

Adds ARG to end of file. This switch functions the same way as in the prepare script.

-f 

Filename of generated input.

-m 

Memory (megabyte). This will add %Mem=INTMB to the input file.

-p 

Processors. This will add %NProcShared=INT to the input file.

-d 

Disksize (megabyte). This will add the MaxDisk keyword to the input file.

--

Explicitly close reading script options.

-s

Silence script (incremental) to supress messages, warnings, errors.

-h

Print a small help file.

Pre-processing: g16.testroute.sh

This tool parses a Gaussian 16 input file and extracts the route section, which it then checks for syntax errors
with the Gaussian 16 utility testrt. Unfortunately the original Gaussian utility requires a string as input,
which is quite inconvenient if you want to test the input file itself. The input file is parsed by the same routine
as used in the other scripts, and can be used to validate the created (or to be submitted) files.
Usage:
g16.testroute.sh [opt] 
Options:
--

3.8

Explicitly close reading script options.

-s

Silence script (incremental) to supress messages, warnings, errors.

-h

Print a small help file.

Input submission: g16.submit.sh

This tool parses and then submits a Gaussian 16 inputfile to a queueing system.
More specifically it will modify the supplied input file to match the requested resources for the queueing
system. It will create a bash script to be executed as a batch job, i.e. setting up the correct environment and
executing Gaussian 16.
Currently there are three queueing systems supported: PBS, SLURM, LSF (or BSUB). Each come with a
generic set-up, and the latter two with some RWTH specific settings. (Note that the RWTH cluster running
the LSF queueing system will be decommissioned in April 2019, therefore the developement of this feature will

8

probably be halted at an as-is status.)
If the input files to be submitted are prepared with the tools of this repository, a few warnings are to be
expected (specifically the memory and priocessors settings). These basically only serve as a reminder.
Usage:
g16.submit.sh [opt] 
Options:
-m 

Memory (megabyte).
This will add %Mem=INTMB to the Gaussian input file, it will also set the memory flag
for the queuing system. The both settings will not be equal, because some overhead for
Gaussian is included.

-p 

Processors.
This will add %NProcShared=INT to the input file, it will also set the appropriate flags

-d 

for the numbere of threads/CPUs for the queueing system.
Disksize (megabyte).
This will add the MaxDisk keyword to the input file, but it has no effect in the submitted
script.

-w 

Walltime limit. This sets the appropriate flag for the maximum wall time the job will be
allowed to run.

-e 

Specify an environment variable ARG in format . Occasionally it is necessary
to set specific environment variables for Gaussian 16 (see manual), this flag causes them
to be written to the submitted script before Gaussian is loaded.

-j 

Wait for job with ID INT. Only numeric arguments are supported (even though some of
the available queueing systems would allow names, too.) This option is useful to chain
calculations that depend on each other. Dependencies may stretch over multiple jobs, so
this option can also be specified multiple times.

-H

Submit with status hold (PBS, SLURM) or PSUSP (BSUB). Jobs submitted with this
status have to be released later, this could be useful to test submisson. However, RWTH
users should be aware that the tools to release a job are not available for ordinary users.

-k

Only create (keep) the jobscript, do not submit it. This option is useful to see what the
script looks like before commiting it to the queuing system, and possibly ammend /modify
it. (This was initially born by the idea to delete the script after successful submission,
hence the name of the option.)

-Q 

Queue for which job script should be created - (: pbs, slurm,
bsub; : gen [generic], rwth; see above for more details).

-P 

Account to project (BSUB) or account (SLURM); if ARG is default|0|’’ presets are
overwritten. If accounting is activated for BSUB or SLURM, this option will cause the
appropriate flag to be set in the submission script. (I have no experience for the PBS
queueing system with that, so this is not implemented right now.)

-M 

Specify a machine type (only bsub-rwth); if ARG is default|0|’’ presets are overwritten.
This is a very specific setting, and is probably soon be deprecated. Specifically, this will

-u 

cause #BSUB -m ARG to be added to the submit script.
set user email address (SLURM, BSUB); if ARG is default|0|’’ presets are overwritten.
(I have no experience for the PBS queueing system with that, so this is not implemented
right now.)

--

Explicitly close reading script options.

-s

Silence script (incremental) to supress messages, warnings, errors.

-h

Print a small help file.

9

3.9

Post-processing: g16.getenergy.sh

This tool finds energy statements from the output files of Gaussian 16 calculations. It is basically an elaborate
interface to the grep command, which can be used to create summaries of the output files.
If no files are given as argument, the script will operate on all output files in the current directory. The
default operating mode of the script will look for input files with the configured suffix (default *.com), then
match the appropriate output suffix (default: *.log), and extract energies from these files.
As such, it does not matter where  is an input or output file.
Usage:
g16.getenergy.sh [opt] []
Options:
-i 

Specify the input suffix to be used for finding matching output files when processing a
directory.

-o 

Specify the output suffix to be used for finding the files when processing a directory.

-L

Print the full file and path name of the parsed output file (seperated by newline). The
default behaviour is printing only the filename without the suffix.

--

Explicitly close reading script options.

-s

Silence script (incremental) to supress messages, warnings, errors.

-h

Print a small help file.

3.10

Post-processing: g16.getfreq.sh

This tool summarises the output of a Gaussian 16 frequency calculation and extracts and reformats the thermochemistry data. This is similarly to g16.getenergy.sh an elaborate interface to the grep command, but it
(depending on the level of verbosity) extracts all corrections necessary to compute thermochemistry, see also
the Gaussian White Paper on thermochemistry.
Usage:
g16.getfreq.sh [opt] 
Options:
-v
-V 

Incrementally increase verbosity of the script.
Set level of verbosity directly, (0|1|2|3|4). The different levels are as follows: (0; default) display a single line with only the filename file, electronic energy Eel , zero-point
correction EZPE , enthalpy correction Hcorr , and correction to the Gibbs energy Gcorr ; (1)
display a single line of most values (equal to -v), which also prints the method, temperature T , pressure p, internal energy correction Ucorr , entropy Stot , constant volume heat
capacity CV,corr ; (2) display a short table of most values (like above, equal to -vv); (3)
like 2, also repeats the route section (equal to -vvv); (4) like 3, also includes the decomposition of the entropy, thermal energy Etot and heat capacity into electronic, translational,
rotational, and vibrational contributions (equal to -vvvv). If this option is found, -v will
be ignored.

-c

Separate values by comma (-V0|-V1).

-f 

Write the summary to file file instead of screen.

--

Explicitly close reading script options.

-s

Silence script (incremental) to supress messages, warnings, errors.

-h

Print a small help file.

3.11

Post-processing: g16.chk2xyz.sh

This tool is intended to create files for archiving a Gaussian 16 calculation. Since normal Gaussian checkpoint
files are binary files, and hence platform dependent, it interfaces to the formchk utility to produce a formatted

10

checkpoint file (a text file). It further uses Open Babel to write a molecular structure file in Xmol format
(*.xyz).
It can either be applied to checkpoint files or the current directory. In the latter case it assumes chk as the
suffix of the checkpoint files.
Usage:
g16.chk2xyz.sh [-s] -h | -a | 
Options:
-a

4

Formats all checkpointfiles that are found in the current directory.

--

Explicitly close reading script options.

-s

Silence script (incremental) to supress messages, warnings, errors.

-h

Print a small help file.

Usage examples

This chapter is still in heavy developement.

4.1

Basic molecular structure optimisations

The molecular structure is often also referred to as geometry, and hence the optimisation of the molecular
structure is often referred to as geometry optimisation.
Here is a short checklist, flowchart, or list how to get from an initial (guessed) structure to a final structure.
1. Create a molecular structure file in cartesian coordinates (*.xyz) with your preferred molecular editor,
command line tool, or even text editor.5
It needs a bit training to click together a reasonable guess, Chemcraft has a reasonably large fragments
database, Molden has a few standards, but is (technically) able to read in fragments, too. For simple
molecules you can sometimes find structures online, maybe even crystal structures. Another easy way is
to search for it on ChemSpider, PubChem, or draw it with Chemdraw (etc.) and generate a SMILES
code. You can use Open Babel to create a guessed structure. For example, the SMILES for ethanol is
CCO, see PubChem CID 702, then the command for Open Babel is:
obabel -:’CCO’ -oxyz --gen3d -Oopt.start.xyz
The option -: takes a SMILES as an input, the -o selects the output format (here chosen as Xmol,
Cartesian coordinates), --gen3d tells the program to generate 3D coordinates, and -O selects the output
file to write on; see also the Open Babel Wiki.
This process sometimes even works for more complex molecules; unfortunately not for organometallic (and
similar) compounds, because SMILES does not describe ionic interactions.6 Assume we did this, and we
5 Gaussview is unfortunately unable to write Xmol files, for whatever reason, this is not supported. Instead it can write a
standard Gaussian input file, which you could set up ready-for-submission-complete with Gaussview. A lot of people do that, it is
the GUI to Gaussian after all, the downside of this approach is that you tend to forget what you are doing.
Not everything in those input files is necessary, and some of it is a terrible choice. For example, it usually includes the absolute
paths to checkpoint files. If you decide to change anything (and this is quite likely) and then rerun a calculation, it will very likely
fail, or overwrite existing things. If you are using Gaussview locally, but submit a calculation to the cluster, it is also likely, that
the specified location does not exist.
There are easy and not quite as easy workarounds:

• Use a different program.
• Edit the files on the cluster by hand, remove everything superflous with a text editor.
• Convert them with, e.g. Molden. (Unfortunately Open Babel cannot do that.)
• Use my prepare script. It will search the inputfile for lines of the pattern XX +000.0000 -000.0000 +000.0000 (two letters
followed by three signed real numbers).
• Alternatively, you can use a different program. (Seriously, it is worth mentioning it twice.)
• You can use Gaussian’s newzmat utility to convert it.
6 Some may work okay-ish, e.g. sodium ethanolate (CC[O-].[Na+]), others not. You can try building the structure for the cation
of tris(ethylenediamine)cobalt(III) chloride: C(C[NH-])[NH-].C(C[NH-])[NH-].C(C[NH-])[NH-].[Co].[Cl-].[Cl-].[Cl-].

11

will call it bp86svp.start.xyz.
2. Create an input file. A very simple optimisation would probably use BP86/def2-SVP with mostly default
parameters, or similar,7 so you can just run the prepare script:
g16.prepare -R’#P BP86/def2SVP/W06’ -r’OPT(MaxCycles=100)’ \
-j’bp86svp.opt’ bp86svp.start.xyz
This will create the file bp86svp.opt.com.
3. Submit the input file to the queue. The following command will handle this:
g16.submit -p12 -m4000 bp86svp.opt.com
This will create a modified inputfile bp86svp.opt.gjf, with the correct settings for Gaussian according
to what you requested in the submit routine. It will also create (assuming it is set to slurm-gen) a script
for the queueing system, bp86svp.opt.slurm.bash, which will be executed remotely.
What sensible parameters (processors, memory, walltime) are comes with experience. Obviously don’t ask
for more than you have (-p12, -m4000 is reasonable for medium sized molecule optimisations).
4. Once the calculation is done (you’ll probably get an email), you will have a few output files.
• bp86svp.opt.log: the main output
• bp86svp.opt.chk: the checkpoint file (useful for later)

• bp86svp.opt.slurm.bash.e012345: the error file from the queueing system8
• bp86svp.opt.slurm.bash.o012345: the standard output file from the queueing system
Check the main output file for errors. Everything should be fine when you find Normal termination at
the end (tail bp86svp.opt.log). You can (and should) also search for stationary point found :
grep ’Stationary point found’ -B7 -A3 bp86svp.opt.log.
Don’t forget to open it with a molecular viewer to make sure the structure is actually sensible.
5. Create a frequency calculation in the same directory:
g16.freqinput bp86svp.opt.gjf
This creates bp86svp.opt.freq.com which you can submit:
g16.submit -p12 -m24000 bp86svp.opt.freq.com
Frequency calculations are memory demanding, they will slow down if they do not have enough, about 2
GB per core should be okay.
7 Choosing an appropriate level of theory is not often trivial, one has to consider a couple of things, like accuracy, performance,
and speed. I have previously written quite a long article about that: DFT Functional Selection Criteria.
The example command uses the DF-BP86/def2-SVP level of theory, but with something extra. Remember:
g16.prepare -R’#P BP86/def2SVP/W06’ -r’OPT(MaxCycles=100)’ -j’bp86svp.opt’ bp86svp.start.xyz
The -R switch to g16.prepare sets the basic route section to #P BP86/def2SVP/W06, the different parts mean the following:

• The #P selects verbose printing (G16 manual), other options are #N (normal) and #T (terse).
• The method is selected as BP86, which selects the exchange functional B and the correlation functional P86. There are plenty
of Functionals implemented.
• For the example I have chosen the def2-SVP basis set; please note that the keyword is without the dash. There are again
many available in Gaussian, and additional ones can be defined; that is something for more advanced users (and a topic for
another day).
• Additionally, this route section requests density fitting (sometimes also referred to as resolution-of-the-identity, or short RI,
approximation) with the auxiliar basis set W06 (see the Manual for more), which should speed up the calculation. This is also
available via the DensityFit/DenFit keyword, and therefore commonly abbreviated with DF in the level of theory.
The -r switch to the script adds more keywords to the route section. In this specific case we’ll request an optimisation (OPT)
with 100 cycles at the most.
The -j switch selects a jobname for the calculation, and it will further be used to derive filenames for it.
The last argument is the molecular structure file, here in the Xmol format. There are some other formats recognised, but that
is also something for another day.
8 The number, here used as example 012345, is the JobID assigned by the queueing system.

12

6. You’ll get similar output files like above. Open the *.log file with a molecular viewer, and look at the
frequencies (or modes). If there are no imaginary modes, you have found a local minimum, if there is
exactly one mode, you found a transition state. Repeat the above steps as necessary if you didn’t meet
your target.
7. Look for the energy values and put them in tables to calculate barriers and stuff. You can use the
post-processing script for that, or look through the manual by yourself:
g16.getfreq -V3 bp86svp.opt.freq.log
8. Finalise the calculation with creating a formatted checkpoint file and a coordinate file. The Gaussian
checkpoint files are binary files and they are machine dependent (and fairly large). That usually doesn’t
pose any problem, but it is good practice to create a pure text file anyway. The formatted checkpointfile
can be used as an input for further analysis by many programs, therefore it is good to have in any case.
It can also be reverted to a binary checkpoint file, which means you can actually omit the checkpoint file
while archiving.
Writing an coordinate file with the optimised structure helps cutting down loading times; it also gives you
an indicator that the calculation is done.
You can do these two steps together with the following command:
g16.chk2xyz bp86svp.opt.freq.chk
The above command produces the formatted checkpoint file bp86svp.opt.freq.fchk and the coordinate
file bp86svp.opt.freq.xyz. Alternatively you can use the script with the -a switch to do that for every
*.chk file in the current directory.
Once you have done all the steps you can move on to interpreting the results, which is where often the real
work lies.
The following chart presents a basic diagramme of the above description, it shows how the tools may interact
with each other, or can be chained after one another, respectively.

13

Start
Chemcraft, Molden, Open Babel, . . .
.start.xyz
g16.prepare
.com
g16.submit
g16

.log, .chk,
(queue error/out)
g16.getenergy

g16.chk2xyz
no

.xyz, .fchk

Stationary point found?

extract molecular structure, repeat optimisation

extract molecular structure, repeat optimisation

.gjf,
..bash

Eel

yes g16.freqinput
.freq.com
g16.submit
.freq.gjf,
.freq..bash

g16

.freq.log,
.freq.chk,
(queue error/out)
g16.getfreq
g16.chk2xyz

inspect *.log

≥2

NImag
i ∈ {0, 1, ..., N}

0

.freq.xyz,
.freq.fchk

EZPE , . . . , Hcorr , Gcorr , . . .
Eo , . . . , H, G, . . .

local minimum

target met?

no

yes

1
transition state

target met?

extract molecular structure, modify/scan, repeat optimisation

yes

no

Done!

4.2

Transition state search

The following chart attempts to do the same for the steps after a successful transition state optimisation.
(This part of the documentation is still very much a work in progress.)

14

Optimised
TS Structure
...
.freq.com,
.freq.gjf,
.freq.log,
.freq.chk, ...

g16.getfreq

EZPE , Eo , . . . , G

g16.ircinput
.irc.fwd.com

.irc.rev.com

g16.submit
.irc.fwd.log,
.irc.fwd.chk,
(queue error/out)
g16.chk2xyz

g16

g16.submit
g16
.irc.rev.gjf,
.irc.rev..bash

.irc.fwd.gjf,
.irc.fwd..bash

inspect *.log

inspect *.log

(.irc.fwd.xyz,)
.irc.fwd.fchk

g16.optinput

g16.optinput

.irc.fwd.opt.com

g16

g16.submit
g16
.irc.rev.opt.gjf,
.irc.rev.opt..bash

.irc.fwd.opt.gjf,
.irc.fwd.opt..bash
inspect *.log

g16.chk2xyz

.irc.fwd.opt.xyz,
.irc.fwd.opt.fchk

Stat. Point?

no

no

yes g16.freqinput

Stat. Point?

.irc.fwd.opt.freq.com

g16.submit

g16.submit
.irc.rev.opt.freq.log,
.irc.rev.opt.freq.gjf,g16
.irc.rev.opt.freq.chk,
.irc.rev.opt.freq..bash
(queue error/out)

.irc.fwd.opt.freq.gjf,
.irc.fwd.opt.freq..bash
inspect *.log

inspect *.log

g16.chk2xyz

g16.chk2xyz

NImag?

≥1

≥1

0
EZPE , Eo , . . . , G

NImag?

.irc.rev.opt.freq.xyz,
.irc.rev.opt.freq.fchk

0

Done!

EZPE , Eo , . . . , G

Author, Bugs, and the Rest

This repository was created and is maintained by Martin C Schwarzer ( Martin-マーチン ‡ polyluxus).
If you find any bugs, have questions, want features implemented, please do it via the GitHub Issue tracker,
or fork it and send a pull request.
The help of my colleagues for testing, finding bugs, extending the documentation is greatly appreciated.
This document is licensed c b a.

15

g16.getfreq

g16.getfreq

.irc.fwd.opt.freq.xyz,
.irc.fwd.opt.freq.fchk

.irc.rev.opt.xyz,
.irc.rev.opt.fchk

yes g16.freqinput

.irc.fwd.opt.freq.com

5

.irc.rev.opt.log,
.irc.rev.opt.chk,
(queue error/out)

inspect *.log

g16.chk2xyz

.irc.fwd.opt.freq.log,g16
.irc.fwd.opt.freq.chk,
(queue error/out)

g16.chk2xyz
(.irc.rev.xyz,)
.irc.rev.fchk

.irc.fwd.opt.com

g16.submit
.irc.fwd.opt.log,
.irc.fwd.opt.chk,
(queue error/out)

.irc.rev.log,
.irc.rev.chk,
(queue error/out)



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 15
Page Mode                       : UseOutlines
Author                          : 
Title                           : 
Subject                         : 
Creator                         : LaTeX with hyperref package
Producer                        : pdfTeX-1.40.19
Create Date                     : 2019:03:19 19:02:00+01:00
Modify Date                     : 2019:03:19 19:02:00+01:00
Trapped                         : False
PTEX Fullbanner                 : This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) kpathsea version 6.3.0
EXIF Metadata provided by EXIF.tools

Navigation menu