forked from lxf-gzu/vasp_small_script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pband_plot_ljc_lxf_v4.py
432 lines (380 loc) · 22 KB
/
pband_plot_ljc_lxf_v4.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
#!/usr/bin/python
# -*- coding:utf-8 -*-
"""
@author: V. Wang, Jin-Cheng Liu, Nxu
@file: pband_plot.py
@time: 2018/12/18 20:57
A script to plot PBAND
"""
import numpy as np
import matplotlib as mpl
import os
mpl.use('Agg') # silent mode
from matplotlib import pyplot as plt
import matplotlib.ticker as ticker
import sys
from matplotlib.collections import LineCollection
from matplotlib.gridspec import GridSpec
from matplotlib.lines import Line2D
#------------------- Data Read ----------------------
def getelementinfo():
try:
with open("POSCAR",'r') as reader:
line_s=reader.readlines()
except:
print("No POSCAR found!")
try:
element_s=line_s[5].rstrip('\r\n').rstrip('\n')
elements=element_s.split()
except:
print("POSCAR element line is wrong!")
data = {}
for i in range(len(elements)):
if os.path.exists("PBAND." + elements[i] + ".dat"):
data[elements[i]]=np.loadtxt("PBAND." + elements[i] + ".dat")
elif os.path.exists("PBAND_" + elements[i] + ".dat"):
data[elements[i]]=np.loadtxt("PBAND_" + elements[i] + ".dat")
return data,elements
def getHighSymmetryPoints():
hsp = np.loadtxt("KLABELS", dtype=np.string_, skiprows=1, usecols=(0, 1))
group_labels = hsp[:-1, 0].tolist()
group_labels = [i.decode('utf-8', 'ignore') for i in group_labels]
for index in range(len(group_labels)):
if group_labels[index] == "GAMMA":
group_labels[index] = u"Γ"
return group_labels, hsp
def maxminnorm(a):
amin, amax = a.min(), a.max() # fin maximum minimum
if amax == 0:
return a
else:
a = (a - amin) / (amax - amin) # (value-minimum)/(maximum-minimum)
return a
def getPbandData(data,scaler):
kpt = data[:, 0] # kpath
eng = data[:, 1] # energy level
wgt_s = data[:, 2] * scaler # weight, 20 is enlargement factor
#wgt_s = maxminnorm(wgt_s) * scaler # Normlized
wgt_py = data[:, 3] * scaler # weight, 20 is enlargement factor
#wgt_py = maxminnorm(wgt_py)*scaler
wgt_pz = data[:, 4] * scaler # weight, 20 is enlargement factor
#wgt_pz = maxminnorm(wgt_pz)*scaler
wgt_px = data[:, 5] * scaler # weight, 20 is enlargement factor
#wgt_px = maxminnorm(wgt_px)*scaler
wgt_p = np.array(wgt_py) + np.array(wgt_px) + np.array(wgt_pz)
#wgt_p = maxminnorm(wgt_p) * scaler # Normlized
wgt_dxy = data[:, 6] * scaler
#wgt_dxy = maxminnorm(wgt_dxy) * scaler # Normlized
wgt_dyz = data[:, 7] * scaler
#wgt_dyz = maxminnorm(wgt_dyz) * scaler
wgt_dz2 = data[:, 8] * scaler
#wgt_dz2 = maxminnorm(wgt_dz2) * scaler
wgt_dxz = data[:, 9] * scaler
#wgt_dxz = maxminnorm(wgt_dxz) * scaler
wgt_dx2y2 = data[:, 10] * scaler
#wgt_dx2y2 = maxminnorm(wgt_dx2y2) * scaler
wgt_d = np.array(wgt_dxy) + np.array(wgt_dyz) + np.array(wgt_dz2) \
+ np.array(wgt_dxz) + np.array(wgt_dx2y2)
#wgt_d = maxminnorm(wgt_d) * scaler # Normlized
#wgt_tot = maxminnorm(data[:, 11]) * scaler
wgt_tot = data[:, 11] * scaler
return kpt, eng, wgt_s, wgt_py, wgt_pz, wgt_px, wgt_p, wgt_dxy, \
wgt_dyz, wgt_dz2, wgt_dxz, wgt_dx2y2, wgt_d, wgt_tot
#------------------- Pband Plot ----------------------
class pbandplots(object):
def __init__(self,lwd,op,scaler,energy_limits,font,dpi,figsize,corlor0):
from matplotlib import pyplot as plt
self.data,self.elements=getelementinfo()
self.group_labels, self.hsp = getHighSymmetryPoints() # HighSymmetryPoints_labels
self.x = [float(i) for i in self.hsp[:-1, 1].tolist()] # HighSymmetryPoints_coordinate
self.lwd=lwd ; self.op=op;self.scaler=scaler;self.energy_limits=energy_limits
self.font=font;self.dpi=dpi;self.figsize=figsize
self.corlor0=corlor0
def plotfigure(self,ax, kpt, eng, title):
ax.plot(kpt, eng, color=self.corlor0, lw=self.lwd, linestyle='-', alpha=1)
ax.yaxis.set_minor_locator(ticker.MultipleLocator(0.50))
ax.set_ylim(self.energy_limits)
ytick = np.arange(self.energy_limits[0], self.energy_limits[1], 2)
a = int(len(ytick) / 2)
plt.yticks(np.insert(ytick, a, 0))
ax.set_xticks(self.x)
plt.yticks(fontsize=self.font['size']-2,fontname=self.font['family'])
plt.ylabel(r'$Energy$ (eV)',fontdict=self.font)
plt.suptitle(title)
ax.set_xticklabels(self.group_labels, rotation=0, fontsize=self.font['size']-2,fontname=self.font['family'])
ax.axhline(y=0, xmin=0, xmax=1, linestyle='--', linewidth=0.5, color='0.5')
for i in self.x[1:-1]:
ax.axvline(x=i, ymin=0, ymax=1, linestyle='--', linewidth=0.5, color='0.5')
ax.set_xlim((self.x[0], self.x[-1]))
return plt
def plotPbandcolormap(self):
from matplotlib import pylot as plt
print("start plot Pband with corlor line mode")
fig = plt.figure(figsize=self.figsize)
gs = GridSpec(1, 1)
plt.rcParams['xtick.direction']='in'
plt.rcParams['ytick.direction']='in'
fig.suptitle(r"PBAND")
ax1 = plt.subplot(gs[0])
ax1.set_xticks(self.x)
ax1.spines['left'].set_linewidth(0.3)
ax1.spines['right'].set_linewidth(0.3)
ax1.spines['top'].set_linewidth(0.3)
ax1.spines['bottom'].set_linewidth(0.3)
ax1.set_ylim(self.energy_limits)
ytick = np.arange(self.energy_limits[0], self.energy_limits[1], 2)
a = int(len(ytick) / 2)
plt.yticks(np.insert(ytick, a, 0))
ax1.set_xticklabels(self.group_labels, rotation=0, fontsize=self.font['size']-2,fontname=self.font['family'])
ax1.axhline(y=0, xmin=0, xmax=1, linestyle='--', linewidth=0.5, color='0.5')
for i in self.x[1:-1]:
ax1.axvline(x=i, ymin=0, ymax=1, linestyle='--', linewidth=0.5, color='0.5')
ax.set_xlim((self.x[0], self.x[-1]))
for element in self.elements:
kpt, eng, wgt_s, wgt_py, wgt_pz, wgt_px, wgt_p, wgt_dxy, wgt_dyz, wgt_dz2, wgt_dxz, wgt_dx2y2, wgt_d, wgt_tot \
= getPbandData(self.data[self.elements[elementorder]],self.scaler)
if (np.array(wgt_d) == np.zeros_like(np.array(wgt_d))).all() and (np.array(wgt_p) == np.zeros_like(np.array(wgt_p))).all():
sc=wgt_s**2
pc=0.0
dc=0.0
tot=sc
continue
elif (np.array(wgt_d) == np.zeros_like(np.array(wgt_d))).all() and not (np.array(wgt_p) == np.zeros_like(np.array(wgt_p))).all():
sc=wgt_s**2
pc=wgt_p**2
dc=0.0
tot=sc+pc
continue
elif not (np.array(wgt_d) == np.zeros_like(np.array(wgt_d))).all() and not (np.array(wgt_p) == np.zeros_like(np.array(wgt_p))).all():
sc=wgt_s**2
pc=wgt_p**2
dc=wgt_d**2
tot=sc+pc+dc
if tot !==0.0:
sc0=sc/tot
pc0=pc/tot
dc0=dc/tot
rgbline(ax1,kpt,eng,sc0,pc0,dc0,alpha=1.)
ax1.set_ylabel(r"$E - E_f$ /eV",labelpad=1)
ax1.tick_params(bottom=False,left=True,width=0.2)
plt.savefig('PBAND' + element + 'spd.png',bbox_inches='tight',pad_inches=0.1, dpi=self.dpi)
def plotPbandAllElementsspd(self):
from matplotlib import pyplot as plt
print("start plot PBAND for all Elements with s p d projection in one figure !...")
colorcode = ['blue', 'cyan', 'red', 'green', 'yellow','purple','chartreuse','fuchsia','orangered','hotpink','violet','teal'] #if number of orbitals are more 3,one need increase the number of colors in "colorcode"
markerorder=['o','v','p','*','>','s','1','2','3','4','x','+']
fig = plt.figure(figsize=self.figsize)
ax = fig.add_subplot(111)
legend_s=[]
for elementorder in range(len(self.elements)):
kpt, eng, wgt_s, wgt_py, wgt_pz, wgt_px, wgt_p, wgt_dxy, wgt_dyz, wgt_dz2, wgt_dxz, wgt_dx2y2, wgt_d, wgt_tot \
= getPbandData(self.data[self.elements[elementorder]],self.scaler)
if (np.array(wgt_d) == np.zeros_like(np.array(wgt_d))).all() and (np.array(wgt_p) == np.zeros_like(np.array(wgt_p))).all():
ax.scatter(kpt, eng, s=wgt_s, color=colorcode[elementorder], edgecolor=colorcode[elementorder], linewidths=0.2,\
alpha=op*0.8,marker=markerorder[elementorder])
legend_s.append('$' + self.elements[elementorder] + '$'+'$(s)$')
continue
elif (np.array(wgt_d) == np.zeros_like(np.array(wgt_d))).all() and not (np.array(wgt_p) == np.zeros_like(np.array(wgt_p))).all():
ax.scatter(kpt, eng, s=wgt_s, color=colorcode[2*elementorder], edgecolor=colorcode[2*elementorder], linewidths=0.2,\
alpha=op*0.8,marker=markerorder[2*elementorder])
ax.scatter(kpt, eng, s=wgt_p,color=colorcode[2*elementorder+1], edgecolor=colorcode[2*elementorder+1], linewidths=0.2,\
alpha=op*0.6,marker=markerorder[2*elementorder+1])
legend_s.append('$' + self.elements[elementorder] + '$'+'$(s)$')
legend_s.append('$' + self.elements[elementorder] + '$'+'$(p)$')
continue
elif not (np.array(wgt_d) == np.zeros_like(np.array(wgt_d))).all() and not (np.array(wgt_p) == np.zeros_like(np.array(wgt_p))).all():
ax.scatter(kpt, eng, s=wgt_s, color=colorcode[3*elementorder], edgecolor=colorcode[3*elementorder], linewidths=0.2,\
alpha=op*0.8,marker=markerorder[3*elementorder])
ax.scatter(kpt, eng, s=wgt_p,color=colorcode[3*elementorder+1], edgecolor=colorcode[3*elementorder+1], linewidths=0.2,\
alpha=op*0.6,marker=markerorder[3*elementorder+1])
ax.scatter(kpt, eng, s=wgt_d, color=colorcode[3*elementorder+2], edgecolor=colorcode[3*elementorder+2],linewidths=0.2,\
alpha=op*0.4,marker=markerorder[3*elementorder+2])
legend_s.append('$' + self.elements[elementorder] + '$'+'$(s)$')
legend_s.append('$' + self.elements[elementorder] + '$'+'$(p)$')
legend_s.append('$' + self.elements[elementorder] + '$'+'$(d)$')
continue
ax.legend(tuple(legend_s),loc='best', shadow=False, labelspacing=0.1)
title0=" "
for atom in range(len(self.elements)):
title0=self.elements[atom] + title0
plt = self.plotfigure(ax, kpt, eng, title0+' orbital progection' )
plt.subplots_adjust(top=0.950,bottom=0.110,left=0.165,right=0.855,wspace=0)
plt.savefig('PBND'+title0.rstrip('\r\n').rstrip()+'spd.png', dpi=1000)
#del ax, fig
def plotPbandspd(self):
from matplotlib import pyplot as plt
print("start plot PBAND for each Elements with s p d projection...")
for element in self.elements:
print("plot ", element)
fig = plt.figure(figsize=self.figsize)
ax = fig.add_subplot(111)
kpt, eng, wgt_s, wgt_py, wgt_pz, wgt_px, wgt_p, wgt_dxy, wgt_dyz, wgt_dz2, wgt_dxz, wgt_dx2y2, wgt_d, wgt_tot\
= getPbandData(self.data[element],self.scaler)
ax.scatter(kpt, eng, wgt_s, color='blue', edgecolor='blue', linewidths=0.2, alpha=self.op,marker='o')
ax.scatter(kpt, eng, wgt_p, color='cyan', edgecolor='cyan', linewidths=0.2, alpha=self.op - 0.6,marker='v')
ax.scatter(kpt, eng, wgt_d, color='red', edgecolor='red', linewidths=0.2, alpha=self.op - 0.85,marker='*')
if (np.array(wgt_d) == np.zeros_like(np.array(wgt_d))).all() and (np.array(wgt_p) == np.zeros_like(np.array(wgt_p))).all():
ax.legend(('$s$'), loc='best', shadow=False, labelspacing=0.1)
elif (np.array(wgt_d) == np.zeros_like(np.array(wgt_d))).all() and not (np.array(wgt_p) == np.zeros_like(np.array(wgt_p))).all():
ax.legend(('$s$','$p$'), loc='best', shadow=False, labelspacing=0.1)
elif not (np.array(wgt_d) == np.zeros_like(np.array(wgt_d))).all() and not (np.array(wgt_p) == np.zeros_like(np.array(wgt_p))).all():
ax.legend(('$s$','$p$','$d$'), loc='best', shadow=False, labelspacing=0.1)
plt = self.plotfigure(ax, kpt, eng, element)
plt.subplots_adjust(top=0.950,bottom=0.110,left=0.165,right=0.855,wspace=0)
plt.savefig('PBAND' + element + 'spd.png',bbox_inches='tight',pad_inches=0.1, dpi=self.dpi)
#del ax, fig
def plotPbandAllElements(self):
from matplotlib import pyplot as plt
print("start plot PBAND including Elements...")
colorcode = ['blue', 'cyan', 'red', 'green', 'yellow']
markerorder=['o','v','p','*','>']
fig = plt.figure(figsize=self.figsize)
ax = fig.add_subplot(111)
for elementorder in range(len(self.elements)):
#del wgt_s, wgt_py, wgt_pz, wgt_px, wgt_p, wgt_dxy, wgt_dyz, wgt_dz2, wgt_dxz, wgt_dx2y2, wgt_d, wgt_tot
kpt, eng, wgt_s, wgt_py, wgt_pz, wgt_px, wgt_p, wgt_dxy, wgt_dyz, wgt_dz2, wgt_dxz, wgt_dx2y2, wgt_d, wgt_tot \
= getPbandData(self.data[self.elements[elementorder]],self.scaler)
ax.scatter(kpt, eng, wgt_tot, color=colorcode[elementorder], edgecolor=colorcode[elementorder], \
linewidths=0.2, alpha=self.op-elementorder*0.2,marker=markerorder[elementorder])
if len(self.elements) == 5:
ax.legend(('$' + self.elements[0] + '$', '$' + self.elements[1] + '$', '$' + self.elements[2] + '$', '$' + self.elements[3] + '$', '$' + self.elements[4] + '$'),\
loc='best', shadow=False, labelspacing=0.1)
elif len(self.elements) == 4:
ax.legend(('$' + self.elements[0] + '$', '$' + self.elements[1] + '$', '$' + self.elements[2] + '$', '$' + self.elements[3] + '$'),\
loc='best', shadow=False, labelspacing=0.1)
elif len(self.elements) == 3:
ax.legend(('$' + self.elements[0]+'$', '$' + self.elements[1] + '$', '$' + self.elements[2] + '$'),\
loc='best', shadow=False, labelspacing=0.1)
elif len(self.elements) == 2:
ax.legend(('$' + self.elements[0] + '$', '$' + self.elements[1] + '$'), \
loc='best', shadow=False, labelspacing=0.1)
elif len(self.elements) == 1:
ax.legend(('$' + self.elements[0] + '$'), \
loc='best', shadow=False, labelspacing=0.1)
title0=" "
for atom in range(len(self.elements)):
title0=self.elements[atom] + title0
plt = self.plotfigure(ax, kpt, eng, title0)
# plt = self.plotfigure(ax, kpt, eng, self.elements[elementorder])
plt.subplots_adjust(top=0.950,bottom=0.110,left=0.165,right=0.855,wspace=0)
plt.savefig('PBAND.png',bbox_inches='tight',pad_inches=0.1, dpi=self.dpi)
#del ax, fig
def plotPbandEachElements(self):
from matplotlib import pyplot as plt
print("start plot PBAND including each Elements...")
colorcode = ['red','cyan','blue' , 'green', 'yellow']
for elementorder in range(len(self.elements)):
print("plot ", self.elements[elementorder])
fig = plt.figure(figsize=self.figsize)
ax = fig.add_subplot(111)
#del wgt_s, wgt_py, wgt_pz, wgt_px, wgt_p, wgt_dxy, wgt_dyz, wgt_dz2, wgt_dxz, wgt_dx2y2, wgt_d, wgt_tot
kpt, eng, wgt_s, wgt_py, wgt_pz, wgt_px, wgt_p, wgt_dxy, wgt_dyz, wgt_dz2, wgt_dxz, wgt_dx2y2, wgt_d, wgt_tot \
= getPbandData(self.data[self.elements[elementorder]],self.scaler)
ax.scatter(kpt, eng, wgt_tot, color=colorcode[elementorder], edgecolor=colorcode[elementorder], \
linewidths=0.2, alpha=self.op-elementorder*0.2,marker='v')
#print(elements)
#ax.legend(elements[elementorder], shadow=False, labelspacing=0.1)
plt.legend(labels=['$' + self.elements[elementorder] + '$'],shadow=False, labelspacing=0.1,loc='best')
plt = self.plotfigure(ax, kpt, eng, self.elements[elementorder])
plt.subplots_adjust(top=0.950,bottom=0.110,left=0.165,right=0.855,wspace=0)
plt.savefig('PBAND'+self.elements[elementorder]+'.png',bbox_inches='tight',pad_inches=0.1, dpi=self.dpi)
#del ax, fig
def plotPbandpxpypz(self):
from matplotlib import pyplot as plt
print("start plot PBAND including s pxpypz for each Elements...")
colorcode = ['blue', 'cyan', 'red', 'green', 'yellow']
for elementorder in range(len(self.elements)):
print("plot ", self.elements[elementorder])
fig = plt.figure(figsize=self.figsize)
ax = fig.add_subplot(111)
#del wgt_s, wgt_py, wgt_pz, wgt_px, wgt_p, wgt_dxy, wgt_dyz, wgt_dz2, wgt_dxz, wgt_dx2y2, wgt_d, wgt_tot
kpt, eng, wgt_s, wgt_py, wgt_pz, wgt_px, wgt_p, wgt_dxy, wgt_dyz, wgt_dz2, wgt_dxz, wgt_dx2y2, wgt_d, wgt_tot \
= getPbandData(self.data[self.elements[elementorder]],self.scaler)
ax.scatter(kpt, eng, wgt_s, color='blue', edgecolor='blue', alpha=self.op,marker='o')
ax.scatter(kpt, eng, wgt_py, color='cyan', edgecolor='cyan', alpha=self.op - 0.1,marker='v')
ax.scatter(kpt, eng, wgt_pz, color='red', edgecolor='red', alpha=self.op - 0.4,marker='p')
ax.scatter(kpt, eng, wgt_px, color='magenta', edgecolor='magenta', alpha=self.op - 0.7,marker='*')
ax.legend(('$s$', '$p_y$', '$p_z$', '$p_x$'), loc='upper right', shadow=False, labelspacing=0.1)
plt = self.plotfigure(ax, kpt, eng, self.elements[elementorder])
plt.subplots_adjust(top=0.950,bottom=0.110,left=0.165,right=0.855,wspace=0)
plt.savefig('PBAND'+self.elements[elementorder]+'spxpypz.png',bbox_inches='tight',pad_inches=0.1,dpi=self.dpi)
#del ax, fig
def plottotalBands(self):
from matplotlib import pyplot as plt
print("start plot total BANDs ...")
colorcode = ['blue', 'cyan', 'red', 'green', 'yellow']
markerorder=['o','v','p','*','>']
fig = plt.figure(figsize=self.figsize)
ax = fig.add_subplot(111)
kpt, eng, wgt_s, wgt_py, wgt_pz, wgt_px, wgt_p, wgt_dxy, wgt_dyz, wgt_dz2, wgt_dxz, wgt_dx2y2, wgt_d, wgt_tot \
= getPbandData(self.data[self.elements[0]],self.scaler)
title0=" "
for atom in range(len(self.elements)):
title0=self.elements[atom] + title0
plt = self.plotfigure(ax, kpt, eng, title0)
# plt = self.plotfigure(ax, kpt, eng, self.elements[elementorder])
plt.subplots_adjust(top=0.950,bottom=0.110,left=0.165,right=0.855,wspace=0)
plt.savefig('BAND.png',bbox_inches='tight',pad_inches=0.1, dpi=self.dpi)
#del ax, fig
if __name__ == "__main__":
#___________________________________SETUP____________________________________
print(" ****************************************************************")
print(" * This is a code used to plot kinds of bandstructure,written by*")
print(" * V.Wang,Jin-Cheng Liu,modfied by Nan Xu,Xue Fei Liu *")
print(" ****************************************************************")
print( "\n")
print(" ****************************************************************")
print(" * Type of bandstructures are obtained as below: *")
print(" * 1).For total bandstructure of all atoms in one figure *")
print(" * 2).For projected bands of each element in separated figures *")
print(" * 3).For total spd orbitals of total elements in one figure *")
print(" * 4).For s-pxpypz of each element in separated figures *")
print(" * 5).For all elements and correspond spd orbitals in one figure*")
print(" * 6).For a total bandstructure *")
print(" ****************************************************************")
print(" (^o^)GOOD LUCK!(^o^) ")
print( "\n")
print( " Band plot initialization... ")
print( "*******************************************************************")
print("Please set the color and width of line in figure,input line=0.2")
print(" and color = 'black' for choice 1->5,input line >= 1 and color =")
print(" 'red','blue' or .... for choice 6")
print( "********************************************************************")
corlor0 = str(input("Input color = ? according to your choice number:"))
lwd = float(input("Input line =? according to your choice number:"))
print("*********************************************************************")
print( "Which kind of bandstructure do you need plot ?")
print( "Please type in a number to select a function: e.g.1, 2 ....,")
print("*********************************************************************")
op = 1 # Max alpha blending value, between 0 (transparent) and 1 (opaque).
scaler = 100 # Scale factor for projected band
energy_limits=(-6, 6.01) # energy ranges for PBAND
dpi=500 # figure_resolution
figsize=(2, 3) #figure_inches
font = {'family' : 'arial',
'color' : 'black',
'weight' : 'normal',
'size' : 13.0,
} #FONT_setup
pband_plots=pbandplots(lwd,op,scaler,energy_limits,font,dpi,figsize,corlor0)
try:
bandtype = int(input("Input number--->"))
except ValueError:
raise ValueError(" You have input wrong ! Please rerun this code !")
if bandtype == 1:
pband_plots.plotPbandAllElements() # plot pband for all element in one figure
elif bandtype == 2:
pband_plots.plotPbandEachElements() # plot pband for each element
elif bandtype == 3:
pband_plots.plotPbandspd() # plot pband with different angular momentum
elif bandtype == 4:
pband_plots.plotPbandpxpypz() # plot pband with Magnetic angular momentum
elif bandtype == 5:
pband_plots.plotPbandAllElementsspd() #plot pband of all enlenments and spd orbitals
elif bandtype == 6:
pband_plots.plottotalBands()
elif bandtype == 7:
plotPbandcolormap()
else :
print(" You have input wrong ! Please rerun this code !" )
sys.exit(0)