Lecture 9: Introduction To Computational Chemistry Introduction To Computational Chemistry
Lecture 9: Introduction To Computational Chemistry Introduction To Computational Chemistry
I can't answer all of these questions here, but the primary Wikipedia
purpose of computational chemistry is to connect
experimental results with a theoretical potential energy Note that at the bottom of the well, the PES is described well
surface so we can understand nature. One can ask static by a harmonic oscillator--a quadratic function. This is an
questions like "What is the equilibrium geometry for this important approximation that is made in many calculations.
molecule?" or dynamic ones like "What is the mechanism of
this reaction?". But, wait! Where are the electrons? Why aren't we giving
them coordinates? It is a basic assumption of standard
What exactly is a potential energy surface (PES)? Consider computational techniques that because the nuclei are much
dihydrogen: heavier than the electrons, the nuclei are essentially "frozen"
r from the point of view of the electrons. This is the Born-
H H Oppenheimer approximation. From quantum mechanics, we
know that the electrons are described by wave functions,
How many variables do I need to describe the geometry of rather than specific position and momentum coordinates as in
dihydrogen? Six. In Cartesian coordinates, I could say that classical mechanics.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
The Potential Energy Surface (PES) solid = function; dashed = derivative
Now, a more complicated molecule will necessarily require more
coordinates. For example, you can think of water as needing 6
two O-H bond lengths and the H-O-H angle:
4
H
2
r2
O H
r1 - 1.5 - 1.0 - 0.5 0.5 1.0 1.5
-2
If you want to characterize the entire PES, and you want to do
10 points per coordinate, that would make a thousand points
-4
total. Since evaluating the energy as a function of geometry
requires minutes if not hours per point, this is clearly going to be
-6
impractical for all but the exceptionally patient (and we're not).
If we want to know whether a particular stationary point is a
To summarize, the PES is a multidimensional function. It takes local minimum or maximum, we compute the second derivative,
the molecular geometry as input, and gives the energy as which is positive for minima, 0 for asymptotes, and negative for
output. It has a lot of dimensions and is very, very complicated. maxima. For multidimensional functions, the analog of the
second derivative is called the Hessian:
Fortunately, transition state theory tells us that we only need
to characterize a few stationary points on the PES, rather than
the entire thing. A stationary point is anywhere the gradient is
zero. For dihydrogen:
E E E
0
x1 x2 y1
This is the multidimensional analog of the derivative. For
example, consider this function:
y x5 5 x 1
In chemistry, we are particularly interested in energy minima.
From high school calculus, you know that the derivative is: A stationary point is a local minimum if the Hessian is postive-
dy definite there. To evaluate this, one transforms from Cartesian
5x4 5 to normal coordinates, which amounts to diagonalizing the
dx Hessian or "performing a frequency analysis." The "lack of
The function has a local maximum and a local minimum, which any imaginary frequencies" means that the matrix is positive
occur when dy/dx is zero: definite.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
The Potential Energy Surface (PES) The minimum energy path, reaction coordinate, or intrinsic
Can one have a stationary point that is neither a local maximum reaction coordinate connect the starting materials and
nor a local minimum? Certainly: saddle points. Consider y=x3: products. Thus, to understand a reaction, we will need to
2
locate a minimum of three stationary points: one each for the
starting material, transition state, and product.
1
energy
transition states
- 1.0 - 0.5
0
0.5 1.0 reactants
products
-1 C H + Cl -10
R C H + HCl
H
-2
-21
R C H + HCl
starting materials and products correspond to local minima R
(stationary points with zero imaginary frequencies) while -31
R C R + HCl
transition states correspond to first-order saddle points R
(stationary points with exactly one imaginary frequency). "reaction coordinate"
The energy difference between the reactant and transition
state will tell us about the rate of the reaction; the difference
between the reactant and product will tell us about how
exothermic the reaction is. We can also examine the geometry
of the molecules at all the stationary points, and then draw
some conclusions about reactivity, selectivity, or other trends.
1.4
1.2
1.0
0.8
Clearly, we want to be taking as few steps as possible. For a
0.6 harmonic oscillator, k is the derivative of the gradient:
Rg d 2E dE
Re Rg 2
0.4
Req 0.2 dR Rg dR Rg
R
- 1.0 - 0.5 0.0 0.5 1.0 This works great if we are near a quadratic portion of the PES.
In reality, many PESs have very flat regions where this kind of
The energy E of this harmonic oscillator potential is given by:
Newton-Raphson step will be too large. (An excellent
1
E k ( R Req )2 animation of how this works can be found on Wikipedia at
2 http://en.wikipedia.org/wiki/File:NewtonIteration_Ani.gif.) Thus,
most programs will scale back quadratic steps when their size
Taking the derivative, we have: exceeds some pre-determined threshold.
dE
k ( R Req ) Note that this method requires the Hessian, which is clearly
dR expensive to calculate. In many cases, one can use
Clearly, if R is not the equilibrium value, Req, then the gradient approximate methods to make a good guess at what the
is non-zero, and we are not at a stationary point. But we can Hessian looks like, and then update the guess on every
rearrange this equation to see how to get there: iteration.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Energy Minimization Gaussian plots the energy and gradient of each geometry
In practice, neither of these methods is satisfactory and various optimization step:
improvements have been made. In Gaussian 09, the Berny
algorithim using GEDIIS in internally redundant coordinates is
used by default. For details, see http://www.gaussian.com/
g_tech/g_ur/k_opt.htm. Internally redundant coordinates means
that instead of using the Cartesian coordinate system, which
has certain mathematical pathologies, a more natural set of
coordinates involving bond lengths, bond angles, and dihedral
angles is used. This has been shown to be faster for many
organic molecules.
Let's take a look at how this works in real life. My co-worker Joe
Wzorek and I are interested in the conformations of macrocycles.
One structure we need the equilibrium geometry and energy of
is a conformer of an intermediate used by Professor Shair along
his route towards longithorone A:
(2) The energy drops quickly at first and then slowly converges.
Seeing the energy spike in the middle is common;
sometimes the optimizer will get off track. By its nature,
optimization is a chaotic phenomenon, and can show high
sensitivity to initial conditions, oscillatory behavior, or other
pathologies.
(3) The gradient usually tracks with the energy, but not always.
When it reaches a certain threshold, the job is finished.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Energy Minimization atoms, and each one has a particular gradient associated
By the way, one of the nicest programs for rendering structures, with it, we need the RMS gradient. Remember, gradient is the
as shown on the previous slide is CYLView, is available from negative of force. Displacement is something that tells you how
Professor Legault (Sherbrooke) at www.cylview.org. much the atoms moved between the last iteration and this one.
Occasionally, the displacement will not converge, but the forces
We can learn more by looking at the raw output file (.out). The will go to zero. In that case, the optimization will automatically
fundamental file format in computational chemistry is text, so it is terminate.
useful to learn some techniques for handling large amounts of [ekwan@iliadaccess03 output]$ grep -B 7 Stationary
text. Virtually all scientific computing is done in the magical land longithorone_OPLS_low_4.out
of Linux, so we will start there: Item Value Threshold Converged?
Maximum Force 0.000008 0.000450 YES
[ekwan@iliadaccess03 output]$ grep -A 3 "Maximum Force"
RMS Force 0.000001 0.000300 YES
longithorone_OPLS_low_4.out | more
Maximum Displacement 0.001556 0.001800 YES
RMS Displacement 0.000316 0.001200 YES
Maximum Force 0.037142 0.000450 NO
Predicted change in Energy=-5.392921D-09
RMS Force 0.004970 0.000300 NO
Optimization completed.
Maximum Displacement 0.948905 0.001800 NO
-- Stationary point found.
RMS Displacement 0.234625 0.001200 NO
-- In this case, everything converged after 64 iterations. What is
Maximum Force 0.016448 0.000450 NO the energy? At each step, the output file contains the energy:
RMS Force 0.002426 0.000300 NO [ekwan@iliadaccess03 output]$ grep "SCF Done"
Maximum Displacement 1.085268 0.001800 NO longithorone_OPLS_low_4.out
RMS Displacement 0.284053 0.001200 NO SCF Done: E(RB3LYP) = -1532.21514319 A.U. after 12 cycles
... SCF Done: E(RB3LYP) = -1532.23006873 A.U. after 11 cycles
...
Here, I have issued a command to search for the words SCF Done: E(RB3LYP) = -1532.24125618 A.U. after 5 cycles
"Maximum Force" in the file longithorone_OPLS_low_4.out. SCF Done: E(RB3LYP) = -1532.24125618 A.U. after 1 cycles
Specifically, I want all the instances of that phrase, along with
the three lines after it. The "more" command tells it to give me Notice that the energy starts out high, and then decreases.
the output page by page (quite a few optimization steps were E(B3LYP) tells you that this a density functional method was
required, so there is a lot of output). used to get at the energy--more on this in a moment. The last
energy is the energy of the molecule in the geometry of this
The first column of numbers is the value of the parameter in the particular stationary point. Specifically, this is the electronic
current iteration; the second is the desired threshold value. As energy. Roughly speaking, this is the energy it takes to bring
you can see, the first two steps were quite far away from together all the atoms and electrons, which is why it looks like
equilibrium. a huge negative number. Every geometry step involves an
energy evaluation, which is itself an iterative process. As we
RMS means "root mean square," which is basically an average get closer and closer to equilibrium, the energy evaluation
that works on signed quantities. Because there are a lot of process speeds up and requires fewer cycles.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Of course, we need to verify this structure is a true local These corrections take into account the fact that, above absolute
minimum with a frequency analysis. (There is no way to know if zero, various vibrational and rotational energy levels get
it is the global minimum. However, there are methods I will populated, and therefore contribute to the energy. The very last
discuss shortly that can give one some confidence the global line represents the Gibbs free energy of this compound in this
minimum, or something near it, has in fact been found). geometry, at least as estimated by Gaussian using this particular
GaussView can display all the normal modes (Results... method.
Vibrations):
If there had been any imaginary frequencies, there would have
been a message like "1 imaginary frequency ignored." This
would mean a transition state.
Constrained Optimizations and Transition States
Because these are still stationary points, one might think that
the same optimization methods would apply. Unfortunately,
they seem to be much better at optimizing downwards towards
a ground state than upwards towards a transition state. As a
result, unless the starting structure is already very close to the
transition state stationary point, it will optimize away from it.
The fact that all the frequencies are positive numbers indicates
that this is a true local minimum. This is also reflected in the
thermochemical energy output:
[ekwan@iliadaccess03 output]$ grep -4 Gibbs
longithorone_OPLS_low_4.out
As it turned out in this case, the scan did reach a maximum, but
then the energy dropped considerably. This is a consequence
of the step size being too large--the perturbation between steps
was enough to cause the structure to "kink" into a much lower
energy conformation. This turned out to be of no consequence,
however, as a finer step size, followed by unconstrained
transition optimization eventually resulted in the transition state.
This time, the frequency analysis shows one negative frequency:
that of the forming bond: A more rigorous analysis would involve an intrinsic reaction
coordinate (IRC) scan, which would take the transition state
and follow the minimum energy path in both directions to check
that the observed transition state actually connects the desired
starting materials and products.
You may notice that I say "observed" as if this sort of thing were
experimental in nature. While this is not strictly speaking, from
a philosophical perspective, true, it is true in practice. As I often
say, like anything to do with computers, computational
chemistry obeys the rule "garbage in, garbage out." One has to
ask a meaningful question to get a meaningful result. Even
then, apparently logical computations (optimizations) will often
fail to converge, or may give non-sensical results. One must
always use chemical intuition to see if the results being found
actually make sense, and then rigorously follow up the
theoretical calculations with real experiments.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
r1 rOH ,eq
Molecular Mechanics 1
kOH k AB
2
E (3)
r r
2
Q: How are geometries turned into energies? 1 OH , eq
In organic chemistry, we have the functional group concept,
which says that a ketone in one molecule usually behaves a lot The term with the superscript (3) is the cubic force constant, or
like a ketone in another molecule. When this transferability "anharmonic" constant. Unfortunately, such a function would
concept is applied to computational chemistry, one has diverge to negative infinity at large separations r. Therefore, in
molecular mechanics (MM). practice, one needs to include a quartic term. The standard
organic force field MM3 uses such terms. One can also
MM is the cheapest of the computational methods and envision representing complex periodic behavior in torsional
provides reasonable geometries and energies for ground potentials by using higher order Fourier series.
states. However, it will not understand bonds that are stretched
from equilibrium, like in transition states or other "exotic" What is missing here? So far, we have only considered the
behaviors like attractive dispersion forces unless they have been bonded terms. However, real molecules also have all kinds of
explicitly programed in. In this way, MM methods are a lot like non-covalent interactions that must be represented by additional
the empirical NMR prediction methods used in ChemDraw. non-bonded terms.
Here is water again: Consider the hard sphere and Lennard-Jones potentials
H
(diagram taken from page 26 of Cramer):
r2
O H
r1
A molecular mechanic treatment of the energy of water would be
something like:
E kOH r1 rOH ,eq kOH r2 rOH ,eq k HOH HOH ,eq
2 2 2
So, for any guess , the ground state energy of the system E1
is no higher than W. This suggests we should try to vary , and
seek a form of it that minimizes W:
http://farside.ph.utexas.edu/teaching/qmech/lectures/node129.html
Translation:
The solid line is the bound state; the dashed line is the unbound
state. Exact solution Make a reasonable
unknown. guess,
Unfortunately, for anything more complicated, an analytical or
exact solution is not possible. One has to resort to making
guesses. Fortunately, our guesses are very good. Just how Compute the The real ground state energy
good are they? This is answered by the Variational Theorem. integral W. is below the value of the integral.
The Variational Theorem
GTOs are also "bad" chemically because they have no radial A new trend is the use of density fitting or resolution of
nodes. The solution to both these problems is to combine a the identity (RI) methods. These expand the basis set with
number of GTO primitives into a CGTO. some auxiliary basis set to speed up calculations.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
The Orbital Approximation and the Pauli Principle
A helium atom has two protons and two electrons:
1 r1 2 r2 3 r3 1 r2 2 r1 3 r3
r12 All I have done here is to make 1 a function of the coordinates
e- e- of electron 2 instead of electron 1 and the reverse for 2. So
what would satisfy the Pauli principle? The Slater
RA1 RA2 Determinant.
H
As you know, if you shoot some lithium atoms through a
RA magnetic field, some of them will curve to the left and some
The Hamiltonian now includes an electron-electron repulsion will curve to the right (whereas helium atoms won't curve):
term:
2r1 r22 2 2 1
r1 , r2 E r1 , r2 S N S N
2 2 R A1 R A 2 r12
Li
Nobody knows how to deal with this exactly, so one makes
the orbital approximation that the overall wavefunction is the This called spin because the lithium atoms behave like
product of a number of one-electron wavefunctions, or orbitals. clasically spinning charged spheres (even though they're not
The composite wavefunction is called a Hartree product: really spheres or spinning). For every spatial wavefunction,
we can put an or electron in it to make a spin-orbital.
r1 , r2 1 r1 2 r2 For example, putting an electron in orbital 1 gives:
For a lithium atom, you might think that you can just write a 1 (1) 1 (1) (1)
Hartree product like this:
The Slater determinant gives us a way to construct anti-
r1 , r2 , r3 1 r1 2 r2 3 r3 symmetric wavefunctions. For helium, we need to construct
one for two electrons:
However, you will find that if you use hydrogen-like orbitals for
the , you will find that the answer violates the variational 1 1 (1) (1) 2 (1) (1)
principle! That is, the variational energy of the wavefunction He
will actually be lower than the experimental wavefunction. 2 1 (2) (2) 2 (1) (1)
The problem is that this wavefunction violates the Pauli
1
exclusion Principle, which not only prevents two electrons
from having the same quantum numbers, but also requires
1 (1) (1)2 (1) (1) 2 (1) (1)1 (2) (2)
that the wavefunction be antisymmetric with respect to
2
electron interchange. If I interchange the indices in the trial Now, interchanging the electrons does result in an anti-
function for lithium above, I do not get the negative of the symmetric wavefunction. Note that every electron appears in
trial function: every spin orbital somewhere; the electrons are identical.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Electron Correlation - Processes which break bonds cannot be described well.
I already mentioned that electron correlation is essential to For example, pericylic reactions can involve a number of
non-covalent interactions like -stacking. The crosses in the stretched bonds with some diradical character. HF cannot
graph below show the potential energy curve for benzene predict the barrier heights of these correctly.
dimer:
- Other measures of energy differences like isomerization
energy (e.g., CO + HO radical vs. H radical + CO2) don't
come out right either.
Notice that HF thinks that the benzene dimer is not bound at bond lengths: to within 0.02 A
all! Clearly, this is wrong. Interestingly, some of the other bond angles: to within 2 degrees
methods there do account for some electron correlation, but vibrational frequencies: to within 10%
clearly don't do it quite correctly. For example, BLYP is a dipole moments: to within 0.3 D
common kind of density functional (to be discussed shortly) bond dissociation energies: 25-40 kcal/mol off
and accounts for some electron correlation, but still doesn't
understand the stacking interaction. Fancier methods are better. For coupled-cluster:
The neglect of electron correlation has other serious bond lengths: to within 0.004 A
consequences: bond angles: to within 0.03 degrees
vibrational frequencies: to within 2%
- Heats of formation are very inaccurate. For a bunch of dipole moments: to within 0.05 D
small molecules calculated at HF/aug-cc-pVQZ, a very bond dissociation energies: 1-2 kcal/mol off
large mean unsigned error of 62 kcal/mol was found!
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Post-HF Methods Hartree-Fock limit: HF with an infinite basis set
Q: How can we take electron correlation into account?
If we variationally minimize the Slater determinants resulting
There are many methods available for this, but in general, the from all these excitations and have an infinite basis set, then
more accurate the method, the more costly it is. The "scaling" we have reached an exact numerical solution for the non-
of the method tells you how much more time you need as you relativistic Schrdoinger equation--the configuration interaction
increase the number of basis functions N. One must also limit.
consider a "pre-factor" which tells you how much "up front" cost
is required. Of course, all these excitations are very costly. In CISD, we
just make single and double excitations. In CCSD, we are
Hartree-Fock ~ N4 trying to do the same thing, but in a different way. We apply
DFT (density functional theory) ~ N3 (but larger pre-factor an operator exp[T] to the HF wavefunction:
than HF)
eT HF
ˆ
MP2 (Moller-Plesset perturbation theory) ~ N5
CISD (configuration interaction singles and doubles) ~ N6
CCSD(T) (coupled cluster singles and doubles with Tˆ Tˆ1 Tˆ2 Tˆ3
perturbative estimates of triples) ~ N7
where the indices indicate the level of excitation the operator
The last one, CCSD(T), is the "gold standard" computational
represent. This has certain advantages, among them size
method, but is staggeringly expensive in CPU and memory
requirements. Just calculating the benzene dimer with CCSD(T) consistency. If you calculate the energy of A separately and B
separately, the sum should be about the same as calculating the
with it was a research-grade project worthy of a JACS article
energy of A and B together, but separated by quite a large
just five years ago!
distance. If that's true, the method is called "size consistent."
The idea behind the MP2, CISD, and CCSD(T) methods is
In MP2, we apply perturbation theory to correct the energy of
relatively simple to understand. The Hartree-Fock forms its
the Hartree-Fock wavefunction. Thus, the orbitals are the same,
guess from a single Slater determinant. If we want to improve
but the energies are different. (This means the optimized
the guess, we can include determinants involving "excited
geometries are different, too.) As organic chemists, we work
states":
with molecules containing dozens of heavy atoms, if not
hundreds. As such, we can only afford HF and MP2, and even
then MP2 is problematic for larger atoms.
CI A huge breakthrough in quantum chemistry arrive in the 1990s,
+ + many more
when density functional theory (DFT) became widely
available. Although it has a larger pre-factor than HF, its
scaling with N is considerably less than the other post-HF
methods, making it an attractive, practical method.
"single" "double"
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Density Functional Theory (DFT) In Thomas-Fermi DFT (1927), one tries to calculate the
Q: How can we take electron correlation into account in energy in a classical way. The attraction between the density
a practical way? and the nuclei is:
(This discussion is taken from Cramer, Chapter 8.) nuclei
Z
Ab initio methods like Hartree-Fock or MP2 are ways to arrive
Vne r r r r dr
k
k
k
at the wavefunction, which is itself a proxy for electron density
Electron-electron repulsions are given by:
(or other observables via the action of operators). In DFT, we
try to compute the electron density directly. The total number 1 r1 r2
2 r1 r2
of electrons N is conserved over all space: Vee dr1dr2
N r dr What about the potential energy? In this crude treatment, one
envisions an infinite number of electrons moving through an
Is the electron density enough information to reconstruct the infinite volume of space containing a uniformly distributed
information we want--the energies and wave functions? Yes! positive charge. This is the "uniform electron gas." Thomas
The Hamiltonian requires the positions and atomic numbers of and Fermi showed that:
the nuclei and the total number of electrons. Clearly, having
3
3 2 5/3 r dr
2/3
the density can give us the total number of electrons. Tueg
10
What about the nuclei? They are point positive charges, so the
electron density reaches local maxima at the nuclear positions. No two electrons can be in the same place, so one introduces a
So we can reconstruct the positions of the nuclei from the "hole function" to account for this:
maxima in electron density. Their atomic numbers can be
extracted from: electrons
1 1 r1 r2 1 r1 h r1 ; r2
r1 r2
dr1dr2
r1 r2
dr1dr2
rA i j rij 2 2
2 Z A rA
rA rA 0
LHS: exact quantum-mechanical interelectronic repulsion
RHS, first term: classical interelectronic repulsion
where rA is the position of an electron density maximum, bar RHS, second term: corrects the density with a hole function h
is the spherically averaged density, and Z is the atomic number
of nucleus A. The hole function for a multielectron system is not obvious and
must often be approximated. Not having correct hole functions
So we have shown that if we had the electron density, we would has serious consequences--electrons can interact with
(at least in principle) be able to write down the Schrodinger themselves! In HF, there is no self-interaction error, but
equation, solve it, and get the energies and wavefunctions. all DFT methods suffer from this to some extent. This is why
But how do we actually go about doing that? Specifically, many DFT methods are combined with some degree of HF
how does one turn the density into energy? exchange energy.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Density Functional Theory (DFT) So far, it looks like we have to guess a density, convert it into a
The fact that electrons are indistinguishable and must be be candidate Hamiltonian and wavefunction, evaluate the energy
antisymmetric with respect to interchange leads to a purely by solving the Schrodinger equation, and keep guessing until
quantum mechanical effect known as exchange and has no the variational energy is minimized. But this is obviously rather
classical analog. The presence of exchange keeps electrons unsatisfactory! How do we go about finding better densities?
farther apart than they would be predicted to be classically and How do we convert these densities into energies without solving
is responsible for steric repulsion. the Schrodinger equation? Remember, the whole point of using
the electron density is to avoid solving the Schrodinger equation
As it turns out, the contribution of exchange to the classical in the first place!
interaction energy is much larger (1-2 orders of magnitude) than
the electron correlation energy. Slater proposed that the The answer is the Kohn-Sham self-consistent field method,
"exchange hole" can be approximated by a sphere of constant which is analogous to the SCF method used in Hartree-Fock.
potential with a radius depending on the magnitude of the The idea is to consider a fictitious system of non-interacting
density at that position (Cramer, pg 252): electrons that have the same electron density as the real system
1/3
where the electrons do interact. Then, we divide the energy
9 3 functional into different components:
Ex r dr
4/3
accuracy,
The local density approximation (LDA) assumes that the
exchange-correlation functional only depends on the electron GGA (BLYP, PBE, BP86...)
cost
density at the point where the functional is being evaluated.
Systems involving unpaired electrons use the local spin LSDA (useful for solid state)
density approximation (LSDA). The functionals developed by
Vosko, Wilk, and Nusair (VWN) are an example of this. The There are numerous benchmarks which show that the accuracy
details are quite abtruse--it's not clear where all the terms in goes up as you go up the ladder (with a lot of nuances). For
the expression come from, physically speaking. They were this course, we will just use B3LYP, which is known to work
obtained by empirically fitting parameters to some known well for many systems. However, it does not describe medium-
results. In this sense, DFT methods can be considered truly to long-range electron correlation very well like that involved in
semi-empirical. -stacking. Functionals like DFT-D (Grimme) and M06-2X
(Truhlar) have been specifically parametrized to work well for
Of course, in a real system, the electron density is not uniform. these cases.
The first-order correction to this is to account for not only the
electron density at a particular point, but also the rate at which DFT scales as N3, whereas HF scales as N4, where N is the
the density is changing at that point--the gradient. This leads to numebr of basis functions, so there is a clear advantage for
the generalized gradient approximation (GGA). One popular larger systems. However, note that the pre-factor for DFT is
kind of GGA DFT is called PW91. larger, particularly if HF exchange is needed.
Going futher, we can have meta-GGA methods which include Further Information: Nick Mosey has prepared a detailed set of
higher-order terms like the Laplacian 2. course notes on DFT which are available on the web here:
www.chem.queensu.ca/people/faculty/Mosey/chem938.htm.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Jumping the Gun To get started, you will need several things:
Clearly, computational chemistry is immensely complicated,
and you are not going to learn it all from me in an hour. I don't (a) GaussView 5.0 installed on your computer (freely available
really even understand a lot of it. But don't feel bad--there is for PC and Mac from the chemistry library)
absolutely no need to understand everything before getting (b) a secure FTP client (Mac: Fetch; PC: WinSCP)
started, just as you don't need to know exactly how a car's (c) a secure telnet client that supports keychain authorization
engine works before driving. Professor Jacobsen reminds me (PC: PuTTY; Mac: terminal)
on occasion that as organic chemists, our talent is for making (d) an account on the Odyssey Computing Cluster (http://
very simple models of very complicated systems, and getting rc.fas.harvard.edu; [email protected]).
out some results that make a lot of sense. My philosophy is that
knowing a little about how things work will enable us to choose Computations themselves do not cost any money, but buying
computational methods appropriately, design computational computers to which you have priority access on the cluster does.
studies that answer real chemical questions, and troubleshoot They're not cheap (starting price: $10 000). But the cluster has
calculations when they invariably crash. However, it is easy to computers everyone can use for free (but you have to wait).
get bogged down in the details of, say, how to compute the The Odyssey Cluster
Hartree-Fock density matrix. Although learning these details old days: buy one really fast, expensive computer that can do
takes a copious amount of time, they don't really help us get one calculation at a time
any of the answers we need in organic chemists. So I suggest
we all try to get a general sense for all of the different methods, these days: buy a lot of decent computers, and then use a lot
and open up dialogs with physical chemists to collaborate when of them at once
we need to do something a bit more complicated.
The Odyssey Cluster lets us do the latter. The magic of
In this tutorial, which I strongly suggest you go through at home, computer science means that computations can be done in
we will do two things: parallel, which means that every calculation is broken up into
many pieces, and different computers work on different parts
(1) Compute the energy difference between axial and of the calculation simultaneously. This results in drastic
equatorial 2-chlorotetrahydropyran. speedups in computational efficiency, without the enormous
O O cost of supercomputers.
Cl
Cl Anyone with an FAS affiliation can have an account on
(As you know, the stability difference is anomeric in nature.) Odyssey and run calculations. If you belong to a particular
research group, you may have access to certain computer
(2) Compute the rotational barrier in ethane. resources that other people don't. For example, the Evans
group has 8 "nodes." Every node contains 8 CPUs, or cores.
H H H
H H H H H H At the moment, "cross-node parallelism" is theoretically
H possible, but unnecessary for our purposes. Thus, we are
H H H H generally limited to 8 cores/job. (The Jacobsen group has
H HH H recently purchased some 12-core nodes.)
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Computational Workflow Q: How do I access the cluster?
No matter what the project you're working on is, everyone The first step is to login to the cluster via SSH (odyssey.fas.
follows the same workflow. We'll consider each step in turn: harvard.edu). The first time you login, you may be asked
whether to accept a "fingerprint;" say yes. For security
This is the hardest part, but reasons, you are asked to type in your login name, password,
think of a computation unfortunately, there's no room to
that you want to run talk much about this. and RSA security token passcode. The idea is that nobody can
login as you, unless they have both your password and
passcode. The passcode changes with time in a pre-defined
You have to tell Gaussian, a way; you read it off a small plastic key fob ("hard token") or a
create a Gaussian
quantum chemistry software readout on your screen ("soft token"). Most accounts are now
input file (*.gjf)
package what you want it to do. setup with soft tokens.
analyze results This is where you have to use This module sets up the following environment
your chemical intuition. variables for Java Runtime Environment 1.6:
PATH /n/sw/jdk1.6.0_12/bin
Idea: Not everyone is using their computers all the time, so ****************************************************
let's share the unused resources in a fair way.
Loading module devel/intel-11.1.046.
Loading module hpc/gaussian-09_ekwan.
Implementation: Different clusters use different programs, [ekwan@iliadaccess01 ~]$
but here at Harvard, we use the LSF program. Here is some When I typed my password and passcode, no text was mirrored
terminology: to the screen (so it's harder to steal my password if you happen
to be looking over my shoulder). The other information tells me
job: a computation you want to run on the cluster when I logged in last and from where, as well as what modules
core: an individual CPU have been loaded. The cluster is not just for Gaussian; many
node: a bunch of CPUs put together into one computer other scientists are using other programs. Loading modules
prepares the cluster to use Gaussian by setting certain
queue: a group of jobs waiting to run on the cluster; different environment variables, aliases, etc.
queues target different nodes with differing priorities depending
on the user who submitted the jobs Now, we're ready to take a look around.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
The Queue System immediately. My job will run, and then your job will resume.
Q: What computing resources are available? The "parallel" queues are also open access, but are not subject
[ekwan@iliadaccess01 ~]$ bqueues to suspension.
QUEUE_NAME PRIO STATUS NJOBS PEND RUN SUSP
dae 200 Open:Active 64 0 64 0 Both the parallel and serial queues are subject to time limits.
enj 200 Open:Active 84 0 84 0 Your job will terminate automatically if it exceeds its allotted
karplus 196 Open:Active 24 0 24 0 time, which is calculated from when it starts (not when it's
lsdiv 55 Open:Active 143 0 143 0
betley 45 Open:Active 4 0 4 0 submitted).
short_parallel 30 Open:Active 2 0 2 0
normal_parallel 25 Open:Active 2561 2284 265 0 short: one hour limit
long_parallel 20 Open:Active 2969 1304 1665 0
long_serial 15 Open:Active 150 0 150 0 normal: one day limit
short_serial 10 Open:Active 8472 7907 532 33 long: one week limit
normal_serial 5 Open:Active 3296 1906 1150 240 unrestricted: no limit
unrestricted_pa 3 Open:Active 159 0 159 0
unrestricted_se 1 Open:Active 161 97 64 0
number of cores pending, The longer the time limit, the longer it will take for your jobs to
(This is a truncated listing.) running, or suspended start running. When the cluster is busy (about three quarters of
the time), you will find that jobs submitted to normal_parallel
The LSF system tries to allocate the available resources fairly. will run within a day. (You will get a sense of how long your
Jobs are submitted to queues, each of which targets certain jobs will take as you go along. The molecules in this tutorial
nodes. However, unlike lines in real life, these are not first-in, will take less than an hour.)
first-out. Priority within a queue is assigned based on how
much computing power you have been using within the last Both the parallel and serial queues target eight-core nodes.
few days. For example, suppose my co-worker Joe submits One consideration is that parallel queues run jobs "exclusively,"
100 eight-core jobs to dae. dae only has 8 eight-core nodes, which means that only one job can run on them at a time.
so supposing they're all free at the moment, all 8 start running Therefore, you should always submit 8-core jobs to the parallel
immediately. Then, suppose I decide to submit a job, and I nodes. The serial nodes do not have this restriction, so the
haven't been doing any computations lately. My job will run fewer nodes you request, the higher the chances are that there
before any of Joe's remaining 92 jobs, but not before one of the will be a node somewhere that can accomodate your request.
8 jobs currently on dae finish.
What is the total activity on the cluster?
Not everyone has access to all the queues. For example, only [ekwan@iliadaccess01 ~]$ busers allusers
people in the Evans group have access to the dae queue
USER/GROUP NJOBS PEND RUN SSUSP USUSP RSV
(since Professor Evans paid for the computers). However, allusers 23416 14599 8398 249 0 170
you can still run jobs on our nodes if you submit your jobs jwzorek 1072 768 304 0 0 0
to the common queues, which end with "serial." These target
a mixture of FAS-owned computers and computers owned by There are about 15 000 cores worth of jobs pending right now,
individual research groups. However, these jobs are subject which means the cluster is busy (but not super busy). Joe and
to "suspension," which means that if you are running a job on I are working on a big project right now, so we have quite a few
a dae node, and I submit a job, then your job will be be paused jobs waiting.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Managing Your Jobs
Q: How do I see what jobs I'm running right now?
[ekwan@iliadaccess01 ~]$ bjobs -u jwzorek -w -a
(1) I needed the "-u jwzorek" flag because I'm not running any jobs at the moment. That tells it to display only the jobs being run
by jwzorek. The -w flag requests a "wide" listing, which helps me see the long names of the jobs. Long, descriptive names,
preferably connected with a painfully detailed and rigorous filing system are a very good idea, particularly if you are going to run
a lot of jobs at once. The -a flag will show "all" the jobs, including the ones that have recently crashed or completed.
(2) The status column tells you if the jobs are running (RUN), waiting in a queue (PEND), have recently completed successfully
(DONE), or have recently crashed (EXIT). Every time a job terminates, you get an email from LSF.
(3) EXEC_HOST tells you where the job is running right now. For example, the first job is running on eight cores on dae022.
(4) If you are impatient and want to see why your job is still pending:
[ekwan@iliadaccess01 ~]$ bjobs -l 25611512 Among a lot of other omitted output, this tells
us that the job isn't running mostly because
Job <25611512>, Job Name <still_38_OPLS_1_prod>, User <jwzorek>, Project <defau
lt>, Status <PEND>, Queue <normal_parallel>, Command <#!/b there aren't enough free nodes right now.
in/bash; #BSUB -q normal_parallel...
Mon Feb 7 20:04:44: Submitted from host <iliadaccess02>, CWD <$HOME/jobs1/stil
l_38_OPLS_1_prod>, Exclusive Execution, 8 Processors Reque
sted, Requested Resources <span[ptile=8]>;
PENDING REASONS:
Not specified in job submission: 902 hosts;
Job's requirement for exclusive execution not satisfied: 422 hosts;
Not enough hosts to meet the job's spanning requirement: 7 hosts;
Job slot limit reached: 7 hosts;
Closed by LSF administrator: 16 hosts;
Unable to reach slave batch server: 2 hosts;
Load information unavailable: 11 hosts;
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Managing Your Jobs This confirms that a Gaussian subroutine, called a "link," is
Occasionally, you will want to shuffle your jobs around. Here currently active and using all eight cores. Every link is
are some useful commands, each of which requires a jobid to associated with a particular part of Gaussian. In this case,
tell it which job to work on. If you put in "0," it tries to apply the link 701 is "one electon integrals first or second derivatives."
command to all your jobs. A full listing can be found here:
Sometimes, a job will fail to terminate, even if it is done or you Finally, you can look at what's going on with "Ganglia," which is
issue the bkill command manually. In that case, use the "-r" flag available at http://software.rc.fas.harvard.edu/ganglia/:
to kill the zombie job.
btop [jobid] - move the job to the top of the queue (at least, the
top of the jobs from you in that queue)
To monitor the activity on a certain node that's running your job: The above shows aggregate CPU usage; the below shows
[ekwan@iliadaccess01 ~]$ ssh dae022
CPU usage per node. There are a lot of other options.
...
...
To delete atoms, click on the small X tool button (not the big
X button, which deletes the entire molecule!). Click on
individual atoms to delete them.
delete whole molecule use this
You can connect two atoms with a bond using the single bond The two adjacent tools adjust the bond angle (select three
tool. However, keep in mind that the bonds you draw are a atoms) and dihedral angle (select four atoms). The tool with a
convenient tool for visualizing the connectivity in the molecule, question mark in it will show you the relevant bond distance,
and not relevant to the energy calculation (unless you’re doing angle, or dihedral in the status bar if you select the relevant
molecular mechanics). Click on two atoms, and then on the atoms.
tool, which pulls up this dialog box:
single bond tool Clearly, this is a cumbersome way to go about your business.
For the more common fragments, a template tool is available
by clicking on the benzene ring next to the “6C” button:
(3) Shared Processors: This tells Gaussian that you want (6) Charge and Multiplicity: This tells Gaussian how many
it to use up to 8 processors. Occasionally, you will want electrons to use. 1 1 would indicate a positively charged
to cut this number. Because there are some overhead singlet. -1 2 would indicate a negatively charged
costs associated with parallel computing, an eight-core doublet. Calculations involving open shell species are
job is not eight times faster than a one-core job. significantly more complicated, and should only be
However, the parallel code in Gaussian is very good and undertaken if you know what you’re doing. It’s not
the extra speedup is worth it, particularly for calculations simply a question of plugging in the geometry and
where you want a result quickly. getting an optimized ground state result.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Now, we are ready to submit the job. You will need to use your Troubleshooting Note: Occasionally, there is still a problem with
secure FTP client to do this. Use odyssey.fas.harvard.edu as the format of the carriage returns and line breaks when you
the domain name and enter in the same password. You will transfer a file from your computer to the cluster. In that case, try
need a new passcode, however. Note that the same passcode the dos2unix command (use “man dos2unix” for more details).
cannot be used for two logins; if you use one for logging into the
terminal, then you need to wait for a new one to start an SFTP Now that the job is copied onto the cluster, we can take a look at
session. On my screen (different if you use a different client): it:
[ekwan@iliadaccess01 chem106]$ ls -l
total 160
-rw-r--r-- 1 ekwan evans_lab 1044 Oct 19 11:00 2-
chloroTHP_ax.gjf
-rwxr--r-- 1 ekwan evans_lab 757 Feb 25 2010 analyze.sh
-rwxr--r-- 1 ekwan evans_lab 1436 Feb 25 2010 eek.sh
drwxr-xr-x 2 ekwan evans_lab 2048 Nov 24 18:02 jobs
drwxr-xr-x 2 ekwan evans_lab 7168 Jan 15 19:15 output
-rwxr--r-- 1 ekwan evans_lab 347 Jan 16 2010 submit.sh
-rwxr--r-- 1 ekwan evans_lab 521 Jan 13 07:50 template.sh
As you can see, the .gjf file is now in the directory. The
filenames appear in the rightmost column. Their permissions
appear in the leftmost column. The dates the files were last
The left-hand panel shows the directory structure of the remote
modified are also shown, along with their sizes in bytes.
session. The right-hand panel shows the contents of the active
directory. The top bar shows the current location. Note that the
To submit the job, you can invoke the submission script I have
current location in your SFTP session is not the same as in your
written. (A script is a small program written, in this case, in
current SSH session.
bash, which is a high-level, interpreted language.) It performs a
number of repetitive housekeeping duties that you will not want
Copy the input file (.gjf extension) into a directory of your choice.
to be bothered with. In particular, it runs your job in a separate
Be sure to transfer it as text not binary or you will encounter
directory with the same name as the input file, tells LSF how
some weird errors. Typically, you will not want to copy it into
many cores you want and which queue to submit the job to,
your root. Here are some useful file management commands
creates a scratch directory on the local node, etc.
you can use in your SSH session:
To use the scripts, you will need to transfer them onto the
pwd – ask for the current directory
cluster as well. They are available on the course website. You
mkdir [dirname] – create directory dirname
will need to execute the command “chmod u+rwx *.sh” before
rm –rf [dirname] – delete directory dirname and anything in it
you can run the scripts. This will give the computer permission
rm [filename] – delete filename
to execute the programs (something of a safety feature).
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
To submit the job, do this: not a good place to put things.) Let’s go there now:
[ekwan@iliadaccess01 chem106]$ ./submit.sh 8 short_parallel [ekwan@iliadaccess01 chem106]$ pwd
/n/home11/ekwan/chem106
Beginning batch submission process... [ekwan@iliadaccess01 chem106]$ cd output
Each job is being submitted to 8 processors in the queue [ekwan@iliadaccess01 output]$ ls
short_parallel. output.txt 2-chloroTHP_ax.out
Submitting job file 2-chloroTHP_ax.gjf... As you can see, the output file is there. The script I wrote
Job <13724321> is submitted to queue <short_parallel> automatically extracts the energies. To save time, I ran the jobs
Job submission complete.
for both the axial and equatorial:
[ekwan@iliadaccess01 chem106]$ more output.txt
This will submit every .gjf file in the directory into the queue *************************************
short_parallel, requesting 8 cores for every job. (Caution! Job 2-chloroTHP_ax started at...
Tue Oct 19 12:01:27 EDT 2010 electronic energy
Double check your job file before you submit the job. Gaussian
will be very unhappy if you make any syntax errors, and your job Job finished at:
will crash or do something you don’t expect it to.) Tue Oct 19 12:04:11 EDT 2010
free energy
[ekwan@iliadaccess01 chem106]$ bjobs -w Job terminated normally...
As you can see, the job is now running in short_parallel. You No imaginary frequencies found.
Sum of electronic and thermal Free Energies= -731.267453
will see its status as PEND if it’s waiting. If you suddenly realize *************************************
you made a mistake, use “bkill [jobid]” to cancel the job.
*************************************
Job 2-chloroTHP_eq started at... this is a true
Eventually, your job will run and complete and you will get a long Tue Oct 19 12:04:38 EDT 2010
email from LSF full of gibberish. I like these notifications, but local minimum
filter them away from my inbox. At that point, an output file (in Job finished at:
Tue Oct 19 12:06:40 EDT 2010
this case, 2-chloroTHP_ax.out) will be copied to the output
directory. Note that you will run into a problem if there is no Job terminated normally...
output directory present; use “mkdir output” to make such a
Final energy:
directory if it does not already exist. You only have to do this SCF Done: E(RB3LYP) = -731.368902477 A.U. after 1 cycles
once per directory containing the various scripts.
No imaginary frequencies found.
Sum of electronic and thermal Free Energies= -731.262071
In this case, my output directory is ~/chem106/output. ~ *************************************
represents your home directory or root. (The actual root, /, is
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
For reasons that are not clear to me, all the energies are
reported in hartree. To find the energy difference in kcal/mol,
you will need to subtract the two numbers and multiply by
627.509469. In this case, one finds that the axial conformer is
more stable by 3.4 kcal/mol.
Notice that there’s no bond drawn between the carbon and the
chlorine. This is because Gaussian doesn’t know anything
To see all the intermediate geometries, you can click through about where the bonds are. GaussView simply draws in bonds
the circled box. As you can see, this optimization went when the distances between atoms are within certain
smoothly, converging nicely to a stationary point. You can also thresholds. The C-Cl bond is abnormally long due to the
check to make sure that no imaginary frequencies were found anomeric effect, so it is not recognized as a bond. However, the
by going Results…Vibrations: lack of a line connecting the C and Cl has no significance.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
Finally, we want to find a transition state for the rotational degrees. If you scan too coarsely, you can have “kinking”
barrier in ethane. As I mentioned already, the most robust way problems where the energy profile you get is not smooth. Here
to find transition states is to perform a series of constrained is my input file:
optimization where the reacting coordinate is frozen in %chk=checkpoint.chk
%mem=3GB
increments. For many reactions, this is a forming bond %nprocshared=8
distance. In this case, it is a bond torsion. Draw ethane and #t opt=modredundant b3lyp/6-31g(d) pop=none
use the question mark tool to identify the atom numbers of a H-
title
C-C-H torsion:
0 1
C -1.27672721 1.36139405 0.37637410
H -0.91105109 1.81418310 -0.52149173
H -2.00301536 0.61545024 0.12944624
H -1.72899504 2.10885135 0.99416159
C -0.10678799 0.70753803 1.13486901
H 0.34547984 -0.03991928 0.51708152
H 0.61950015 1.45348183 1.38179688
H -0.47246412 0.25474897 2.03273484
D 8 5 1 2 S 18 10.000000
This results in a nice energy profile (Results…Scan):
D 8 5 1 2 S 18 10.000000
means to scan the dihedral (D; use B for bond and A for angle)
angle between atoms 8-5-1-2 eighteen times in steps of 10
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
However, we are not done yet. Just because we have found a Take note of the sub-keywords under the main opt keyword.
maximum in the energy profile is no guarantee it is a true
transition state. For that, we need the gradient to be zero (or at ts: Request optimization to a first-order saddle point (i.e., a
least below the convergence threshold) and there to be exactly transition state)
one imaginary frequency. To do this, save the geometry
corresponding to an energy maximum as a new .gjf file: calcfc: Perform a frequency job at the beginning of the
calculation (i.e., calculate the Hessian). An accurate Hessian is
required for any TS search. Occasionally, you can read the
frequencies in from the checkpoint file; in that case, you should
use the readfc sub-keyword. So you must either have calcfc or
readfc for any transition state search.
(1) You will only find the transition state if you are very, very
Notice that the energy maximum, is, in fact, an eclipsed close to it already.
conformation. This is a good sign. We will need a new header
to request an unconstrained transition state search: (2) Even if you’re very close to the correct geometry, transition
%chk=checkpoint.chk state optimizations often fail.
%mem=3GB
%nprocshared=8
#t opt=(calcfc,ts,noeigentest) freq=noraman b3lyp/6-31g(d) (3) Check your syntax! Check your syntax!
pop=nbo
Gaussian also has the ability to try and connect a starting
title
material and product with a transition state directly; see the
0 1 QST2 and QST3 methods under the “opt” keyword. I have
never used these, so I can’t offer any advice on them.
E. Kwan Lecture 9: Introduction to Computational Chemistry Chem 117
In my run, the transition state optimization converged nicely: state along the reaction coordinate. In general, if your
optimization does not converge to a transition state within 30
steps or so, you are in trouble.
Ambiguous:
Sometimes, the transition state energy will go down, but so
will the gradient. This may result in a successful optimization.
However, this often later results in…
Bad Signs:
The transition states “collapses” to starting material or product.
In the case below, it opened up to starting material (use
Plots…Molecular Property to get the third plot):
Good Signs: