1#!/usr/local/bin/python3.8
2
3# gsm: This script generates Zn2O2.epsinv.png from the output of inteqp
4# using numpy & matplotlib. Parameters are hard-coded into the script.
5
6import sys
7import math
8import numpy
9import matplotlib
10matplotlib.use('Agg')
11import matplotlib.pyplot
12
13path = '3_eps/epsinvomega/'
14fin = ['epsinvRPA_r.dat', 'epsinvRPA_a.dat', 'epsinvGPP_semicore.dat', 'epsinvGPP_valence.dat']
15
16cc = []
17for ii in range(len(fin)):
18    ff = open(path + fin[ii], 'r')
19    cc.append(ff.readlines())
20    ff.close()
21
22mm = len(cc[0])
23curve = []
24for ii in range(len(fin)):
25    for jj in range(2):
26        dd = numpy.empty((2, mm), float)
27        for kk in range(mm):
28            ss = cc[ii][kk].split()
29            dd[0][kk] = float(ss[0])
30            dd[1][kk] = float(ss[jj + 1])
31        curve.append(dd)
32
33omegamin = 0.0
34omegamax = 100.0
35epsmin = -3.0
36epsmax = 3.0
37
38matplotlib.rc('figure', figsize = (8.0, 6.0))
39matplotlib.rc('axes', linewidth = 1.5)
40matplotlib.rc('lines', linewidth = 1.5)
41matplotlib.rc('font', size = 18.0)
42matplotlib.rc('xtick.major', size = 0.0, pad = 8.0)
43matplotlib.rc('xtick.minor', size = 0.0, pad = 8.0)
44matplotlib.rc('ytick.major', size = 6.0, pad = 8.0)
45matplotlib.rc('ytick.minor', size = 3.0, pad = 8.0)
46
47myplot = matplotlib.pyplot.plot(curve[0][0], curve[0][1], 'k-', label = 'RPA')
48myplot = matplotlib.pyplot.plot(curve[6][0], curve[6][1], 'r-', label = r'$\rho_\mathsf{ppm}=\rho_\mathsf{val}$')
49myplot = matplotlib.pyplot.plot(curve[4][0], curve[4][1], 'b-', label = r'$\rho_\mathsf{ppm}=\rho_\mathsf{scf}$')
50
51myaxis = matplotlib.pyplot.axis([omegamin, omegamax, epsmin, epsmax])
52myxlabel = matplotlib.pyplot.xlabel('$\omega$ (eV)')
53myylabel = matplotlib.pyplot.ylabel('Re $\epsilon_{\mathbf{GG}\'}^{-1}(\mathbf{q}; \omega)$')
54mytitle = matplotlib.pyplot.title('$\mathbf{q}=\mathbf{G}=\mathbf{G}\'=\mathbf{0}$')
55mylegend = matplotlib.pyplot.legend(loc = 'best')
56
57matplotlib.pyplot.savefig('Zn2O2.epsinv.png', format = 'png', bbox_inches = 'tight')
58