In [1]:
import matplotlib.pyplot as plt
%matplotlib inline
from pymatgen.util.plotting_utils import get_publication_quality_plot

In [2]:
import numpy as np
import pandas as pd

In [3]:
ls


Q9.ipynb           Si_50_9_10.22.out  Si_50_9_10.28.out  Si_50_9_10.32.out  Si_50_9_10.35.out  Si_50_9_10.38.out  Si_50_9_10.42.out  Si_50_9_10.48.out  Si_50_9_10.75.out  Si_50_9_9.5.out    run_pw.py*
Si_50_9_10.1.out   Si_50_9_10.24.out  Si_50_9_10.3.out   Si_50_9_10.33.out  Si_50_9_10.36.out  Si_50_9_10.39.out  Si_50_9_10.44.out  Si_50_9_10.5.out   Si_50_9_10.out     analyze.py*
Si_50_9_10.2.out   Si_50_9_10.26.out  Si_50_9_10.31.out  Si_50_9_10.34.out  Si_50_9_10.37.out  Si_50_9_10.4.out   Si_50_9_10.46.out  Si_50_9_10.7.out   Si_50_9_6.out      results.csv

In [4]:
datafile = pd.read_csv('results.csv')

In [5]:
datafile.head(0)


Out[5]:
filename ecut nkpts alat energy total_force cpu_time
0 Si_50_9_9.5.out 50 35 9.50 -89.242348 0 2.4
1 Si_50_9_10.out 50 35 10.00 -89.285942 0 3.2
2 Si_50_9_10.1.out 50 35 10.10 -89.288451 0 5.9
3 Si_50_9_10.2.out 50 35 10.20 -89.289287 0 9.2
4 Si_50_9_10.22.out 50 35 10.22 -89.289271 0 9.4
5 Si_50_9_10.24.out 50 35 10.24 -89.289192 0 9.6
6 Si_50_9_10.26.out 50 35 10.26 -89.289054 0 9.5
7 Si_50_9_10.28.out 50 35 10.28 -89.288863 0 9.5
8 Si_50_9_10.3.out 50 35 10.30 -89.288612 0 9.6
9 Si_50_9_10.31.out 50 35 10.31 -89.288465 0 8.1
10 Si_50_9_10.32.out 50 35 10.32 -89.288305 0 4.8
11 Si_50_9_10.33.out 50 35 10.33 -89.288132 0 4.8
12 Si_50_9_10.34.out 50 35 10.34 -89.287945 0 4.9
13 Si_50_9_10.35.out 50 35 10.35 -89.287745 0 4.8
14 Si_50_9_10.36.out 50 35 10.36 -89.287532 0 4.8
15 Si_50_9_10.37.out 50 35 10.37 -89.287305 0 4.8
16 Si_50_9_10.38.out 50 35 10.38 -89.287066 0 4.9
17 Si_50_9_10.39.out 50 35 10.39 -89.286815 0 4.8
18 Si_50_9_10.4.out 50 35 10.40 -89.286550 0 4.8
19 Si_50_9_10.42.out 50 35 10.42 -89.285987 0 4.8
20 Si_50_9_10.44.out 50 35 10.44 -89.285372 0 4.8
21 Si_50_9_10.46.out 50 35 10.46 -89.284709 0 4.9
22 Si_50_9_10.48.out 50 35 10.48 -89.284000 0 4.8
23 Si_50_9_10.5.out 50 35 10.50 -89.283244 0 4.9
24 Si_50_9_10.7.out 50 35 10.70 -89.273379 0 4.9
25 Si_50_9_10.75.out 50 35 10.75 -89.270314 0 4.9

In [6]:
datafile.ix[datafile['energy'].idxmin()]


Out[6]:
filename       Si_50_9_10.2.out
ecut                         50
nkpts                        35
alat                       10.2
energy                -89.28929
total_force                   0
cpu_time                    9.2
Name: 3, dtype: object

In [7]:
datafile_mod = datafile[(datafile['alat']>9.5) & (datafile['alat']<11.5)]

In [56]:
datafile_mod.head()


Out[56]:
filename ecut nkpts alat energy total_force cpu_time
1 Si_50_9_10.out 50 35 10.00 -93.445675 0 3.8
2 Si_50_9_10.1.out 50 35 10.10 -93.450191 0 5.3
3 Si_50_9_10.2.out 50 35 10.20 -93.452963 0 5.2
4 Si_50_9_10.22.out 50 35 10.22 -93.453322 0 5.4
5 Si_50_9_10.24.out 50 35 10.24 -93.453618 0 5.4

In [8]:
x = datafile_mod['alat'].tolist()
x


Out[8]:
[10.0,
 10.1,
 10.199999999999999,
 10.220000000000001,
 10.24,
 10.26,
 10.279999999999999,
 10.300000000000001,
 10.31,
 10.32,
 10.33,
 10.34,
 10.35,
 10.359999999999999,
 10.369999999999999,
 10.380000000000001,
 10.390000000000001,
 10.4,
 10.42,
 10.44,
 10.460000000000001,
 10.48,
 10.5,
 10.699999999999999,
 10.75]

In [9]:
y_energy = datafile_mod['energy'].tolist()
# y_conver = datafile['Force Difference (meV/Angstrom)'].tolist()

In [11]:
fig, ax0=plt.subplots(nrows=1)
fig.set_size_inches(10,10)

ax0.scatter(x, y_energy,marker='o',alpha=0.75,s=60,c='r')
ax0.plot(x,y_energy,c='black')
ax0.set_title('Energy VS Lattice Constant',fontsize=30,y=1.05)
ax0.set_xlabel('Lattice Parameter (a.u)',fontsize=24)
ax0.set_ylabel(r'Total Energy (Ry)',fontsize=20)
# ax0.set_ylim(-93.456,-93.44)
ax0.tick_params(labelsize = 18)
ax0.annotate('Lowest Energy: 10.33 a.u.', xy=(10.33, -93.45421),  xycoords='data',
                xytext=(-50, -30), textcoords='offset points',
                arrowprops=dict(arrowstyle="->",
                                connectionstyle="angle3,angleA=0,angleB=-90"),fontsize=15
                )

# ax1.scatter(x,y_conver,marker='o',alpha=0.75, s=60,c='b')
# ax1.plot(x,y_conver,c='black')
# ax1.set_title('Force Convergence Vs K-points',fontsize=24,y=1.05)
# ax1.set_xlabel('# of K-points',fontsize=24)
# ax1.set_ylabel(r'Force Converge $meV/\AA$',fontsize=18)
# # ax1.set_yscale('log')
# ax1.set_ylim(-1,40)
# ax1.annotate(r'Convergence < 5 $meV/\AA$ # Kpoints: 205', xy=(207, 5),  xycoords='data',
#                 xytext=(0.95, 0.95), textcoords='axes fraction',
#                 arrowprops=dict(facecolor='black', shrink=0.05),
#                 horizontalalignment='right', verticalalignment='top',fontsize=16
#                 )
# ax1.tick_params(labelsize = 18)

plt.subplots_adjust(hspace=0.5)
plt.show()



In [17]:



Out[17]:
<matplotlib.text.Text at 0x10891e9d0>

In [18]:
plt.show()