我是Fortran的新手,必须模拟Rutherford Scattering实验才能完成任务。在代码中,假设金核处于中心(x,y)=(0,0)。我试图根据Coloumb定律找到α粒子的加速度,速度和距离。 r_lim意味着边界条件,当粒子通过时,循环意味着成功停止。如果我能解释别的,请告诉我。
PROGRAM rutherford_scatter
IMPLICIT NONE
TYPE particle
REAL:: x,y
END TYPE particle
TYPE(particle):: r_alpha, v_alpha, a_alpha
REAL:: x_0,y_0, v_0, q_gold, q_alpha, k_e, m_alpha, c, c_frac, time_step, r_lim
LOGICAL :: check = .FALSE.
k_e = 1.0
c = 137.053999
time_step = 1.0 *10.0**(-5.0)
q_alpha = 2.0
q_gold = 79.0
m_alpha = 7294.3
WRITE (*,*) 'Enter initial value for x distance.'
READ (*,*) x_0
y_0 = -0.005
WRITE (*,*) 'Enter initial value for velocity (fraction of speed of light).'
READ (*,*) c_frac
v_0 = c_frac * c
r_alpha%x = x_0
r_alpha%y = y_0
r_lim = 1.1 * SQRT(r_alpha%x**2+r_alpha%y**2)
v_alpha%x = 0
v_alpha%y = ABS(v_0)
OPEN (11, FILE = 'assign_11.out')
DO WHILE (check)
a_alpha = acceleration(k_e, m_alpha, q_gold, q_alpha, r_alpha)
v_alpha = velocity (v_alpha, a_alpha)
r_alpha = distance (r_alpha, v_alpha)
WRITE (11,*) r_alpha
IF (r_alpha%x .GT. r_lim .OR. r_alpha%y .GT. r_lim) THEN
check =.TRUE.
END IF
END DO
CLOSE(11)
CONTAINS
TYPE (particle) FUNCTION acceleration (k_e, m_alpha, q_gold, q_alpha,r_alpha)
TYPE (particle), INTENT(IN):: r_alpha
REAL, INTENT (IN)::k_e, m_alpha, q_gold, q_alpha
acceleration%x = (k_e/m_alpha) * ((q_gold * q_alpha)/(ABS(r_alpha%x))**2 )* (r_alpha%x/SQRT(r_alpha%x**2+r_alpha%y**2))
acceleration%y = (k_e/m_alpha) * ((q_gold * q_alpha)/(ABS(r_alpha%y))**2 )*(r_alpha%y/SQRT(r_alpha%x**2+r_alpha%y**2))
END FUNCTION
TYPE (particle) FUNCTION velocity (v_alpha, a_alpha)
TYPE (particle), INTENT (IN):: a_alpha, v_alpha
velocity%x = v_alpha%x + a_alpha%x*time_step
velocity%y = v_alpha%y + a_alpha%y* time_step
END FUNCTION
TYPE(particle) FUNCTION distance (r_alpha, v_alpha)
TYPE (particle), INTENT (IN):: r_alpha, v_alpha
distance%x = r_alpha%x + v_alpha%x * time_step
distance%y = r_alpha%y + v_alpha%y * time_step
END FUNCTION
END PROGRAM rutherford_scatter