```python
import numpy as np
import sympy as sy
import matplotlib.pyplot as plt
from openmm import unit
```

# Harmonic well potential

The harmonic well potential is described by the following expression:

$$
f(x)=\frac{1}{2} k \left(x^2 + y^2 + z^2 \right)
$$ (harmonic-well-potential)

Where $k$ is the only parameter and represents the stiffness of the harmonic potential -or the stiffness of the harmonic spring described by the hookes' law-. Notice that the potential for potential dimensions $Y$ and $Z$, has the same shape. In this way we have a three dimensional harmonic well. But let's see here only the proyection over a single dimension $X$ since $Y$ and $Z$ are decorrelated, and there by will behave as $X$.


```python
def harmonic_well(x,k):
    return 0.5*k*x**2
```


```python
k=5.0 * unit.kilocalories_per_mole/ unit.nanometers**2 # stiffness of the harmonic potential

x_serie = np.arange(-5., 5., 0.05) * unit.nanometers

plt.plot(x_serie, harmonic_well(x_serie, k), 'r-')
plt.ylim(-1,5)
plt.xlim(-2,2)
plt.grid()
plt.xlabel("X ({})".format(unit.nanometers))
plt.ylabel("Energy ({})".format(unit.kilocalories_per_mole))
plt.title("Harmonic Well")
plt.show()
```

Different values of $k$ can be tested to graphically see how this parameter accounts for the openness of the well's arms. Or, as it is described below, the period of oscillations of a particle of mass $m$ in a newtonian dynamics.

The hooks' law describes the force suffered by a mass attached to an ideal spring as:

$$
F(x) = -k(x-x_{0})
$$ (hooks_law)

Where $k$ is the stiffness of the spring and $x_{0}$ is the equilibrium position. Now, since the force is minus the gradient of the potential energy $V(x)$,

$$
F(x) = -\frac{d V(x)}{dx},
$$ (grad_potential)

we can proof that the spring force is the result of the first harmonic potential derivative:

$$
V(x) = \frac{1}{2} k (x-x_{0})^{2}
$$ (x_potential)

And the angular frequency of oscillations of a spring, or a particle goberned by the former potential, is:

$$
\omega = \sqrt{\frac{k}{m}}
$$ (omega)

Where $m$ is the mass of the particle. This way the potential can also be written as:

$$
V(x) = \frac{1}{2} k (x-x_{0})^{2} = \frac{1}{2} m \omega^{2} (x-x_{0})^{2}
$$ (x_potential_2)

Finnally, the time period of these oscillations are immediately computed from the mass of the particle, $m$, and the stiffness parameter $k$. Given that by definition:

$$
T = 2\pi / \omega
$$ (period)

Then:

$$
T = 2\pi \sqrt{\frac{m}{k}}
$$ (period_2)

3f1456e2c33ac5555922a93dbaa8ee7fa2e33d59
ipynb
Jupyter Notebook
docs/contents/molecular_systems/harmonic_well/harmonic_well.ipynb
uibcdf/Molecular-Systems
74c4313ae25584ad24bea65f961280f187eda9cb
MIT
docs/contents/molecular_systems/harmonic_well/harmonic_well.ipynb
uibcdf/Molecular-Systems
74c4313ae25584ad24bea65f961280f187eda9cb
MIT
docs/contents/molecular_systems/harmonic_well/harmonic_well.ipynb
uibcdf/Molecular-Systems
74c4313ae25584ad24bea65f961280f187eda9cb
MIT
Qwen/Qwen-72B
1. YES
2. YES