Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.00 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Spyder Editor
  4.  
  5. This is a temporary script file.
  6. """
  7. from scipy import *
  8. import numpy as np
  9. import matplotlib.pyplot as plt
  10.  
  11. #Task 1
  12.  
  13. xmin=-8    #-16 for excited state
  14. xmax=-xmin
  15. Nsteps=1001 #2001 for excited state
  16. alpha=1.0
  17. VO=4.0
  18.  
  19. X=np.linspace(xmin,xmax,Nsteps)
  20. Y=np.linspace(0,0,Nsteps)
  21. h=(X[1]-X[0])
  22.  
  23. B=[]
  24.  
  25. for i in range(Nsteps):
  26.     B.append((-VO)*np.exp(-alpha*(X[i]**2)))
  27. Vx=np.asarray(B)
  28. E=-2.774534188
  29.  
  30.  
  31. k=np.sqrt(-2*E)
  32. Y[0]=1
  33. Y[1]=np.exp(k*h)
  34. C=[]
  35. Fx=2*(Vx-E)
  36.  
  37.  
  38.  
  39. for i in range(Nsteps-2):
  40.     Y[i+2]=(2+(h**2)*Fx[i+1])*Y[i+1]-Y[i]
  41. plt.plot(X,Y)
  42.  
  43. """
  44. ##Task 2 a)
  45. xO=1.5
  46. xmin=-16    
  47. xmax=-xmin
  48. Nsteps=2001
  49. alpha=1.0
  50. VO=2.0
  51.  
  52. X=np.linspace(xmin,xmax,Nsteps)
  53. Y=np.linspace(0,0,Nsteps)
  54. h=(X[1]-X[0])
  55.  
  56. B=[]
  57.  
  58. for i in range(Nsteps):
  59.    B.append((-VO)*((np.exp(-alpha*((X[i]-xO)**2)))+(np.exp(-alpha*((X[i]+xO)**2)))))
  60. Vx=np.asarray(B)
  61. E=-1.259666848796
  62. k=np.sqrt(-2*E)
  63. Y[0]=1
  64. Y[1]=np.exp(k*h)
  65. C=[]
  66. Fx=2*(Vx-E)
  67.  
  68.  
  69.  
  70. for i in range(Nsteps-2):
  71.    Y[i+2]=(2+(h**2)*Fx[i+1])*Y[i+1]-Y[i]
  72. plt.plot(X,Y)
  73.  
  74.  
  75. #Task 2 b)
  76. xO=1.5
  77. xmin=-16    
  78. xmax=-xmin
  79. Nsteps=2001
  80. alpha=1.0
  81. VO=4.0
  82.  
  83. X=np.linspace(xmin,xmax,Nsteps)
  84. Y=np.linspace(0,0,Nsteps)
  85. h=(X[1]-X[0])
  86.  
  87. B=[]
  88.  
  89. for i in range(Nsteps):
  90.    B.append((-VO)*((np.exp(-alpha*((X[i]-xO)**2)))+(np.exp(-alpha*((X[i]+xO)**2)))))
  91. Vx=np.asarray(B)
  92. E=-0.586826045
  93. k=np.sqrt(-2*E)
  94. Y[0]=1
  95. Y[1]=np.exp(k*h)
  96. C=[]
  97. Fx=2*(Vx-E)
  98.  
  99.  
  100.  
  101. for i in range(Nsteps-2):
  102.    Y[i+2]=(2+(h**2)*Fx[i+1])*Y[i+1]-Y[i]
  103. plt.plot(X,Y)
  104.  
  105. #A and W
  106. E_g = [-3.101693348, -1.251364587, -2.890853493, -1.130936465, -2.813694387, -1.005513342]
  107. E_e = [-2.715730925, -0.376767602, -2.736275220, -0.49283514, -2.754089237, -0.586826045]
  108. E0_e=-0.78401783878
  109. E0_g=-2.774534188
  110. W=[]
  111. A=[]
  112. for i in range(6):
  113.    if i%2 ==0:
  114.        W.append((E_g[i]-E_e[i])/2)
  115.        A.append(E0_g - E_g[i] + W[i])
  116.    else:
  117.        W.append((E_g[i]-E_e[i])/2)
  118.        A.append(E0_e - E_g[i] + W[i])
  119.        
  120. print(W)
  121. print(A)
  122. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement