氢的薛定谔方程的数值解

计算科学 Python 计算物理学 特征值 量子力学
2021-12-17 01:32:05

我正在尝试以以下数字形式求解氢原子的薛定谔方程:

[22md2dr2+V(r)+2l(l+1)2mr2]R(r)=ER(r).

具有库仑势

V(r)=e24πϵ0r2.
通过引入无量纲变量x=r/a0ϵ=E/E0,E0=1Ry,薛定谔方程可以写成如下:

[d2dx22x+l(l+1)x2]R(x)=ϵR(x)

我使用这篇文章中描述的Leandro M.的方法通过离散化的导数来求解薛定谔方程R并将其转换为矩阵方程。

我在 Python 中实现了这个解决方案,我认为它有效,我唯一的问题是我不知道如何从得到的矩阵的特征值和 - 向量到氢原子的能量和相应的波函数n=1,2,3,...l=0.

编辑:为了澄清,在我的代码的最后一行中,我确实得到了一些 Eigenenergies 的值,但是它们在几个 10000 而不是 1 的范围内n=1例如。问题是我不知道如何从我计算的值中得到正确的值。

这是我的代码:

import numpy as np
from numpy.linalg import eig
from matplotlib import pyplot as plt

d = 0.001
# set values for r
N = 3000
rmax = 10
r = np.linspace(1e-20, rmax, N)

# create first matrix of schrodinger eq corresponding to the derivative with the following shape:
# (-2  1                   )
# ( 1 -2  1                )
# (    1 -2  1             )  * (-1/(d**2))
# (         ...            )
# (                1  -2  1)
# (                    1 -2)


m = np.empty((N, N))

x = -1 / d ** 2

m[0, 0] = -2 * x
m[0, 1] = 1 * x
m[N - 1, N - 1] = -2 * x
m[N - 1, N - 2] = 1 * x

for i in range(1, N - 1):
    m[i, i - 1] = 1 * x
    m[i, i] = -2 * x
    m[i, i + 1] = 1 * x

for i in range(2, 10):
    m[0, i] = 0

# create matrix corresponding to the potential with the following shape:
# (V1                 )
# (   V2              )
# (      V3           )
# (       ...         )
# (            VN-1   )
# (                 VN)

vdiag = []
l = 0

for i in range(0, N - 1):
    vdiag.append(-2 / r[i] + l * (l + 1) / (r[i] ** 2))

v = np.empty((N, N))
np.fill_diagonal(v, vdiag)

# add matrices to get eigenvalue equation: H*R(x) = E*R(x)
H = np.empty((N, N))

for i in range(0, len(v[0] - 1)):
    for j in range(0, len(v[1] - 1)):
        H[i, j] = m[i, j] + v[i, j]

# setting boundary conditions R_1 = R_N = 0
H[:, 0] = H[:, N - 1] = 0

# determine eigenvalues and eigenvectors
energies, wavefcts = eig(H)
1个回答

我终于找到了解决我的问题的方法,即特征能量在特征值向量内的位置,但顺序不正确。如果有人感兴趣,使用以下代码我得到了正确的结果:

import numpy as np
from numpy.linalg import eig
from matplotlib import pyplot as plt


# set values for x
xmax = 500
N = 3000
d = xmax/N
x = np.linspace(1e-20, xmax, N)

# create first matrix of schrodinger eq corresponding to the derivative with the following shape:
# (-2  1                   )
# ( 1 -2  1                )
# (    1 -2  1             )  * (-1/(d**2))
# (         ...            )
# (                1  -2  1)
# (                    1 -2)


m = np.zeros((N, N))

g = -1 / d ** 2

m[0, 0] = -2 * g
m[0, 1] = 1 * g
m[N - 1, N - 1] = -2 * g
m[N - 1, N - 2] = 1 * g

for i in range(1, N - 1):
    m[i, i - 1] = 1 * g
    m[i, i] = -2 * g
    m[i, i + 1] = 1 * g

for i in range(2, 10):
    m[0, i] = 0

# create matrix corresponding to the potential with the following shape:
# (V1                 )
# (   V2              )
# (      V3           )
# (       ...         )
# (            VN-1   )
# (                 VN)

vdiag = []
l = 0

for i in range(0, N - 1):
    vdiag.append(-2 / x[i] + l * (l + 1) / (x[i] ** 2))

v = np.zeros((N, N))
np.fill_diagonal(v, vdiag)

# add matrices to get eigenvalue equation: H*R(x) = E*R(x)
H = np.zeros((N, N))

H = m + v



# determine eigenvalues and eigenvectors
energies, wavefcts = eig(H)

energies[0] = energies[N-1] = 0

E = np.sort(energies)