# Tutorial 17. Interactive -- 2D harmonic potential

### Learning objectives

- Learn to plot 3D graph to visualize potentials in multidimensional space
- Play around with the generalized force constants of 2D harmonic potential to understand how the diagonal and off-diagonal elements influence the shape of the potential

## Background

When we study vibration in polyatomic molecules, we know that we can write down the Taylor expansion of the potential, and if we keep up to the quadratic terms, we can get

\[V= V(0)+ 1/2\sum_{i,j} k_{ij}x_ix_j.\]Here $k_{ij}$ is the generalized force constant, and $x_i,x_j$ denotes the displacements of the coordinates.

The square terms, $\frac{1}{2}k_{ii}x_i^2$ are fully analogous to the 1D Harmonic potential. The cross terms with $i\neq j$ are more mysterious: what is the physical meaning of the cross terms? How do they influence the shape of the potential?

## Find the answer by visualization

One of the most intuitive ways to understand a multi-dimension function is to visualize it. To simplify the discussion, let’s focus on visualizing the 2D harmonic potential.

\[V(x,y)= V(0)+ \frac{1}{2}k_{11}x^2 + \frac{1}{2}k_{22}y^2 + \frac{1}{2}k_{12}xy + \frac{1}{2}k_{21}xy\]Notice that by definition, $k_{12}=\frac{\partial^2V}{\partial x\partial y}$, $k_{21}=\frac{\partial^2V}{\partial y\partial x}$, we have $k_{12} = k_{21}$. Thus we can further write the 2D harmonic potential as

\[V(x,y)= V(0)+ \frac{1}{2}k_{11}x^2 + \frac{1}{2}k_{22}y^2 + k_{12}xy\]We can then present the 2D potential in 3D, or 2D contour plot, or 1D plot along direction in the XY plane.

## Try and learn

Run the following code blocks to visualize the 2D harmonic potential in different ways and understand how $k_{11}$, $k_{22}$ and $k_{12}$ influence the shape of the potential.

**Instructions**

- First, click “Activate” to activate the code block.
- Once you see the buttons to “run” at the bottom left corner of the code block, click “run” to run the code.
- Please be patient. Starting the kernel can be slow sometimes.
- You may drag the sliders to change $k_{11}$, $k_{22}$ and $k_{12}$ values.
- To isolate the effects of changing $k_{11}$, $k_{22}$ and $k_{12}$ values, first set $k_{12}=0$, adjust $k_{11}$ or $k_{22}$ and see how the shape of V changes.
- With $k_{11}$ and $k_{22}$ values fixed, adjust $k_{12}$ and see how the shape of V changes.

### 1. 3D contour plot

This code block visualizes the 3D contour plot of the harmonic potential. Both the color and the height in Z-direction indicate the potential value. The contour lines represent regions in the (x,y) plane with the same value of V(x,y).

### 2. 2D contour plot

The next code block visualizes the 2D contour plot of the harmonic potential. The color indicates the potential value. The contour lines represent regions in the (x,y) plane with the same value of V(x,y).

### 3. Value along a line in X-Y plane across the origin.

In the next code block, we want to visualize the V(x,y) value along a line in the X-Y plane across the origin. We can set an angle $\theta$ to denote the direction of the line. Then we plot the V(x,y) value along the line in a 1D plot.

## Questions

- How does the potential shape change with $k_{11}$?
- How does the potential shape change with $k_{22}$?
- How does the potential shape change with $k_{12}$?