본문 바로가기
Project/Python

3. Report2 [hydrogen atom wave function]

by sonpang 2021. 10. 22.
반응형

After receiving feedback that it is difficult to draw graphs in C, I completed it in Python.

 

Size is the same concept as the value of x to be checked. In other words, the check is performed only within the bore radius, and it is a variable that determines how many equal parts the bore radius is divided. At this time, the reason for checking only within the Bohr radius is that the Bohr radius means the radius of the hydrogen atom in the ground state in the Bohr model. It is meaningless to calculate the electron existence wave function or probability density function in the range outside the radius.

 

print('시작에 앞서 이 시뮬레이션은 1분이상의 시간이 계산에 소요됨을 알려드립니다. \n')
print('따라서 그래프가 출력되는 시간이 지연될 수 있습니다. \n')
print('시뮬레이션을 위한 data입력을 요청합니다 적당한 값과 차이가 크면 결과가 도출되지 않을 수 있습니다\n')
size=int(input('size를 입력해 주십시오 적당한 시뮬레이션의 size는 500입니다\n'))
l1=int(input('각운동량을 입력해 주십시오 수소원자의 각운동량은 0입니다\n')) #각 운동량은 바닥상태일 때 0이다.
xmes=float(input('구간간격을 입력해 주십시오 적당한 시뮬레이션의 구간간격은 0.01입니다\n'))
error=float(input('파동함수를 계산할 때 수치해석적 방법에 비해 허용할 오차를 입력해 주십시오 적당한 오차는 0.01입니다 \n'))
print('여기서 0.01=1%를 의미하는 것이 아니고 차이를 비교하는 실수 값입니다. 큰 범위를 허용하면 에너지 측정부터 오차가 발생할 수 있습니다.\n')
print('작은 범위를 허용하면 경계조건 검사(틀맞춤)에서 오차가 발생하여 Potential Energy graph만 출력할 수 있습니다.')

Substitute basic constants in units that are convenient for substituting into expressions. At this time, constants refer to university physics books. For the other variable called ymg, after learning the code to find the solution of the differential equation from computational physics [Hyunjin Choi] implemented with the reference Visual C++ 6.0, an appropriate constant value was substituted. The Numerov method is a method not mentioned in the above references. The Numerov method is the method learned in the self-inquiry activity.

 

nmat=100 #matching radius가 보어반지름 정도 되게함
nmp2=nmat+2 #파동함수를 미분할 때 필요함
nmm2=nmat-2 #파동함수를 미분할 때 필요함
nxmin=1 #파동함수를 계산하는 첫지점
nxmax=400 #파동함수를 계산할때 무한대지점

redm=prm*elm/(prm+elm) #전자와 양성자의 reduced mass를 계산
bohr=hbarc*hbarc/(redm*ee) #해 계산에 사용하는 보어반지름 계산
for nx in range(nxmin, nxmax+1): #퍼텐셜에너지를 r=0~무한대까지 계산

Calculate the electrical potential energy. It is the same value as the potential energy mentioned earlier. This is because the potential energy in the atomic model usually only considers the energy generated by the electrical component. Electric potential energy is the potential energy generated by a change in the electrostatic force generated between charges placed in a defined physical system.

ecm=-20.0*0.001 #수소원자의 에너지 고유값을 -20eV부터 찾음  keV 
de = 0.05*0.001 #수소원자 에너지 고유값은 경계조건이 만족되는 경우여야 하므로 경계조건이 성립할 때까지 에너지를 de미소에너지만큼씩 변화시킴  keV
nemx=400 #닫힌계 (퍼텐셜우물)이어야 하므로, 에너지가 0보다 커질 수 없으므로 0보다 작게함

Since the potential energy has been calculated, the process of deriving the wave function begins by calculating the wave equation suitable for the energy.

for ne in range(1, nemx+1): #에너지를 변화시켜가면서 경계조건을 만족하는 지 확인함

The above differential equation can be solved by stoermer's method. It can be seen from the reference literature [Hyunjin Choi] in computational physics implemented with Visual C++ 6.0.

The expression is called log derivative. At this time, the energy eigenvalue can be found by finding the energy that satisfies this equation. When solving a differential equation, give E any value arbitrarily, and then solve by changing E by de until the boundary condition is satisfied. In this case, the frame fitting condition (boundary condition) is used. The five-point formula below used the method used to find the solution of differential equations when learning MATLAB.

 

The derivative of u(i) at the mathching radius using the 5-point formula RATIOI Left-hand side calculation in the log differential equation above The Numerov method is actually simpler to implement than the Stoermer method. Therefore, the Numerov method was used for the log differentiation process because accuracy is required in the integration process with the error range check process.

 

After using the five-point formula described above, the left and right sides of the above color are calculated. At this time, only the values ​​that satisfy the error range are extracted by calculating the difference between the numerical solution and the expected solution. This can be said to be the final confirmation of the boundary condition. The DRAT of the code is calculated by subtracting the right side from the left side to calculate the error. Another method is to subtract the right side from the left side and divide it by the left side again as an error for comparison.

 

Calculation of the right-hand side of the RATIOE log differential equation

 

If the relative error is within the allowable error range, it is close enough to 0, which is considered a satisfactory value. At this time, ecm in the energy code becomes the eigenvalue of the energy, and the wave function at that time is the eigenfunction. If the relative error does not fall within the allowable error range, the boundary condition is not satisfied, so it moves to the next energy and repeats the same process. However, at this time (even up to the Bohr radius), if the eigenvalue of the appropriate energy does not come out even if the ne value of the code goes until the for loop is repeated until nemx+1, the wave function is not calculated. Because the bore radius is made to match the matching radius, it is a meaningless value if the conditional statement is not satisfied in comparison with the numerical analysis solution of the code. In fact, it has been explained earlier that the wave function is meaningless beyond the Bohr radius. For wave functions that are unlikely to exist, the graph is not drawn because the process of calculating the probability density function is also meaningless.

 

Since the unknown constant of u(i)(r)dl is different from the unknown constant of u(i)(r)dl, the ratio is calculated from the matching radius and corrected by the ratio to make it continuous.

  for nx in range(nmat, nxmax+1): #보정과정 틀맞춤을 하기 위해 적분한다.

Since it takes a lot of time to plot up to nxmax, only the value divided by 1.2 was plotted. This is because the probability can be fully grasped three-dimensionally even by plotting only the range up to this level. The parameter function learned in math class was used to convert the graph that was previously output in 2D into a 3D graph. The original goal was to plot all the x and y values ​​that satisfy the circular equation, but as in the previous situation, it takes a lot of time, so a method of plotting only 45 branches using a trigonometric function was taken.

for nx in range(nxmin, int(nxmax/1.2)):

 

반응형

댓글