Advertisement
Guest User

Code_0344

a guest
May 26th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. import matplotlib.mlab as mlab
  4. import math
  5. import pandas as pd
  6. from pylab import *
  7. import csv
  8.  
  9. def N(y):
  10. BF = np.zeros(len(y))
  11. i=0
  12. q=0
  13. while i < len(y):
  14. BF[i] = math.exp((-y[i])/(k*t))*n
  15. q = q + BF[i]/n
  16. i = i+1
  17. return BF/q, q
  18.  
  19. def BF(i):
  20. i=0
  21. while i< len(y0+1):
  22. i=i+1
  23. print BF[i]
  24.  
  25. def make_plot(y_list):
  26. fig = plt.figure()
  27. for i in range(0,3):
  28. for j in range(0,3):
  29. y = y_list[j*3+i]
  30. BF,q = N(y)
  31. ax = fig.add_subplot(3,3,j*3+i+1)
  32. Phi = np.arange(-180,+166, 15)
  33. ax.plot(Phi, y, 'o-r', lw=2)
  34. ax.set_xlim([-180,166])
  35. #ax.set_xlabel('\'Torsion angle')
  36. # Make the y-axis label and tick labels match the line color.
  37. #ax.set_ylabel('Energy kcal/mol', color='r')
  38. for tl in ax.get_yticklabels():
  39. tl.set_color('r')
  40.  
  41. ax0b = ax.twinx()
  42. ax0b.plot(Phi, BF, 'sb-')
  43. plt.fill_between(Phi,BF,0,alpha='0.25')
  44. ax0b.set_xlim([-180,166])
  45. #ax0b.set_ylabel('Pop%', color='b')
  46. for tl in ax0b.get_yticklabels():
  47. tl.set_color('b')
  48. plt.show()
  49.  
  50. #Variables and Boltzmann Constant:
  51. k=0.00199
  52. t=298.15
  53. n=100.0
  54.  
  55. #************************************--------------****************************
  56. #.............................((((Creating Figures)))).........................
  57. #************************************--------------****************************
  58.  
  59.  
  60. afile = open('~/Desktop/GSK_Rel_Energ.csv', 'r+')
  61.  
  62.  
  63. y=[]
  64.  
  65. for line in afile:
  66. Temp= line.strip().split(",")
  67. numbers = []
  68. for num in Temp:
  69. num = num.replace("[", "").replace("]", "")
  70. numbers.append(float(num))
  71. y.append(numbers)
  72.  
  73. ilist = range(0,9)
  74.  
  75. figure(1, figsize=(3, 3))
  76. title('Figures(0-8)', bbox={'facecolor': '0.8', 'pad': 5})
  77. make_plot([y[i] for i in ilist])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement