21
1 3. Geometry Optimizations 3.1. The Potential Energy Surface The potential energy surface (PES) is a central concept in computational chemistry. It specifies how the energy of a molecular system varies with small changes in its structure. A potential energy surface is a mathematical relationship linking molecular structure and the resultant energy. For a diatomic molecule, it is a two-dimensional plot with the inter-nuclear separation on the X- axis (the only way that the structure of such a molecule can vary), and the potential energy at that bond distance on the Y-axis, producing a curve. For larger systems, the surface has as many dimensions as there are degrees of freedom within the molecule. Generally, a non-linear N atomic molecule, has 3N 6 degrees of freedom, or internal coordinates. This is because all N atoms can move in 3 dimensions (x, y and z) giving 3N degrees of freedom. However, 6 of those: three translations - in x, y, z directions, and three rotations - along x, y and z axes of the molecule as a whole - do not produce any change in energy. There are also referred to as external coordinates. For a linear molecule there are only two rotations and the number of internal coordinates (degrees of freedom) is 3N 5. A potential energy surface (PES) is often represented by illustrations like the one below. This sort of drawing considers only two of the degrees of freedom within the molecule, and plots the energy above the plane defined by them, creating a literal surface. Each point corresponds to the specific values of the two structural variables-and thus represents a particular molecular structure-with the height of the surface at that point corresponding to the energy of that structure. 3.2 Stationary points of PES There are two minima on this potential surface. A minimum is the bottom of a valley on the potential surface. From such a point, motion in any direction-a physical metaphor corresponding to changing the structure slightly-leads to a higher energy. q

3. Geometry Optimizations - Laramie, Wyoming · 3. Geometry Optimizations 3.1. The Potential Energy ... at any other point on a potential surface the marble will roll toward a

Embed Size (px)

Citation preview

1

3. Geometry Optimizations

3.1. The Potential Energy Surface

The potential energy surface (PES) is a central concept in computational chemistry. It specifies

how the energy of a molecular system varies with small changes in its structure. A potential energy

surface is a mathematical relationship linking molecular structure and the resultant energy.

For a diatomic molecule, it is a two-dimensional plot with the inter-nuclear separation on the X-

axis (the only way that the structure of such a molecule can vary), and the potential energy at that

bond distance on the Y-axis, producing a curve.

For larger systems, the surface has as many dimensions as there are degrees of freedom within the

molecule.

Generally, a non-linear N atomic molecule, has 3N 6 degrees of freedom, or internal coordinates.

This is because all N atoms can move in 3 dimensions (x, y and z) giving 3N degrees of freedom.

However, 6 of those: three translations - in x, y, z directions, and three rotations - along x, y and z

axes of the molecule as a whole - do not produce any change in energy. There are also referred to

as external coordinates.

For a linear molecule there are only two rotations and the number of internal coordinates (degrees

of freedom) is 3N 5.

A potential energy surface (PES) is often represented by illustrations like the one below. This sort

of drawing considers only two of the degrees of freedom within the molecule, and plots the energy

above the plane defined by them, creating a literal surface. Each point corresponds to the specific

values of the two structural variables-and thus represents a particular molecular structure-with the

height of the surface at that point corresponding to the energy of that structure.

3.2 Stationary points of PES

There are two minima on this potential surface. A minimum is the bottom of a valley on the

potential surface. From such a point, motion in any direction-a physical metaphor corresponding

to changing the structure slightly-leads to a higher energy.

q

2

A minimum can be a local minimum, meaning that it is the lowest point in some limited region of

the potential surface, or it can be the global minimum, the lowest energy point anywhere on the

potential surface. Minima occur at equilibrium structures for the system, with different minima

corresponding to different conformations or structural isomers in the case of single molecules, or

reactant and product molecules in the case of multi-component systems.

Peaks and ridges correspond to maxima on the potential energy surface. A peak is a maximum in

all directions (i.e., both along and across the ridge). A low point along a ridge - a mountain pass in

our topographical metaphor - is a local minimum in one direction (along the ridge), and a

maximum in the other. A point which is a maximum in one direction and a minimum in the other

(or in all others in the case of a larger dimensional potential surface) is called a saddle point (based

on its shape).

(1st order saddle point)

3

For example, the saddle point in the diagram is a minimum along its ridge and a maximum along

the path connecting minima on either side of the ridge. A saddle point corresponds to a transition

structure connecting the two equilibrium structures.

The slice along the “lowest-energy” path connecting the global minimum, the local minimum and

the transition state, that is, along the “reaction coordinate” gives a one-dimensional energy surface.

Here the transition state (saddle point) looks like a maximum. Note that the horizontal axis (i.e.

the reaction coordinate) is a combination of the two coordinates (bond length and angle) from the

original plot.

Together, minima, maxima and saddle points are called stationary points. They have in common

that at any stationary point (minimum, maximum) the surface is flat, i.e. parallel to the horizontal

line corresponding to the one geometric parameter (or to the plane corresponding to two geometric

parameters etc). A marble placed on a stationary point will remain balanced, i.e. stationary, while

at any other point on a potential surface the marble will roll toward a region of lower potential

energy.

Mathematically, the stationary points are characterized by zero first derivatives with respect to the

geometrical parameters:

0...21

nq

V

q

V

q

V (3.1)

where the potential energy is denoted by V and:

n = 3N 6 (3N 5) if we work in internal coordinates

n = 3N for Cartesian coordinates n > 3N 6 for redundant internal coordinates, i.e. internal coordinates, such as bond

lengths, angles and torsions, but more of them than we actually need.

The derivatives can be arranged into a vector, which is called gradient of energy

nq

V

q

V

q

V

VV

...

grad2

1

(3.2)

as we know from basic physics, gradient of energy is closely related to force:

VV gradF (3.3)

Therefore at a stationary point, the forces on the atoms in the molecule in all directions are all zero,

which is another reason why they are stationary points.

4

3.3. Locating minima

Minima on potential energy structures are important because they correspond to the optimum

molecular geometries, also called equilibrium structures. Geometry optimization is therefore more

or less synonymous with energy minimization. From a mathematical point of view, it is a problem

of finding a minimum of a function of many variables.

The basic idea of a minimization algorithm is to vary the geometry of the molecule (i.e. atomic

positions) is some systematic fashion so that the energy keeps decreasing; once the energy stops

decreasing and only increases with further geometry variations, the minimum is found.

Important point to remember is that all minimization algorithms only find local minima: you are

never guaranteed that the minimum found is a global one !

There are several classes of algorithms that have been developed for this purpose. They can be

divided into three basic classes:

only function values are used (no derivatives)

first derivatives (gradients) are used

second derivatives (Hessians) are used.

The first class represents the most robust, but least efficient way to find the minimum. The example

is the Simplex algorithm (also known as “amoeba”). It is robust, because it can always find a

minimum of pretty much any function, no matter how crazy. Least efficient means that for well

behaved functions, the other two classes could do it ways faster! Because molecular PES are

usually smooth and well behaved functions of atomic coordinates, these algorithms are usually not

the first choice for optimizations.

If the gradients can be computed (note that the function has to be differentiable - i.e. continuous),

they indicate in which direction the energy decreases. Remember the gradient is the negative of

force, and the force pushes the atoms to their minimum energy position (= equilibrium) position.

The simples gradient based algorithm is the so-called “steepest descent”, where steps are made in

the direction of the gradient until the minimum is found (in that direction), then the gradient is

recomputed, steps are made in the new direction etc. This is simple but in practice very inefficient.

With gradients available the direction toward the potential minimum is known, but not how far

one has to step to get there. Imagine the surface could be approximated by a quadratic function

(parabola). Assuming one dimension for illustration we could write a Taylor expansion around

some point q0:

2

02

2

00 )(2

1)()()(

00

qqdq

Vdqq

dq

dVqVqV

qq

(3.4)

taking a derivative with respect to q:

5

)( 02

2

00

qqdq

Vd

dq

dV

dq

dV

qqq

(3.5)

Assuming the point q0 is our starting point and we are looking for the next point “q” on our PES

where the energy is minimum, we know that at “q” (the minimum) the gradient has to be zero.

Setting the gradient at point “q”, which is the left-hand side of the last equation, equal to zero:

)(0 02

2

00

qqdq

Vd

dq

dV

qq

(3.6)

and solving for q:

0000

1

2

2

02

2

0

qqqqdq

dV

dq

Vdq

dq

Vd

dq

dVqq

(3.7)

In more dimensions (remember we have n coordinates, which can be 3N 6 or more for N atoms

depending on the coordinates), q has n components, gradient is a vector with n components (eqn.

3.2), which we denote g, and the second derivatives are so called force constants, which form a n-

by-n matrix called Hessian, which we will denote H:

nnnn

n

n

ji

qq

V

qq

V

qq

V

qq

V

qq

V

qq

V

qq

V

qq

V

qq

V

qq

V

2

2

2

1

2

2

2

22

2

12

21

2

21

2

11

2

2

ij

...

............

...

...

H H (3.8)

The equation then becomes:

)0(1)0(

0 gHqq

(3.9)

where the superscript “0” symbolizes the starting point and the “-1” is matrix inverse.

For the quadratic (parabolic) surface, this formula will take us from any starting point straight to

the minimum. If the surface is not exactly parabolic, this formula can be iterated, i.e. compute

gradient and (inverted) Hessian at point q0, move to the new point q using formula (3.9),

recalculate gradient and Hessian etc.

This algorithm is known as Newton-Raphson method.

6

The closer to the minimum one gets the better the quadratic approximation becomes: eventually

this algorithm will converge to the minimum.

The disadvantages of Newton-Raphson method are the following:

Hessian matrix is large and computationally expensive to construct at every iteration step

Hessian must be inverted (inverting a matrix is also computationally expensive)

Second derivatives are even more sensitive to discontinuities than gradients: for surfaces

that are not “well behaved” the method may become unstable and diverge or crash.

Do avoid that, a class of methods known as Quazi-Newton (also variable metric methods) instead

of using the true Hessian estimate it (actually its inverse) approximately, e.g. from the gradients at

the successive steps (there are many schemes for estimating and updating Hessians, see e.g.

Numerical Recipes: The Art of Scientific Computing by William H. Press, Brian P. Flannery, Saul

A. Teukolsky and William T. Vetterling, www.nr.com). The exact Hessian can be calculated once

in a while, if needed, typically when the optimization gets close to the minimum.

While this may sound like a step back - using an approximation instead of the true H, quazi-Newton

methods are actually more reliable and efficient than the old Newton-Raphson. You can imagine

more sophisticated algorithms for finding minima, using e.g. higher order (cubic) approximations

to the surface etc. Some details of the algorithm used by Gaussian can be found on the Gaussian

manual pages.

3.4. Analytical vs. numerical gradients and Hessians

Gaussian uses both gradients and approximate Hessians or true Hessians when available to find

the minima. It is important to know how the computations of gradients and Hessians are

implemented for each method.

For example, under MP & Double Hybrid DFT methods in Gaussian manual you will find this:

AVAILABILITY

MP2, B2PLYP[D], mPW2PLYP[D] : Energies, analytic gradients, and analytic frequencies.

MP3, MP4(DQ) and MP4(SDQ): Energies, analytic gradients, and numerical frequencies.

MP4(SDTQ) and MP5: Analytic energies, numerical gradients, and numerical frequencies.

Here “frequencies” as we will see later, refer essentially to Hessians, because vibrational

frequencies are calculated directly from them. The important distinction here is analytical vs.

numerical. While there is no such thing as rigorously “analytical” in Gaussian calculations

(everything is done numerically),

analytical gradients (frequencies) mean that essentially exact derivatives are calculated by

solving the corresponding derivative Shrödinger equation.

numerical gradients are calculated by finite differencing from energies at two points:

7

q

qVqqV

dq

dV

q

)()( 00

0

(3.10)

this is not only less accurate, but also more computationally costly (especially the larger

the molecules get) because for each coordinates two energies have to be evaluated at two

different points (i.e. the Shrödinger equation solved twice).

numerical frequencies (or more precisely the force constants) are calculated either by

numerical differentiation of the analytical gradients, or in the worst case scenario, by

numerical differentiation of numerical gradients (which is equivalent to calculating finite

difference second derivatives from the energies).

2

000

2

2 )(2)()(

0

q

qVqqVqqV

dq

Vd

q

(3.11)

Obviously, this is very slow and very inaccurate.

Fortunately, most methods, even the very high level ones nowadays have implemented at least

analytical gradients.

3.5 Geometry Optimizations in Gaussian

Geometry optimizations are done by using the keyword Opt in the route section of the Gaussian

input file. The molecule specification for a geometry optimization can be given in any format

desired: Cartesian coordinates, Z-matrix, mixed coordinates. By default the optimization will be

done in redundant internal coordinates, no matter what input format you use. We will discuss

different options and tricks that can be done with the redundant internal coordinates below.

The basic optimization input looks like this:

%chk=formaldehyde.chk

# HF/6-31G(d) Opt Test

Formaldehyde Optimization

0 1

C 0.0330000000 -0.0000000000 0.0000000000

O -1.1870000000 -0.0000000000 0.0000000000

H 0.5770000000 0.9430000000 0.0000000000

H 0.5770000000 -0.9430000000 0.0000000000

Remember: if you generate your input using Gabedit, get rid of keywords that request full printing

of the basis set and orbital parameters, i.e. Gfinput Pop=Full Density IOP(6/7=3).

We'll now look at the output from the formaldehyde optimization. The actual optimization starts

like this:

8

GradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGrad

Berny optimization.

Initialization pass.

----------------------------

! Initial Parameters !

! (Angstroms and Degrees) !

-------------------------- -----------------------

! Name Definition Value Derivative Info. !

----------------------------------------------------------------------------

! R1 R(1,2) 1.22 estimate D2E/DX2 !

! R2 R(1,3) 1.0887 estimate D2E/DX2 !

! R3 R(1,4) 1.0887 estimate D2E/DX2 !

! A1 A(2,1,3) 119.9799 estimate D2E/DX2 !

! A2 A(2,1,4) 119.9799 estimate D2E/DX2 !

! A3 A(3,1,4) 120.0402 estimate D2E/DX2 !

! D1 D(2,1,4,3) 180.0 estimate D2E/DX2 !

----------------------------------------------------------------------------

Trust Radius=3.00D-01 FncErr=1.00D-07 GrdErr=1.00D-07

Number of steps in this run= 20 maximum allowed number of steps= 100.

GradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGrad

This is the list of (redundant) internal coordinates: bond lengths - R, angles - A and dihedrals - D

that will be optimized. For example R1 = R(1,2) is the length of the bond between atoms 1

and 2, D(2,1,4,3) is the dihedral (torsion) angle 2-1-4-3.

Note that these coordinates are assigned automatically. We will discuss below how to modify

them.

After each step of the optimization, the following is printed (with less important parts omitted):

GradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGrad

Berny optimization.

… Search for a local minimum.

Step number 2 out of a maximum of 20

All quantities printed in internal units (Hartrees-Bohrs-Radians)

… Variable Old X -DE/DX Delta X Delta X Delta X New X

(Linear) (Quad) (Total)

R1 2.24220 -0.00194 -0.00511 0.00085 -0.00426 2.23794

… A3 2.04627 -0.00367 -0.00394 -0.02106 -0.02500 2.02126

D1 3.14159 0.00000 0.00000 0.00000 0.00000 3.14159

Item Value Threshold Converged?

Maximum Force 0.003670 0.000450 NO

RMS Force 0.002472 0.000300 NO

Maximum Displacement 0.014472 0.001800 NO

RMS Displacement 0.009857 0.001200 NO

Predicted change in Energy=-1.068230D-04

GradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGrad

The meaning of this output should be fairly obvious. Important is the table:

9

Item Value Threshold Converged?

Maximum Force 0.003670 0.000450 NO

RMS Force 0.002472 0.000300 NO

Maximum Displacement 0.014472 0.001800 NO

RMS Displacement 0.009857 0.001200 NO

which tells you how the optimization is progressing. The items on the left are the convergence

criteria, the numbers under Threshold are the limits for each criterion: if the actual value is less

than the threshold, the criterion is satisfied. If all are satisfied the geometry is considered

optimized.

Note that energy is not an optimization criterion. However, after each step is taken, a single point

energy calculation follows at the new point on the potential energy surface, producing the normal

output for such a calculation.

SCF Done: E(RHF) = -113.866330648 A.U. after 9 cycles

This particular optimization converged in 3 steps:

Step number 3 out of a maximum of 20

…. Item Value Threshold Converged?

Maximum Force 0.000332 0.000450 YES

RMS Force 0.000203 0.000300 YES

Maximum Displacement 0.001223 0.001800 YES

RMS Displacement 0.001014 0.001200 YES

Predicted change in Energy=-6.303701D-07

Optimization completed.

The final optimized structure appears immediately after the final convergence tests:

-- Stationary point found.

-------------------------

! Optimized Parameters !

! (Angstroms and Degrees) !

-------------------------- ----------------------

! Name Definition Value Derivative Info. !

----------------------------------------------------------------------------

! R1 R(1,2) 1.1843 -DE/DX = 0.0003 !

! R2 R(1,3) 1.0915 -DE/DX = 0.0001 !

! R3 R(1,4) 1.0915 -DE/DX = 0.0001 !

! A1 A(2,1,3) 122.0951 -DE/DX = 0.0002 !

! A2 A(2,1,4) 122.0951 -DE/DX = 0.0002 !

! A3 A(3,1,4) 115.8099 -DE/DX = -0.0003 !

! D1 D(2,1,4,3) 180.0 -DE/DX = 0.0 !

----------------------------------------------------------------------------

GradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGrad

10

When the optimization converges, it knows that the current structure is the final one, and

accordingly ends the calculation at that point. Therefore, the energy for the optimized structure is

found in the single point energy computation for the previous step in other words, it appears before

the successful convergence test in the output.

SCF Done: E(RHF) = -113.866330648 A.U. after 9 cycles

It also appears in the archive entry at the end of the output file: 1\1\ UNIVERSITY OF WYOMING, CHEMISTRY-BORN\FOpt\RHF\6-31G(d)\C1H2O1\JK

UBELKA\05-Sep-2012\0\\# HF/6-31G(d) Opt Test\\Formaldehyde Optimizatio

n\\0,1\C,0.0061089195,0.,0.\O,-1.1781605463,0.,0.\H,0.5860258134,0.924

6432963,0.\H,0.5860258134,-0.9246432963,0.\\Version=EM64L-G09RevA.02\S

tate=1-A1\HF=-113.8663306\RMSD=5.538e-09\RMSF=1.508e-04\Dipole=1.04885

91,0.,0.\Quadrupole=-0.2270643,0.1031481,0.1239162,0.,0.,0.\PG=C02V [C

2(C1O1),SGV(H2)]\\@

3.6. Following optimizations in Gabedit

Using Gabedit you can examine the progress of your optimization run.

Click on the Display Geometry/Orbitals/Density/Vibration icon to open the window, then

right click and in the menu select Animation (near the bottom) and several geometries

(Convergence/IRC)

In the new window (called Multiple geometries), select File/Read/Read a Gaussian output file.

Load you file and you get something like this:

11

Using mouse you can step through the optimization steps, read energies, forces and displacements

and you can also play the whole optimization as a movie.

3.7. Multi-step (compound) jobs

Often, molecular optimization is only the first step in modeling other molecular properties of

interest. Suppose we wish to optimize the molecule and calculate and plot molecular orbitals for

this optimized structure. We already discussed that it is a bad thing to have all the orbital printing

keywords: GFinput Pop=Full Density IOp(7/6=3) in optimization jobs, because the

orbital parameters get printed in the output file at every step !

Instead, we can run the optimization job first and save the checkpoint file which contains all the

information from that calculation, including the optimized structure. %chk=optimization.chk

# HF/6-31G(d) Opt Test

Optimization to be followed by SP calculation

0 1

molecule specification

In the second job we may simply read the geometry from the checkpoint file and use it in the single

point energy calculation that will output all the orbital parameters.

The line which specifies the name of the checkpoint file must be in the input (otherwise Gaussian

would not know where to read the geometry from):

%chk=optimization.chk

The keywords in the route section are either Geom=Check or Geom=AllCheck. Both these

command will read the final (i.e. optimized) structure from the checkpoint file. The difference is

that Geom=Check reads only the geometry, and we have to specify the title and spin and

multiplicity for the subsequent job:

%chk=optimization.chk

# HF/6-31G(d) GFinput Pop=Full Density Iop(6/7=3) Geom=Check Guess=Read

Test

SP calculation for optimized structure

0 1

while Geom=AllCheck will take everything from the checkpoint file, including the title. All

that needs to be in the input file is the checkpoint file and the route section

%chk=optimization.chk

# HF/6-31G(d) GFinput Pop=Full Density Iop(6/7=3) Geom=AllCheck

Guess=Read Test

Of course, all input files are terminated by a blank line. Never forget that !

12

Note that Guess=Read is also included in the route of the second job - that is a good rule whose

significance will become apparent later.

You can also use %NoSave in the second job (right under the %chk) which will delete the

checkpoint file after the completion of the last job.

Instead of writing two input files, one for each step of the job, we can create a single input file for

both jobs. Gaussian allows to combine any number of jobs in the single input file.

The input for each successive job is separated from that of the preceding job step by a line of the

form:

--Link1--

For the above example, we would have an input file:

%chk=optimization.chk

# HF/6-31G(d) Opt Test

Optimization to be followed by SP calculation

0 1

molecule specification

--Link1--

%chk=optimization.chk

%NoSave

# HF/6-31G(d) GFinput Pop=Full Density Iop(6/7=3) Geom=Check Guess=Read

Test

SP calculation for optimized structure

0 1

or %chk=optimization.chk

%NoSave

# HF/6-31G(d) Opt Test

Optimization to be followed by SP calculation

0 1

molecule specification

--Link1--

%chk=optimization.chk

# HF/6-31G(d) GFinput Pop=Full Density Iop(6/7=3) Geom=AllCheck

Guess=Read Test

This way you can run any number of consecutive jobs from a single input file. Note that the jobs

do not have to be related: you can link absolutely any jobs.

Since there is one input file, there will also be one output file with the output from the second job

right after the output from the first one.

… output of the first job…

13

Normal termination of Gaussian 09 at Thu Sep 6 15:41:38 2012.

Initial command:

/gaussian/g09/l1.exe /gaussian/scratch/Gau-28338.inp -scrdir=/gaussian/scratch/

Entering Link 1 = /gaussian/g09/l1.exe PID= 28340.

Copyright (c) 1988,1990,1992,1993,1995,1998,2003,2009, Gaussian, Inc.

All Rights Reserved.

… output of the second job…

3.8. Modifying geometry optimizations

The Opt keyword has many different options and there are other keywords that can be used to

modify optimization jobs. The full list of options can be found, where else, on Gaussian manual

web pages. We will discuss the options related to:

coordinate systems

modifying coordinates

constraints

convergence criteria

symmetry

Choice of coordinate systems for optimization and defining constraints

1. Redundant internal coordinates

Keyword Opt by default performs the optimization in redundant internal coordinates

(Opt=Redundant is the same thing, but the Redundant is really redundant) and this is

what you will use in most cases. The geometry can be in any format (Cartesian, Z-matrix,

mixed)

2. Internal coordinates

Optimization in internal coordinates is called using Opt=Z-matrix. The input geometry

must be in a Z-matrix format.

3. Cartesian coordinates

Optimization in Cartesian coordinates can be done using Opt=Cart. The input geometry can

be in any format.

Modifying coordinates

1. Redundant Internal coordinates

The redundant internal coordinates are assigned automatically. That means that any particular

coordinate (e.g. a bond length) may or may not be used as a coordinate in the optimization. In older

versions of Gaussian it was possible to define, select and modify values of particular coordinates

using ModRedundant option, but for some reason that seems to no longer be supported. However,

the ModRedundant option can still be used to define constraints (see below).

If you really so desire, you do have the option to define the coordinates yourself, by using

Geom=SkipAll, Geom=SkipAng or Geom=SkipDihedral keywords. The first one requires

manual definition of all coordinates, as it skips the automatic definition of anything. The second

14

suppresses defining any angles (including dihedrals), and the last the dihedrals only. They have to

be specified using ModRedundant option. My advice: don’t even try it.

2. Internal coordinates

The construction of Z-matrices was explained above, along with the use of variables and

constants. The coordinates that you define as variables will have the specified starting values

and will be optimized and displayed. In this peroxide example:

#RHF/6-31G(d) Opt=Z-matrix Test

H2O2 optimization

0 1 . O1 Hl O1 B1 O2 O1 B2 Hl A1 H2 O2 B1 O1 A1 H1 T1

B1=0.9

B2=1.4

A1=105.

T1=120.

the O-H, O-O bond lengths, O-O-H angle and H-O-O-H torsions are defined as variables with the

values assigned (0.9Å, 1.4 Å, 105.0º and 120.0º respectively). These parameters will be optimized

and their optimum values displayed.

Constrained optimizations

Often we need to optimize only certain geometry parameters, while holding others fixed. This can

be done in Redundant internal coordinates or internal coordinates (Z-matrix). Cartesian coordinate

optimization does not allow any constraints (i.e. it is always a full optimization).

1. Redundant Coordinates

The ModRedundant option can also be used for constraining (freezing) specific coordinates

during optimizations. To fix or freeze the particular coordinate, F is added after its definition. In

the following example of the formaldehyde the OCH angles are fixed:

# HF/6-31G(d) Opt=ModRedundant Test

Formaldehyde constrained optimization

0 1

C 0.33 0.0 0.0

O -1.187 0.0 0.0

H 0.577 0.943 0.0

H 0.577 -0.943 0.0

2 1 3 F

2 1 4 F

15

The output will show these two as “Frozen”:

… GradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGrad

Berny optimization.

Initialization pass.

----------------------------

! Initial Parameters !

! (Angstroms and Degrees) !

-------------------------- --------------------------

! Name Definition Value Derivative Info. !

--------------------------------------------------------------------------------

! R1 R(1,2) 1.517 estimate D2E/DX2 !

! R2 R(1,3) 0.9748 estimate D2E/DX2 !

! R3 R(1,4) 0.9748 estimate D2E/DX2 !

! A1 A(2,1,3) 104.6777 Frozen !

! A2 A(2,1,4) 104.6777 Frozen !

! A3 A(3,1,4) 150.6445 estimate D2E/DX2 !

! D1 D(2,1,4,3) 180.0 estimate D2E/DX2 !

--------------------------------------------------------------------------------

and when the optimization is complete, they will have their initial values, while the other

coordinates change:

… Optimization completed.

-- Stationary point found.

----------------------------

! Optimized Parameters !

! (Angstroms and Degrees) !

-------------------------- --------------------------

! Name Definition Value Derivative Info. !

--------------------------------------------------------------------------------

! R1 R(1,2) 1.2124 -DE/DX = -0.0001 !

! R2 R(1,3) 1.0843 -DE/DX = 0.0 !

! R3 R(1,4) 1.0843 -DE/DX = 0.0 !

! A1 A(2,1,3) 104.6777 -DE/DX = 0.0375 !

! A2 A(2,1,4) 104.6777 -DE/DX = 0.0375 !

! A3 A(3,1,4) 150.6446 -DE/DX = -0.0751 !

! D1 D(2,1,4,3) 180.0 -DE/DX = 0.0 !

--------------------------------------------------------------------------------

GradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGrad

This way you can freeze bond lengths, angles and torsions. Individual atoms can also be

“frozen” using only one atom number with the F:

1 F

2 F

This will fix the positions of atoms 1 and 2 and optimize everything around them. This can be

useful, though it is not as straightforward as fixing particular bonds and angles and dihedrals, so

you have to be careful what is actually constrained and what is optimized.

Alternative ways to freezing atoms are

16

the freeze code for the particular atom in the first column after the atomic symbols in

the Cartesian input set to -1

using ReadFreeze, which will define atoms to be frozen. For example the following

input:

# HF/6-31G(d) Opt=ReadFreeze Test

Formaldehyde Optimization

0 1

C 0.0330000000 -0.0000000000 0.0000000000

O -1.1870000000 -0.0000000000 0.0000000000

H 0.5770000000 0.9430000000 0.0000000000

H 0.5770000000 -0.9430000000 0.0000000000

atoms=1-4 notatoms=H

will freeze the hydrogens and optimize the rest:

Optimization completed.

-- Stationary point found.

----------------------------

! Optimized Parameters !

! (Angstroms and Degrees) !

-------------------------- --------------------

! Name Definition Value Derivative Info.

--------------------------------------------------------------------------

! X3 R(3,-1) 0.577 -DE/DX = 0.0

! Y3 R(3,-2) 0.943 -DE/DX = 0.0

! Z3 R(3,-3) 0.0 -DE/DX = 0.0

! X4 R(4,-1) 0.577 -DE/DX = 0.0

! Y4 R(4,-2) -0.943 -DE/DX = 0.0

! Z4 R(4,-3) 0.0 -DE/DX = 0.0

! R1 R(1,2) 1.1849 -DE/DX = -0.0001

! R2 R(1,3) 1.1011 -DE/DX = 0.0

! R3 R(1,4) 1.1011 -DE/DX = 0.0

! A1 A(2,1,3) 121.0819 -DE/DX = 0.0

! A2 A(2,1,4) 121.0819 -DE/DX = 0.0

! A3 A(3,1,4) 117.8361 -DE/DX = 0.0

! D1 D(2,1,4,3) 180.0 -DE/DX = 0.0

--------------------------------------------------------------------------

Note that

the hydrogens have not moved

the optimization coordinates are a mix of Cartesian (for the two hydrogens)

and internals

As always, consult the Gaussian manual for more information.

2. Internal coordinates

Constraints can be specified by

typing the value directly into the Z-matrix molecule specification, as in

17

#RHF/6-31G(d) Opt=Z-matrix Test

O3 optimization

0 1 . O1

Hl O1 B1 O2 O1 B2 Hl 105.

H2 O2 B1 O1 105. H1 120.0

B1=0.9

B2=1.4

by having a separate “constants” after a blank line below the variables, as in

#RHF/6-31G(d) Opt=Z-matrix Test

O3 optimization

0 1 .

O1

Hl O1 B1 O2 O1 B2 Hl A1 H2 O2 B1 O1 A1 H1 T1

B1=0.9

B2=1.4

A1=105.

T1=120.

Both of these inputs will optimize the bond lengths but keep the valence angle A1 and dihedral

T1 fixed:

Optimization completed.

-- Stationary point found.

----------------------------

! Optimized Parameters !

! (Angstroms and Degrees) !

---------------------- ----------------------

! Name Value Derivative information (Atomic Units) !

------------------------------------------------------------------------

! B1 0.9491 -DE/DX = 0.0 !

! B2 1.3877 -DE/DX = 0.0 !

! A1 105.0 -DE/DX = -0.029 !

! T1 120.0 -DE/DX = -0.0018 !

------------------------------------------------------------------------

Convergence criteria

Most often default convergence criteria are used, which require no options. The criteria can be

found under Threshold in the optimization output.

18

Opt=Tight is used when it is necessary to optimize the molecule to “higher standards”, i.e.

lower residual forces and energy changes (displacements). The downside is that it will take more

steps to satisfy the tighter criteria and the optimization will take longer.

Opt=VeryTight uses even more strict criteria, if even the Tight optimization is not good

enough.

Opt=Loose on the other hand can be used for quick and dirty optimizations.

Symmetry

Symmetry is an important element of molecular structures. Gaussian checks for the symmetry of

the input structure and displays the symmetry group in the output. This is what we have for our

formaldehyde:

Framework group C2V[C2(CO),SGV(H2)]

Deg. of freedom 3

Full point group C2V NOp 4

Largest Abelian subgroup C2V NOp 4

Largest concise Abelian subgroup C2 NOp 2

This says that formaldehyde belong to C2v point group, which is correct. If the symmetry point

group is recognized by Gaussian, it will be kept during the optimization. By default symmetry is

used unless it is turned off by keyword NoSymm.

The problem arises if our initial structure is slightly off and Gaussian does not recognize the correct

point group. For example, if the coordinates of one of the formaldehyde atoms is changed by

0.0001 Angstroms, it is assigned to the Cs group instead:

Framework group CS[SG(CO),X(H2)]

Deg. of freedom 4

Full point group CS NOp 2

Largest Abelian subgroup CS NOp 2

Largest concise Abelian subgroup CS NOp 2

To have Gaussian recognize the proper symmetry:

use Symm=Loose in the route section. This will try to determine the symmetry group with

less stringent cutoffs and therefore is more likely to assign the proper point group even to

less accurate geometry.

if this fails, it is necessary to force the structure to the right symmetry. Because the correct

structure is symmetric, optimization should find a symmetric structure, but Tight or even

VeryTight optimization may be required.

Use the optimized structure with Symm=Loose in the subsequent job (or a multi-step job

as described above) to make sure the proper symmetry group is assigned.

use Z-matrix with proper constraints corresponding to the given symmetry group.

Constructing Z-matrices is a bit of a pain, but this will always work.

19

3.5. Handling difficult optimization cases

There are some systems for which the default optimization procedure may not succeed on its own.

If that happens, there are several strategies to make your optimizations converge:

1. Calculate force constants (frequencies). A common problem with many difficult cases is that

the Hessian (the matrix of force constants, a.k.a. second derivatives of the energy) estimated

by the optimization procedure differ substantially from the actual values. By default, a

geometry optimization starts with an initial guess for the second derivative (Hessian) matrix

derived from a simple molecular mechanics valence force field.

The approximate matrix is improved at each step of the optimization using the computed first

derivatives. When this initial guess is poor, you need a more sophisticated-albeit more

expensive-means of generating the force constants. Gaussian provides a variety of alternate

ways of generating them. Here are some of the most useful associated keywords (as always

you can consult the Gaussian manual for a full description of their use:

Opt=ReadFC read in the initial force constants from the checkpoint file created by a

frequency calculation (see below), which can be run at a lower level of

theory or using a smaller basis set. This option can help to start an

optimization off in the right direction.

This option will also require that a %Chk=filename line precede the route section of the

input, specifying the name of the checkpoint file, as discussed in section 2.7 above.

Opt=CalcFC compute the force constants at the initial point using the same method and

basis set as for the optimization itself.

Including ReadFC is also useful whenever you already have performed a frequency

calculation at a lower level of theory. When you have a difficult case and you have no previous

frequency job, then CalcFC is a good first choice.

2. Increase a number of steps and restart Sometimes, an optimization will simply require more

steps than the default procedure allots to it. You can increase the maximum number of steps

with the MaxCycle option to the Opt keyword (it takes the number of steps as its argument).

If you have saved the checkpoint file, it is possible to restart a failed optimization, using the

Opt=Restart keyword. Restarting calculations from where they crashed, rather than

starting over from scratch, is one of the (many) reasons why it is a good practice to always

save the checkpoint file.

3. Start from a better initial structure If an optimization runs out of steps, do not blindly assume

that increasing the number of steps will fix the problem. Examine the output and determine

whether the optimization was making progress or not. The following script

egrep 'SCF Don|Step number|Maximum Force|RMS Force|Maximum

Displacement|RMS Displacement' filename.log

will grab the important information from the optimization output filename.log and display it

on the screen:

20

Alternately, you can get this information using Gabedit (along with a color movie of your

molecular structure changing during optimization!) This particular optimization was very close

to a minimum at step two, but then it moved away from it again in subsequent steps. Merely

increasing the number of steps will not fix the problem. A better approach is to start a new

optimization, beginning with the structure corresponding to step 2 and including the CalcFC

option in the route section.

You can retrieve an intermediate structure from the output log file manually. Alternatively,

you may use the Geom=(Check,Step=n) keyword to retrieve the structure corresponding

to step n from a checkpoint file.

Only if it looks that the optimization is converging, but slowly, increase number of steps

(option 2)

4. Try to optimize the structure at a lower level of theory first. For example, if your starting

structure is really bad, it may be better to roughly optimize it using for example molecular

mechanics or a semiempirical method. This pre-optimized structure, eventually with computed

force constants, can then be used as a starting structure for a higher level optimization.

Sometimes your optimization job will crash with the following message in your output file:

21

… Iteration 97 RMS(Cart)= 0.00264867 RMS(Int)= 1.13696504 Iteration 98 RMS(Cart)= 0.00268035 RMS(Int)= 1.13585384

Iteration 99 RMS(Cart)= 0.00271288 RMS(Int)= 1.13474508

Iteration100 RMS(Cart)= 0.00274629 RMS(Int)= 1.13363899

New curvilinear step not converged.

RedCar failed in NewRed.

This can happen either before the optimizations even begins or during any step. It usually means

that something is wrong with the geometry.

First inspect the structure and make sure it is reasonable. Fix it if necessary and start over.

If there is nothing wrong with the structure, it may be the definition of the redundant internal

coordinates. Sometimes simply restarting the optimization from the last successful step or

changing the orientation (rotating) the molecule can solve the problem. If not, experiment with the

definitions and modifications of the redundant coordinates or use different coordinate system.