Exemple #1
0
if EELS:

    for i in range(1, 2):
        w = np.linspace(0, 15, 301)
        q = np.array([-i / 64., i / 64., 0.])  # Gamma - K
        ecut = 40 + i * 10
        df = DF(calc=calc,
                q=q,
                w=w,
                eta=0.05,
                ecut=ecut,
                txt='df_' + str(i) + '.out')
        df.get_surface_response_function(z0=21.2 / 2, filename='be_EELS')
        df.get_EELS_spectrum()
        df.check_sum_rule()
        df.write('df_' + str(i) + '.pckl')

if check:
    d = np.loadtxt('be_EELS')

    wpeak1 = 2.50  # eV
    wpeak2 = 9.95
    Nw1 = 50
    Nw2 = 199

    if (d[Nw1, 1] > d[Nw1 - 1, 1] and d[Nw1, 1] > d[Nw1 + 1, 1]
            and d[Nw2, 1] > d[Nw2 - 1, 1] and d[Nw2, 1] > d[Nw2 + 1, 1]):
        pass
    else:
        raise ValueError('Plasmon peak not correct ! ')
Exemple #2
0
              eta=0.2)
    bse.get_dielectric_function('Al_bse.dat')
    
if df:
    # Excited state calculation
    q = np.array([1/4.,0.,0.])
    w = np.linspace(0, 24, 241)
    
    df = DF(calc='Al.gpw',
            q=q,
            w=w,
            eta=0.2,
            ecut=50,
            hilbert_trans=False)
    df.get_EELS_spectrum(filename='Al_df.dat')
    df.write('Al.pckl')
    df.check_sum_rule()


if check_spectrum:
    d = np.loadtxt('Al_bse.dat')[:,2] 
    wpeak = 16.4 
    Nw = 164
    if d[Nw] > d[Nw-1] and d[Nw] > d[Nw+1]:
        pass
    else:
        raise ValueError('Plasmon peak not correct ! ')
    
    if np.abs(d[Nw] - 27.4958893542) > 1e-5:
        print d[Nw]
        raise ValueError('Please check spectrum strength ! ')
    w = np.linspace(0, 24, 481)
    q = np.array([0.0, 0.00001, 0.])

    # getting macroscopic constant
    df = DF(calc='si.gpw',
            q=q,
            w=(0., ),
            eta=0.001,
            hilbert_trans=False,
            ecut=150,
            optical_limit=True,
            txt='df_1.out')

    eM1, eM2 = df.get_macroscopic_dielectric_constant()

    df.write('df_1.pckl')

    if np.abs(eM1 - 13.991793) > 1e-3 or np.abs(eM2 - 12.589129) > 1e-3:
        print(eM1, eM2)
        raise ValueError('Please check dielectric constant !')

    #getting absorption spectrum
    df = DF(calc='si.gpw',
            q=q,
            w=w,
            eta=0.1,
            ecut=150,
            optical_limit=True,
            txt='df_2.out')

    df.get_absorption_spectrum(filename='si_abs')
              eta=0.2)
    bse.get_dielectric_function('Al_bse.dat')
    
if df:
    # Excited state calculation
    q = np.array([1/4.,0.,0.])
    w = np.linspace(0, 24, 241)
    
    df = DF(calc='Al.gpw',
            q=q,
            w=w,
            eta=0.2,
            ecut=50,
            hilbert_trans=False)
    df.get_EELS_spectrum(filename='Al_df.dat')
    df.write('Al.pckl')
    df.check_sum_rule()


if check_spectrum:
    d = np.loadtxt('Al_bse.dat')[:,2] 
    wpeak = 16.4 
    Nw = 164
    if d[Nw] > d[Nw-1] and d[Nw] > d[Nw+1]:
        pass
    else:
        raise ValueError('Plasmon peak not correct ! ')
    
    if np.abs(d[Nw] - 27.4958893542) > 1e-5:
        print(d[Nw])
        raise ValueError('Please check spectrum strength ! ')
                width=0.1)
    atoms.set_calculator(calc)
    atoms.get_potential_energy()

if EELS:

    for i in range(1, 2):
        w = np.linspace(0, 15, 301)
        q = np.array([-i/64., i/64., 0.]) # Gamma - K
	ecut = 40 + i*10
        df = DF(calc=calc, q=q, w=w, eta=0.05, ecut = ecut,
                      txt='df_' + str(i) + '.out')  
        df.get_surface_response_function(z0=21.2/2, filename='be_EELS')  
        df.get_EELS_spectrum()    
        df.check_sum_rule()
        df.write('df_' + str(i) + '.pckl')

if check:
    d = np.loadtxt('be_EELS')

    wpeak1 = 2.50 # eV
    wpeak2 = 9.95
    Nw1 = 50
    Nw2 = 199

    if (d[Nw1, 1] > d[Nw1-1, 1] and d[Nw1, 1] > d[Nw1+1, 1] and  
       d[Nw2, 1] > d[Nw2-1, 1] and d[Nw2, 1] > d[Nw2+1, 1]):
        pass
    else:
        raise ValueError('Plasmon peak not correct ! ')