def get_Y(lim_low, lim_high):
    X = np.linspace(-5., 5., 600*2)
    Y = np.zeros(600*2)
    YU = np.zeros(600*2)
    YD = np.zeros(600*2)
    Yp = np.zeros(600*2)
    YpU = np.zeros(600*2)
    YpD = np.zeros(600*2)

    no_eprimes = 0
    for c in cells_to_check:
        print c
        zero = offsets[c]['VBM']

        zeros_before = int(np.fabs(zero/dE))
        zeros_after = 600 - zeros_before
        #plt.plot([offsets[c]['Ef']-offsets[c]['VBM'],]*2, [-30,30], 'r--')

        for eprime in eprime_dict[c]:
            s = get_spin_mom(eprime, c)
            if lim_low <= np.fabs(s) <= lim_high:
                print s, eprime
                x, y_u, y_d = get_at_pdos(c, eprime)
                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)
                Y = Y + Y_u - Y_d
                if to_switch[c][eprime]:
                    print c, eprime, 'switch'
                    YU -= Y_d
                    YD -= Y_u
                else:
                    YU += Y_u
                    YD += Y_d

                
                if 'ox' not in c:
                    at_e = ReadStruct('../../crystal_files/INPUT_'+c,
                                              'crystal').atoms[eprime-1]
                    p_str= ReadStruct('../../crystal_files/INPUT_'+c+'p', 'crystal')

                    i_x, at_p = get_similar(at_e, p_str)

                    x, yy_u, yy_d = get_at_pdos(c+'p', i_x)
                    Yp_u = np.concatenate((np.zeros(zeros_before), 
                                          yy_u,
                                          np.zeros(zeros_after)), axis=0)
                    Yp_d = np.concatenate((np.zeros(zeros_before), 
                                          yy_d,
                                          np.zeros(zeros_after)), axis=0)
                    Yp = Yp + Yp_u - Yp_d
                    if to_switch[c][eprime]:
                        print c, eprime, 'switch'
                        YpU -= Yp_d
                        YpD -= Yp_u
                    else:
                        YpU += Yp_u
                        YpD += Yp_d
                no_eprimes = no_eprimes + 1

    return X, YU, YD, no_eprimes
示例#2
0
              }

for c in ['c'+ i for i in map(str, range(2, 7))]:
    print c,
    for eprime in eprime_dict[c]:
        print eprime,
        x, y_u, y_d = get_at_pdos(c, eprime)
        x = [o(p) for p in x]
        plt.plot(x, y_u, 'k-', linewidth=2)
        nps, = plt.plot(x, y_d, 'k-', label='Unpassivated', linewidth=2)
        # Get the Atom object of the eprime
        at_e = ReadStruct('../../crystal_files/INPUT_'+c,
                          'crystal').atoms[eprime-1]
        p_str= ReadStruct('../../crystal_files/INPUT_'+c+'p', 'crystal')
        # get equivalent atom from passified structure
        i_x, at_p = get_similar(at_e, p_str)
        print '{:5.3f}'.format(distance(at_e, at_p)), 
        x, y_u, y_d = get_at_pdos(c+'p', i_x)
        x = [o(p) for p in x]
        plt.plot(x, y_u, 'r-', linewidth=2.5)
        ps,= plt.plot(x, y_d, 'r-', label='H passivated', linewidth=2.5)
    print

minor_locator = MultipleLocator(0.10)
plt.gca().xaxis.set_minor_locator(minor_locator)
plt.gca().tick_params(which='minor', length=5, width=2)
plt.gca().tick_params(which='major', length=10, width=2, labelsize=15)

plt.legend(handles=[nps, ps], ncol=2, fontsize=20)
plt.axvspan(o(-5),o(-3.313), facecolor='0.85', linewidth=0)
plt.axvspan(o(-2.27),o(0.0), facecolor='0.85', linewidth=0)