In [3]:
f2 = open('N-NAAI.dat', 'r');
lines = f2.readlines();
f2.close();
g1 = []
for line in lines:
    p = line.split()
    if len(p) > 1:
        g1.append([float(p[0]),float(p[1])]) 
f2 = open('rdfAALow.dat', 'r');
lines = f2.readlines();
f2.close();
g2 = []
for line in lines:
    p = line.split()
    if len(p) > 1:
        g2.append([float(p[0]),float(p[1])]) 
f2 = open('rdfAAhigh.dat', 'r');
lines = f2.readlines();
f2.close();
g3 = []
for line in lines:
    p = line.split()
    if len(p) > 1:
        g3.append([float(p[0]),float(p[1])])

In [168]:
%pylab inline
gn1 = np.array(g1)
gn2 = np.array(g2)
gn3 = np.array(g3)
rx3 = 10*gn3[130:340,0]
ry3 = gn3[130:340,1]
len(gn1[:,1])
spc = np.linspace(10*gn3[130,0],10*gn3[340,0],30)
itp = np.interp(spc,rx3, ry3)


Populating the interactive namespace from numpy and matplotlib

In [189]:
plt.figure(figsize=(8,6), dpi=80)
plt.axis([0, 20, 0,6])
plt.xlabel(r'$r,\  (\AA)$',fontsize=20)
plt.ylabel(r'$g(r),\  RDF$',fontsize=20)
plt.plot(10*gn2[:,0],gn2[:,1],'r-', label="Low")
plt.plot(10*gn1[:,0],gn1[:,1],'g-', label="Intermediate")
plt.plot(10*gn3[:,0],gn3[:,1],'b-', label="High")
plt.legend(loc='upper right')
savefig("rdfAA.pdf",bbox_inches='tight', dpi=300)



In [186]:
yg=[]
for i in xrange(len(rx2)):
    yg.append(ry2[i]*(rx2[i]*0.1)**2)
inte3 = np.trapz(yg,rx2)
print 4*np.pi*inte3*977.706
inte1 = np.trapz(ry,rx)
print inte3
inte2 = np.trapz(ry2,rx2)
print inte2


44026.0715278
3.58337113026
13.4514275834

In [114]:


In [ ]: