plt.setp(fig[i].get_xticklabels(), visible=True) for tick in fig[i].xaxis.get_major_ticks(): tick.label1.set_fontweight('bold') print 'Done formatting!' for i, nm in enumerate(nms): s = ReadStruct('../../crystal_files/INPUT_'+nm) s.normalise() vbmax, cbmin = map(offst, lims[nm]) print nm print vbmax, cbmin fig[i].axvspan(offst(-5), vbmax, facecolor='0.85', linewidth=0) fig[i].axvspan( cbmin, offst(1), facecolor='0.85', linewidth=0) E, up, down = get_at_pdos(nm, 3, total=True) fig[i].plot(offst(E), up, '-', color='slateblue', linewidth=3) fig[i].plot(offst(E), down, '-', color='slateblue', linewidth=3) _, u2, d2 = np.zeros(len(E)), np.zeros(len(up)), np.zeros(len(down)) print sc_lims[nm][0], sc_lims[nm][1] for j, at in enumerate(s.atoms): if at.z < sc_lims[nm][0] or at.z > sc_lims[nm][1]: if at.z < ox_lims[nm][0] or at.z > ox_lims[nm][1]: x, y1, y2 = get_at_pdos(nm, j+1) u2 += y1 d2 += y2 fig[i].plot(offst(E), u2, '-', color='crimson', linewidth=3) fig[i].plot(offst(E), d2, '-', color='crimson', linewidth=3)
'hfo2si_c1ox':(-2.62, -0.74), 'hfo2si_c2ox':(-2.48, -0.32), 'hfo2si_c3ox':(-2.43, -0.04)} a = np.zeros(6, dtype=int) y = [[] for i in range(len(a))] for nm in nms: s = ReadStruct('../../crystal_files/INPUT_'+nm) for i, at in enumerate(s.atoms): if at.species == 'Hf': nbs = neighbours_from_file(i+1, nm) nbs = [nb for nb in nbs if (nb.length < 3. and nb.atom_type == 'Hf')] a[len(nbs)] +=1 E, up, down = get_at_pdos(nm, i+1) vbm, cbm = lims[nm] dos = integrate_dos(E, up, down, emin=vbm, emax=cbm) # tweak emin and emax y[len(nbs)].append(dos) xs, ys = np.array([]), np.array([]) for x, p in enumerate(y): g = np.array([x]*len(p)) xs = np.append(xs, g) ys = np.append(ys, p) fig = plt.axes(xlim=(-1, 5)) fig.scatter(xs, ys, marker='o', facecolors='none') #fig.boxplot(y[:], showfliers=False)
plt.setp(fig[i].get_xticklabels(), visible=True) for tick in fig[i].xaxis.get_major_ticks(): tick.label1.set_fontweight('bold') print 'Done formatting!' for i, nm in enumerate(nms): s = ReadStruct('../../crystal_files/INPUT_'+nm) o = lambda k : k - offsets[nm]['VBM'] fig[i].axvspan(-1, 0, facecolor='0.85', linewidth=0) fig[i].axvspan(offsets[nm]['CBM']-offsets[nm]['VBM'], 3, facecolor='0.85', linewidth=0) E, up, down = get_at_pdos(nm, 3, total=True) fig[i].plot(o(E), up, '-', color='slateblue', linewidth=3) fig[i].plot(o(E), down, '-', color='slateblue', linewidth=3) p1, p2 = np.zeros(600), np.zeros(600) for ii, at in enumerate(s.atoms): nbs = neighbours_from_file(ii+1, nm) nbs = [nb for nb in nbs if (nb.atom_type == 'Hf' and nb.length < 3.)] if at.species == 'Si' and nbs: print [(nb.atom_type, nb.length) for nb in nbs] _, u, d = get_at_pdos(nm, ii+1) p1 += u p2 += d fig[i].plot(o(E), p1, '-', color='#66FFCC', linewidth=3) fig[i].plot(o(E), p2, '-', color='#66FFCC', linewidth=3)
s = ReadStruct('../../crystal_files/INPUT_'+nm) zero = offsets[nm]['VBM'] zeros_before = int(np.fabs(zero/dE)) zeros_after = 600 - zeros_before #it = (i+1 for i in range(len(s))) it = (a for a in s.atoms) for i, at in enumerate(s.atoms): if at.species=='Si': nbs = neighbours_from_file(i+1, nm) nbs = [nb for nb in nbs if (nb.length < 3 and nb.atom_type == 'Hf')] E, y_u, y_d = get_at_pdos(nm, i+1) Y_u = np.concatenate((np.zeros(zeros_before), y_u, np.zeros(zeros_after)), axis=0) Y_d = np.concatenate((np.zeros(zeros_before), y_d, np.zeros(zeros_after)), axis=0) if len(nbs) > 1: Y= Y + Y_u - Y_d Y_tot= Y_tot + Y_u - Y_d fig.plot(X, Y, 'r', linewidth=2) fig.plot(X, Y_tot, 'k', linewidth=2) plt.setp(fig.get_xticklabels(), visible=True) plt.gcf().set_size_inches(20., 3.5) plt.xlabel('Energy [eV]', fontweight='bold', fontsize=20) plt.savefig('dos_Si_HfBonded.png', dpi=100, bbox_inches='tight')