In [2]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [3]:
f2 = open('invdev45nns.dat', 'r');
lines = f2.readlines();
f2.close();
k = []
for line in lines:
    p = line.split()
    if len(p) > 1:
        k.append([float(p[0]),float(p[1])]) 
d = np.array(k)
f2 = open('invpots45nns.dat', 'r');
lines = f2.readlines();
f2.close();
p = []
t = lines[0].split()
l1 = int(t[0])
lines.pop(0)
for i in xrange(l1):
    graph = []
    t = lines[0].split()
    l2 = int(t[0])
    lines.pop(0)
    for w in xrange(l2):
        t = lines[0].split()
        graph.append([float(t[0]),float(t[1])])
        lines.pop(0)
    p.append(graph) 
f2 = open('invrdfs45nns.dat', 'r');
lines = f2.readlines();
f2.close();
r = []
t = lines[0].split()
l1 = int(t[0])
lines.pop(0)
for i in xrange(l1):
    graph = []
    t = lines[0].split()
    l2 = int(t[0])
    lines.pop(0)
    for w in xrange(l2):
        t = lines[0].split()
        graph.append([float(t[0]),float(t[1])])
        lines.pop(0)
    r.append(graph)

In [6]:
import matplotlib.cm as cm
plt.figure(figsize=(20,12), dpi=300)

plt.subplot2grid((12,2), (0,0) , rowspan=8)
plt.xlabel(r'$r,\  (\AA)$',fontsize=20)
plt.ylabel(r'$\mathcal{U}(r),\ (\frac{kJ}{mol})$',fontsize=20)
plt.axis([3, 14, -2.5,10])
catch = 19
for i in xrange(len(p)):
    if(i % 2 == 0 and i != catch):
        c = cm.Greens(0.1+(((20*(i))/float(len(p)))/10),1)
        g = np.array(p[i])
        plt.plot(g[:,0],g[:,1],label=i+1,color=c)
g = np.array(p[catch])
plt.plot(g[:,0],g[:,1],'r-',label=i+1)
plt.subplot2grid((12,2), (0,1) , rowspan=8)
plt.xlabel(r'$r,\  (\AA)$',fontsize=20)
plt.ylabel(r'$g(r),\  RDF$',fontsize=20)
plt.axis([0, 14, 0,4])
for i in xrange(len(r)):
    if(i % 2 == 0 and i != catch):
        c = cm.Greens(0.1+(((20*(i))/float(len(p)))/10),1)
        g = np.array(r[i])
        plt.plot(g[:,0],g[:,1],label=i+1,color=c)
g = np.array(r[catch])
plt.plot(g[:,0],g[:,1],'r-',label=catch+1)
plt.legend( title='Step',loc='upper left')
plt.subplot2grid((12,2), (9,0) , rowspan=3, colspan=2)
plt.yscale('log')
plt.plot(d[:,0],d[:,1],'go')
plt.plot(d[catch,0],d[catch,1],'ro')
for i,j in zip(d[:,0],d[:,1]):
    plt.annotate('%0.2f'%(j),rotation=90,xy=(i-0.40,j))
plt.xlabel(r'$Inversion \ steps$',fontsize=20)
plt.ylabel(r'$RDF \ Deviation$',fontsize=20)
plt.xlim([0, 40])
plt.xticks(xrange(41))
savefig("Conv45nns.png",bbox_inches='tight', dpi=300)
plt.show()



In [5]:


In [ ]: