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:
ecut=50., 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])
ecut=50., 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]
convergence={'bands':nband}, eigensolver = 'cg', 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:
# view(atoms) atoms.get_potential_energy() calc.write('graphite.gpw','all') if EELS: f = paropen('graphite_q_list', 'w') for i in range(1,8): w = np.linspace(0, 40, 401) q = np.array([i/20., 0., 0.]) # Gamma-M excitation #q = np.array([i/20., -i/20., 0.]) # Gamma-K excitation ecut = 40 + (i-1)*10 df = DF(calc='graphite.gpw', nbands=nband, q=q, w=w, eta=0.2,ecut=ecut) df.get_EELS_spectrum(filename='graphite_EELS_' + str(i)) df.check_sum_rule() print >> f, sqrt(np.inner(df.qq_v / Bohr, df.qq_v / Bohr)), ecut if rank == 0: os.remove('graphite.gpw')
eigensolver=RMM_DIIS(), mixer=Mixer(0.1,3), kpts=(4,4,4), xc='LDA') atoms.set_calculator(calc) atoms.get_potential_energy() calc.write('Al1.gpw','all') # Excited state calculation q = np.array([1./4.,0.,0.]) w = np.linspace(0, 24, 241) df = DF(calc='Al1.gpw', q=q, w=w, eta=0.2, ecut=50) #df.write('Al.pckl') df.get_EELS_spectrum(filename='EELS_Al_1') atoms = Atoms('Al8',scaled_positions=[(0,0,0), (0.5,0,0), (0,0.5,0), (0,0,0.5), (0.5,0.5,0), (0.5,0,0.5), (0.,0.5,0.5), (0.5,0.5,0.5)], cell=[(0,a,a),(a,0,a),(a,a,0)], pbc=True) calc = GPAW(gpts=(24,24,24), eigensolver=RMM_DIIS(), mixer=Mixer(0.1,3),
# view(atoms) atoms.get_potential_energy() calc.write('graphite.gpw', 'all') if EELS: f = paropen('graphite_q_list', 'w') for i in range(1, 8): w = np.linspace(0, 40, 401) q = np.array([i / 20., 0., 0.]) # Gamma-M excitation #q = np.array([i/20., -i/20., 0.]) # Gamma-K excitation ecut = 40 + (i - 1) * 10 df = DF(calc='graphite.gpw', nbands=nband, q=q, w=w, eta=0.2, ecut=ecut) df.get_EELS_spectrum(filename='graphite_EELS_' + str(i)) df.check_sum_rule() print(sqrt(np.inner(df.qq_v / Bohr, df.qq_v / Bohr)), ecut, file=f) if rank == 0: os.remove('graphite.gpw')