-
Bowy La Riviere authoredBowy La Riviere authored
6_bonds_and_spectra_solutions.md 4.47 KiB
Solutions for bonds and spectra
Warm-up exercises
3.Look at the sign of the force
.
Exercise 1: linear triatomic molecule
- In 1D, there are two normal modes and in 3D there are 4 normal modes
-
Whereis the mass of the oxygen atoms andthe mass of the carbon atom.
Exercise 2: Lennard-Jones potential
- See lecture+internet
- The equilibrium position is . The energy at the inter atomic distanceis given by:
-
Where
- The ground state energy is given by
And the breaking energy is given by
- Distance from which becomes anharmonic:Number of phonons that fit in the potential before it becomes anharmonic
Exercise 3: Numerical simulation
import numpy as np
from numpy import linalg as LA
import matplotlib.pyplot as plt
# Creating function that initializes the spring matrix
def initial_mat(N):
K = np.zeros((N,N), dtype = int)
b = np.ones(N-1)
np.fill_diagonal(K, 2); np.fill_diagonal(K[1:], -b); np.fill_diagonal(K[:, 1:], -b)
K[0,0] = K[-1,-1] = 1
omega = np.sqrt(np.abs(LA.eigvalsh(K)))
# outputting a histogram of the data
plt.figure()
plt.hist(omega, bins = 30)
plt.xlabel("$\omega$")
plt.ylabel("Number of levels per eigenfrequency")
plt.title('Number of levels per eigenfrequencies for N = %d' %N)
# Running the code
initial_mat(5)
initial_mat(200)
import numpy as np
from numpy import linalg as LA
import matplotlib.pyplot as plt
# Creating mass matrix
def mass_matrix(N, m1, m2):
M = np.zeros((N,N), dtype = int)
j = np.linspace(0, N-1, N)
for j in range(N):
if j%2 ==0:
M[j, j] = m1
else:
M[j, j] = m2
return M
# Creating function that initializes the spring matrix
def initial_mat(N,M):
K = np.zeros((N,N), dtype = int)
b = np.ones(N-1)
np.fill_diagonal(K, 2); np.fill_diagonal(K[1:], -b); np.fill_diagonal(K[:, 1:], -b)
K[0,0] = K[-1,-1] = 1
MK = np.dot(LA.inv(M), K)
omega = np.sqrt(np.abs(LA.eigvalsh(MK)))
# outputting a histogram of the data
plt.figure()
plt.hist(omega, bins = 30)
plt.xlabel("$\omega$")
plt.ylabel("Number of levels per eigenfrequency")
# Defining variables
N = 200
m1 = 1; m2 = 4
# Running the code
M = mass_matrix(N, m1, m2)
initial_mat(N, M)
Where in this simulation, every even numbered atom in the chain has 4 times the mass of every odd numbered atom
# Defining constants
kappa_1 = 1
kappa_2 = 2
# Creating function that initializes the spring matrix
def initial_mat(N, kappa_1, kappa_2):
K = np.zeros((N,N), dtype = int)
b = np.ones(N-1)
c = np.zeros(N-1)
idx = np.linspace(0, N-2, N-1)
# Create pattern of zero's and ones
b[idx % 2 == 0] = 0
c[idx % 2 == 0] = 1
# Diagnonal
np.fill_diagonal(K, kappa_1+kappa_2)
# Off diagnonal
np.fill_diagonal(K[1:], -c*kappa_1-b*kappa_2)
np.fill_diagonal(K[:, 1:], -c*kappa_1-b*kappa_2)
# Setting up initial and last values
K[0,0] = kappa_1
if (N % 2) == 0:
K[-1,-1] = kappa_1
else:
K[-1,-1] = kappa_2
# Calculating the dispersion relation
omega = np.sqrt(np.abs(LA.eigvalsh(K)))
# outputting a histogram of the data
plt.figure()
plt.hist(omega, bins = 30)
plt.xlabel("$\omega$")
plt.ylabel("Number of levels per eigenfrequency")
plt.title('Number of levels per eigenfrequencies for N = %d' %N)
# Running the code
initial_mat(200, kappa_1, kappa_2)