Computers in Chemistry

Molecular Conformations

Eric R. Bittner

The aim of this assignment is to introduce numerical methods for conformational modelling, and for solving minimisation problems. These will be illustrated with simple examples. There is more here then you will be able to do in two hours.  Do not worry about this; just work at your own rate and learn as much as you can!  Do the purple parts.

Get :: noopen :  Cannot open  \" BasicCalculations . nb \" .

•Pre-requisites

Load the statistics and graphics packages:

In[13]:=

<< Statistics`

In[14]:=

<< Graphics`

To improve the appearance of graphics, TraditionalForm will be used as the default format type for text that appears in graphics,

In[15]:=

$FormatType = TraditionalForm ;

and the default style for text in graphics is set as follows.

In[16]:=

$TextStyle = {FontSize -> 10} ;

•3.0. Preliminaries

In this module we need to be able to calculate and plot in one-, two-, and three-dimensions.

•3.0.2 Plotting

The Basic Calculations palette can help you find out more about how to plot a function.

A scalar function f(x) depending on a single variable x, can be plotted using Plot[f(x), {x, xmin, xmax}] ;

To plot a function f(x, y) of two variables use  Plot3D[f(x, y), {x, xmin, xmax}, {y, ymin, ymax}] ;

If required, you can improve the resolution of a plot by increasing the number of plot points using the PlotPoints.

The more points you choose, the longer it will take to compute and render the image.

Plot the following functions for 0 <= x <= 4 and 0 <= y <= 4:

(a) 4 - x^2 O
(b) x y O
(c) x^2 + y^2 O
(d) 4 - x^2 - y^2 O
(e) x - y + 7 cos(y) sin(x) O

•3.0.3 Finding Minima

To find the value and location of the minimum of a scalar function f(x) we can use the FindMinimum[f(x), {x, x0}] function. Here x0 is a starting value from which the FindMinimum will attempt to proceed to find a local minimum. Clearly in the case of some particularly non-monotonic functions, this may or may not actually lead to the global minimum.

0. Find minima for the following functions. State whether the value found is a local or global minimum.:

(a) x^2 - 4 O
(b) 7 sin(x) - x^3 O
(c) x^5 - 17 x^3 + 24 sin(x) O
(d) x^2 + 4 sin(5 x) []

(a)
(b)
(c)
(d)

•3.0.4 Animated Graphics

There are several ways to create an animated graphic of a static or dynamic 3D model in Mathematica. The following code generates a series of n = 32 graphs showing a coil that rotates about the z-axis:

pitch = 0.32 ; r = 1 ; Φ = 8 π ; n = 32 ;

anime(θ_) := ParametricPlot3D[{r sin(x), r cos(x), (pitch x)/(2 π)}, {x, θ, θ + Φ}, SphericalRegion -> True, Axes -> False, Boxed -> False, ViewPoint -> {4, 3, 2.5}] ;

Table[anime(θ), {θ, (2 π)/n, 2 π, (2 π)/n}] ;

Close the group of graphics cells (by double-clicking on the grouping cell bracket) and then double-click on one of the images to animate the sequence (or use Animate Selected Graphics under the Cell menu).

Run the above code and try varying the pitch, radius and maximum θ. [3 Points]

•3.1. Coulomb Potential

Computer modelling (or simulation) is commonly used when exact analytic solutions of mathematical models are unavailable. When used for differential equations, it produces approximate solutions only, so it is important to be aware of the potential limitations of the method.   

Two point charges q and Q, separated by distance r, represent an electrical potential energy given by

U(r) = (k q Q)/r + U _ 0,

where U _ 0 is a constant reference level corresponding to the maximally separated limit r -> ∞. The Coulomb force is found from U by the relation

F(r) = -d U/d r = (k q Q)/r^2.

Since F is independent of U _ 0, we can choose our reference to be zero without affecting F -- that is: set U -> 0 as r -> ∞. For a group of point charges q _ i with distances r _ (i, j) between the i^th and j^th charges, the total potential energy is the sum of all pairwise contributions:

U _ Total = Underoverscript[∑, i != j = 1, arg3] U _ (i, j).

Example: Consider the one dimensional case of two fixed charges q _ 1 and q _ 2 at distance R apart and one movable charge q _ 3 at some point r from q _ 1. The total PE is then :

 U _ tot    =    U _ 12 + U _ 13 + U _ 23    = ( k q _ 1 q _ 2)/R + ( k q _ 1 q _ 3)/(| r |) + ( k q _ 2 q _ 3)/(| R - r |).

What are the practical restrictions on the value of r?

What is the minimum possible value for U?

•In order to plot U we shall incorporate the unit-dependent constants k and e into the expression for U, by defining a new potential V = U/(k e^2). Then for a charge q _ 1 = Z _ 1 e in the vicinity of a point charge q _ 2 = Z _ 2 e we will have V = (Z _ 1 Z _ 2)/r. (Z _ i being the valence of the i^th charge)

0. Plot V _ tot versus r for the case q _ 1 = + e, q _ 2 = + 2 e, and q _ 3 = e. Let R = 1, and use range {-2, 2} for r.

In[51]:=

Vtot[r_] := (q1 q2)/R + (q1 q3)/r + (q2 q3)/(R - r) ; params = {q1 -> e, q2 -> 2 e , q3 -> e, R -> 1, e -> 1} ; Plot[Vtot[r] //. params, {r, -2, 2}]

[Graphics:HTMLFiles/index_78.gif]

Out[53]=

-Graphics -

0. Can you find an analytic solution for the value of r between 0 and 1 that minimises V _ tot?  What will the force be at this position?

In[59]:=

Solve[(D[Vtot[r], r] /. r -> x) == 0, x]

Out[59]=

{{x -> (q1^(1/2) R)/(q1^(1/2) - q2^(1/2))}, {x -> (q1^(1/2) R)/(q1^(1/2) + q2^(1/2))}}

In[71]:=

Vtot[(q1^(1/2) R)/(q1^(1/2) + q2^(1/2))] //. params // N D[Vtot[r], r] /. {r -> (q1^(1/2) R)/(q1^(1/2) + q2^(1/2))} // Simplify

Out[71]=

7.828427124746191`

Out[72]=

0

We now wish to plot V _ tot for the 2 D case using the distance function defined in §3 .1 .1 above .

Let the two fixed charges of the previous question lie on the x axis (y = 0) and allow the third 'mobile' charge to have arbitrary {x, y} coordinates. Display the potential energy surface V _ totusing Plot3D as in §3.0.2 above. You may wish to increase the number of PlotPoints.

In[73]:=

Vtot[x_, y_] := (q1 q2)/R + (q1 q3)/(x^2 + y^2)^(1/2) + (q2 q3)/((x - R)^2 + y^2)^(1/2)

In[122]:=

params = {q1 -> e, q2 -> 2 e , q3 -> -e, R -> 1, e -> 1} ; Plot3D[Vtot[x, y] //. params, {x, -2, 2}, {y, -2, 2}] ; ContourPlot[Vtot[x, y] //. params, {x, -1, 2}, {y, -1, 1},  PlotRange -> {0, -20}, Contours -> 30, ContourShading -> False] ;

[Graphics:HTMLFiles/index_94.gif]

[Graphics:HTMLFiles/index_95.gif]

What can you now say about the value of x that you found in Question 0 above that minimised V _ tot for the one-dimensional case?

Repeat the 2D example with q _ 3 = - e. Briefly describe what might happen if an electron or a proton were injected into the vicinity of the two fixed positive charges.

Repeat the 2D example.  This time we will make a trajectory of the electron's path.  
(a) First, write down the equations of motion followed by the electron.  Do this in Mathematica by defining (x,y,vx, & vy) as the (xy) position and (vx,vy) velocity components.    Assume the electron has unit mass (m= 1) and e = 1 (we're using Atomic units in this case...so length is in Bohr and time in atomic units).
(b) Calculate the force on an electron at point (x,y) due to the charges.  You will have 2 force components, fx and fy, both functions of (x,y) position.
(c) Define a set of equations of motion and initial conditions:   Here you choose the initial coordinate point (xo,yo)

     eom = {x'[t]==vx[t], y'[t]==vy[t], vx'[t]==fx[x[t],y[t]], vy'[t]==fy[x[t],y[t]]};
     inits = {x[0]==xo, y[0]==yo, vx[0]==0,vy[0]==0};
     diffeq = Join[eom,inits];
     
   (d.) Solve the equations of motion using
   tmax = 10 (or so)
  traj =  NDSolve[diffeq,{x[t],y[t],vx[t],vy[t]},{t,0,tmax}];
  
  e.) Plot the trajectory in 2D:
  plot = ParametricPlot[Evaluate[{x[t],y[t]}/.traj],{t,0,tmax}]
  
  ---CAVEAT EMPTOR...you may need to play with the options in NDSolve to get the best trajectory.
  
  f.) Try finding both bound states and scattering states by varying the initial velocities.   Can you find "chaotic" states and "regular" or "periodic" solutions?
     

fx[x_, y_] := - D[Vtot[X, Y], X] /. {X -> x, Y -> y} fy[x_, y_] := - D[Vtot[X, Y], Y] /. {X -> x, Y -> y}

eom = {x '[t] == vx[t], y '[t] == vy[t], vx '[t] == fx[x[t], y[t]], vy '[t] == fy[x[t], y[t]]} ;

inits = {x[0] == 0.5, y[0] == 0.5, vx[0] == 0, vy[0] == 0} ; diffeq = Join[eom, inits] ; tmax = 10 ; t1 = NDSolve[diffeq //. params, {x[t], y[t], vx[t], vy[t]}, {t, 0, tmax}, MaxSteps -> 20000] ; ParametricPlot[Evaluate[{x[t], y[t]} /. t1], {t, 0, tmax}] ;

[Graphics:HTMLFiles/index_102.gif]

In[158]:=

inits = {x[0] == 0.5, y[0] == 0.5, vx[0] == 1, vy[0] == 0} ; diffeq = Join[eom, inits] ; tmax = 10 ; t1 = NDSolve[diffeq //. params, {x[t], y[t], vx[t], vy[t]}, {t, 0, tmax}, MaxSteps -> 20000] ; ParametricPlot[Evaluate[{x[t], y[t]} /. t1], {t, 0, tmax}] ;

[Graphics:HTMLFiles/index_104.gif]

In[163]:=

inits = {x[0] == 0.5, y[0] == 0.5, vx[0] == -1, vy[0] == 0} ; diffeq = Join[eom, inits] ; tmax = 10 ; t1 = NDSolve[diffeq //. params, {x[t], y[t], vx[t], vy[t]}, {t, 0, tmax}, MaxSteps -> 20000] ; ParametricPlot[Evaluate[{x[t], y[t]} /. t1], {t, 0, tmax}] ;

[Graphics:HTMLFiles/index_106.gif]

In[372]:=

inits = {x[0] == -10, y[0] == 0.15, vx[0] == .10, vy[0] == 0} ; diffeq = Join[eom, inits] ; tmax = 1000 ; t1 = NDSolve[diffeq //. params, {x[t], y[t], vx[t], vy[t]}, {t, 0, tmax}, MaxSteps -> 20000] ; ParametricPlot[Evaluate[{x[t], y[t]} /. t1], {t, 0, tmax}, PlotRange -> All] ;

[Graphics:HTMLFiles/index_108.gif]

As I mentioned in class, there is an interesting connection between the shapes of quasi-periodic orbitals (i.e. trajectories) and the corresponding quanutm wavefunction.  For more information, explore Eric Heller's web-site at Harvard (http://monsoon.harvard.edu)

•3.2. Lennard-Jones Potential

When two atoms approach each other, the interaction is much more complicated than a simple Coulomb potential due to electron shielding and orbital dynamics as well as the fundamentally quantum nature of atomic systems. Solving the equivalent of Schroedinger's equation for any practical situation is extremely difficult, if not impossible. However, a level of understanding can be achieved by a semi-classical approach based on measured values of various atomic properties used to estimate parameters in a simplified model.

Empirical modeling of experimental data leads to the following approximate expression for the interaction between two atoms X and Y: U(r) = A/r^12 - B/r^6, where A and B are constants for each pair of atoms. We shall assume r is measured in nm, and A and B take appropriate units such that U is measured in Joules.

StyleBox[RowBox[{Cell[TextData[A]],  }], ] StyleBox[RowBox[{  , Cell[TextData[B]]}], ]
HH 18.9 0.1974 0.060
CC 1201.2 1.5540 0.154
NN 676.2 1.5246 0.148
OO 609.0 1.5414 0.148
CO 861.0 1.5414 0.151
CN 907.2 1.5372 0.151
CH 159.6 0.5376 0.109
NO 642.6 1.533 0.148
HO 642.6 0.5208 0.104
NH 113.4 0.5250 0.104

Experimental values of A, B, and the Covalent Bondlength (nm), for the Lennard-Jones model.

A general expression for the Lennard-Jones potential function is then:

V _ LJ[d_, {A_, B_}] := A/d^12 - B/d^6 ;

Plot V _ LJCell[] for the hydrogen bond (HH). Find the value of r that minimises V _ LJ. Compare this value to the covalent bondlength.

•3.3. Ethane Rotational Conformation

A common method used in the modeling of large molecules involves a combination of Lennard-Jones and Coulomb potentials:

U(r) = A/r^12 - B/r^6 + (k q _ 1 q _ 2)/r.

The effective charges q _ 1 q _ 2are not the atomic charges but somewhat less due to the effect of screening and cancellation between the positive nucleus and the negative electron shells. However, in this section we restrict ourselves to the Lennard-Jones potentials of §3.2.

•3.3.1 Building the Ethane Molecule

Ethane contains two covalently bonded carbon atoms with three hydrogens connected to each carbon. X-ane is a hypothetical molecule made by replacing one of the hydrogens in each group by a large atom X. We shall choose to place one of the two carbon atoms at the origin {0, 0, 0} with the other along the + z axis. The -CH _ 3 or -CH _ 2X group attached to the carbon at the origin shall be assumed fixed, while the other three are free to rotate about the second carbon. Both groups are also assumed to adopt tetrahedral structure.

First we define the covalent bondlengths ! _ C for the C-C  bond, ! _ H for the C-H bond, and ! _ X for a C-X bond where X is some large atom such as bromine. and the positions of the atoms in terms of these. We introduce a rotation angle θ as a variable to assist in the minimisation of the potential energy. The positions of the three mobile atoms are therefore expressed as functions of θ. Here are the co-ordinates for ethane:

! _ C = 1.542 ; ! _ H = 1.09 ; ! _ X = 1.6 ;

C _ 1 = {0, 0, 0} ; C _ 2 = {0, 0, ! _ C} ;

H1 = {(2 2^(1/2) ! _ H)/3, 0, -! _ H/3} ;

H2 = {1/3 (-2^(1/2)) ! _ H, 2/3^(1/2) ! _ H, -! _ H/3} ;

H3 = {1/3 (-2^(1/2)) ! _ H, -2/3^(1/2) ! _ H, -! _ H/3} ;

H4[θ_] := {2/3 2^(1/2) ! _ H Cos[θ], 2/3 2^(1/2) ! _ H Sin[θ], ! _ C + ! _ H/3} ;

H5[θ_] := {2/3 2^(1/2) ! _ H Cos[(θ + (2 π)/3)], 2/3 2^(1/2) ! _ H Sin[(θ + (2 π)/3)], ! _ C + ! _ H/3} ;

H6[θ_] := {2/3 2^(1/2) ! _ H Cos[(θ + (4 π)/3)], 2/3 2^(1/2) ! _ H Sin[(θ + (4 π)/3)], ! _ C + ! _ H/3} ;

In order to see the molecule in 3D as a function of θ we can use the following routine:

spin[θ_] := Show[Graphics3D[{PointSize[0.04], RGBColor[1, 0, 0], Point[C _ 1], Point[C _ 2], RGBColor[0, 1, 0], Point[H1], Point[H2], Point[H3], Point[H4[θ]], Point[H5[θ]], Point[H6[θ]], GrayLevel[0], Thickness[0.01], Line[{C _ 1, C _ 2}], Line[{C _ 1, H _ 1}], Line[{C _ 1, H _ 2}], Line[{C _ 1, H3}], Line[{C _ 2, H4[θ]}], Line[{C _ 2, H5[θ]}], Line[{C _ 2, H6[θ]}]}], PlotRange -> ( -2     2    ), ViewCenter -> {0, 0, ! _ C/3}, Boxed -> False, ViewPoint -> {4, 3, 2.5}] ;                                                                                                                                                                                                                                                                                                                                                                                                                                          -2     2                                                                                                                                                                                                                                                                                                                                                                                                                                          -1.5   2.5

Table[spin[θ], {θ, 0, 2 π, π/10}] ;

[Graphics:HTMLFiles/index_177.gif]

Close the group of graphics cells (by double-clicking on the grouping cell bracket) and then double-click on one of the images to animate the sequence (or use Animate Selected Graphics under the Cell menu).

3.3.2 Exercises

0. Modify the previous method for the case where H _ 1 and H _ 6 are replaced by the large atom X as X _ 1 and X _ 2, assuming C-X bondlength ! _ X = 1.6Cell[] as above and the following values for LJ coefficients: H-X {A, B} = {20, 0.25}; X-X {A, B} = {100, 0.3}; [2 Points]

0. Plot the Lennard-Jones potential for the H-H, H-X, and X-X interactions in isolation. Find the distances for which each potential is minimised. [2 Points]

0. Assemble the expression for the total Lennard-Jones potential for the ethane and X-ane molecules as functions of the rotation angle θ. [2 Points]

V _ ethane[θ_]:=
V _ xane[θ_]:=

0. Plot this total potential function versus θ over the range {θ , 0, 2 π}. Find the value(s) of θ for which each function is minimised. [1 Point]

Ethane: θ=
X-ane: θ=

0. What is the most likely conformation for X-ane according to this model? [1 Point]


Converted by Mathematica  (September 27, 2002)