薛定谔方程
请不要心脏骤停,这里只是复制粘贴一下,本文主要是画图,和解方程没有任何关系
− ℏ 2 2 μ ∇ 2 ψ + V ( r ) ψ = E ψ , V ( r ) = − e 2 r π ϵ 0 r -\frac{\hbar^2}{2\mu}\nabla^2\psi+V(r)\psi=E\psi,\quad V(r)=-\frac{e^2}{r\pi\epsilon_0r} −2μℏ2∇2ψ+V(r)ψ=Eψ,V(r)=−rπϵ0re2
使用球坐标,将Laplace算子展开
− ℏ 2 2 μ r 2 { ∂ ∂ r ( r 2 ∂ ∂ r ) + 1 sin 2 θ [ sin θ ∂ ∂ θ ( sin θ ∂ ∂ θ ) + ∂ 2 ∂ ϕ 2 ] } ψ − e 2 r π ϵ 0 r = E ψ -\frac{\hbar^2}{2\mu r^2}\{\frac{\partial}{\partial r}(r^2\frac{\partial}{\partial r})+\frac{1}{\sin^2\theta}[\sin\theta\frac{\partial}{\partial\theta}(\sin\theta\frac{\partial}{\partial\theta})+\frac{\partial^2}{\partial\phi^2}]\}\psi-\frac{e^2}{r\pi\epsilon_0r}=E\psi −2μr2ℏ2{∂r∂(r2∂r∂)+sin2θ1[sinθ∂θ∂(sinθ∂θ∂)+∂ϕ2∂2]}ψ−rπϵ0re2=Eψ
其解为径向函数和球谐函数的乘积
ψ ( r , θ , ϕ ) = R n l ( r ) Y l m ( θ , ϕ ) \psi(r,\theta,\phi)=R_{nl}(r)Y_{lm}(\theta,\phi) ψ(r,θ,ϕ)=Rnl(r)Ylm(θ,ϕ)
其中
Y
l
m
Y_{lm}
Ylm是球谐函数,在scipy
中有定义,可直接调用sph_harm
,
R
n
l
R_{nl}
Rnl可以继续展开为
R n l = ( 2 n a ) 3 ( n − l − 1 ) ! 2 n [ ( n + l ) ! ] 3 e − r n a ( 2 r n a ) l L n − l − 1 2 l + 1 ( 2 r n a ) R_{nl}=\sqrt{(\frac{2}{na})^3\frac{(n-l-1)!}{2n[(n+l)!]^3}}e^{-\frac{r}{na}}(\frac{2r}{na})^lL^{2l+1}_{n-l-1}(\frac{2r}{na}) Rnl=(na2)32n[(n+l)!]3(n−l−1)!e−nar(na2r)lLn−l−12l+1(na2r)
其中 a a a是玻尔半径0.53 A ˚ \text{\r{A}} A˚,在写代码是带入0.53,表示整个模型以埃米为单位。
Python实现
L
n
−
l
−
1
2
l
+
1
L^{2l+1}_{n-l-1}
Ln−l−12l+1是拉盖尔多项式,在scipy
中同样有定义,可直接调用assoc_laguerre
import numpy as np
import scipy.special as ss
def hydrogen(n,l,m,r,th,phi):
na = 0.53*n
tmp = (2/na)**3
tmp *= ss.factorial(n-l-1)
tmp /= 2*n*ss.factorial(n+l)**3
tmp2 = np.exp(-r/na) * (2*r/na)**l
laguerre = ss.assoc_laguerre(2*r/na, n-l-1, 2*l+1)
R_nl = np.sqrt(tmp)*tmp2*laguerre
return R_nl*ss.sph_harm(m,l,th,phi)
接下来生成一个主量子数为1,角量子数、磁量子数皆为0的电子云,由于在随机生成坐标点时,越是靠近原点,坐标点越密集,所以通过距离调整概率
from itertools import product
rs = np.arange(50)/50
ths = np.arange(0, np.pi*2, 0.1)
phis = np.arange(0, np.pi, 0.1)
pts = []
for axis in product(rs, ths,phis):
p = hydrogen(1,0,0,*axis)**2
if p*axis[0]**2 > np.random.rand()/2:
pts.append(axis)
绘图
import matplotlib.pyplot as plt
def pts2xyz(pts):
r, th, phi = zip(*pts)
x = r*np.sin(phi)*np.cos(th)
y = r*np.sin(phi)*np.sin(th)
z = r*np.cos(phi)
return x,y,z
x,y,z = pts2xyz(pts)
ax = plt.subplot(projection='3d')
ax.scatter(x, y, z, marker='.')
plt.show()
效果如下,至少可以看出,随着半径的增加,电子出现的概率越来越小
更复杂的电子云
接下来看一下2p1的情况,考虑到能级越高越不稳定,即出现的概率越低,所以对随机数的量级进行调整。又考虑到等间隔生成坐标点,过于刻意,所以随机生成坐标点
from numpy.random import rand
def getPts(n, l, m, N, rMax, randMax):
r = rand(N)*rMax
th = rand(N)*np.pi*2
phi = rand(N)*np.pi
pts = []
for axis in zip(r,th,phi):
p = hydrogen(n, l, m,*axis)**2
if p*axis[0]**2 > np.random.rand()*randMax:
pts.append(axis)
print(len(pts))
return pts
pts = getPts(2, 1, 1, 200000, 5, 1/200)
x,y,z = pts2xyz(pts)
ax = plt.subplot(projection='3d')
ax.scatter(x, y, z, marker='.')
plt.show()
效果为
继续看更高的能级
pts = getPts(3, 2, 2, 200000, 15, 1/1e5)
x,y,z = pts2xyz(pts)
ax = plt.subplot(projection='3d')
ax.scatter(x, y, z, marker='.')
plt.show()
如果把主量子数为3,角量子数为2的所有电子云悉数画出,则效果如下
fig = plt.figure()
ax0 = fig.add_subplot(231,projection='3d')
ms = [0,-1,1,-2,2]
cs = ['r', 'g', 'b', 'c', 'y']
for i in range(5):
ax = fig.add_subplot(2,3,i+2,projection='3d')
pts = getPts(4, 2, ms[i], 50000, 25, 1/1e7)
x,y,z = pts2xyz(pts)
ax0.scatter(x, y, z, marker='.', c=cs[i])
ax.scatter(x, y, z, marker='.', c=cs[i])
plt.xticks([])
plt.yticks([])
plt.show()
效果如图所示