import numpy as np
import matplotlib.pyplot as plt
from tkinter import Tk, Label, Entry, Button
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
# 상수 정의
hbar = 1.0545718e-34 # Reduced Planck's constant (J·s)
m_e = 9.10938356e-31 # Electron mass (kg)
# 터널링 확률 계산 함수
def tunneling_probability(V0, E, a):
if E >= V0:
return 1 # 에너지가 잠재장벽보다 크면 100% 터널링
alpha = np.sqrt(2 * m_e * (V0 - E)) / hbar
T = np.exp(-2 * alpha * a)
return T
# Tkinter GUI 설정
def calculate_and_plot():
try:
V0 = float(entry_V0.get()) # 잠재장벽의 높이 (J)
E = float(entry_E.get()) # 입자의 에너지 (J)
a = float(entry_a.get()) # 장벽의 두께 (m)
T = tunneling_probability(V0, E, a)
# 그래프 생성
fig, ax = plt.subplots()
energies = np.linspace(0, V0, 100)
probabilities = [tunneling_probability(V0, E, a) for E in energies]
ax.plot(energies, probabilities)
ax.set_title("Quantum Tunneling Probability")
ax.set_xlabel("Particle Energy (J)")
ax.set_ylabel("Tunneling Probability")
ax.grid(True)
# GUI에 그래프 표시
canvas = FigureCanvasTkAgg(fig, master=window)
canvas.draw()
canvas.get_tk_widget().pack()
except ValueError:
label_result.config(text="Invalid input. Please enter valid numbers.")
# Tkinter 창 설정
window = Tk()
window.title("Quantum Tunneling Effect")
Label(window, text="Potential Barrier Height (V0, J):").pack()
entry_V0 = Entry(window)
entry_V0.pack()
Label(window, text="Particle Energy (E, J):").pack()
entry_E = Entry(window)
entry_E.pack()
Label(window, text="Barrier Width (a, m):").pack()
entry_a = Entry(window)
entry_a.pack()
Button(window, text="Calculate and Plot", command=calculate_and_plot).pack()
label_result = Label(window, text="")
label_result.pack()
window.mainloop()
https://www.tistory.com/event/write-challenge-2024
'정보통신기술(ICT)' 카테고리의 다른 글
초전도체 연구에 필요한 양자물리학 기반 뉴트론시스 방정식(Neutronsys Equation) (3) | 2024.11.07 |
---|---|
반데르발스 헤테르구조(Vanderwaals Heterostructures) (3) | 2024.11.06 |
상미분 방정식: 로렌츠 방정식(Lorenz Equations) (3) | 2024.11.04 |
양자역학: 입자상자 문제(Particle in a Box) (3) | 2024.11.01 |
열역학: 볼츠만 분포(Boltzmann Distribution) (0) | 2024.10.31 |