Ejemplo n.º 1
0
                mixer=Mixer(0.1,3),
                kpts=(4,2,2),
                xc='LDA',
                nbands=4,
                convergence={'bands':'all'})
    
    atoms.set_calculator(calc)
    atoms.get_potential_energy()
    calc.write('Al.gpw','all')

if bse:
    bse = BSE('Al.gpw',
              w=np.linspace(0,24,241),
              nv=[0,4],
              nc=[0,4],
              coupling=True,
              mode='RPA',
              q=np.array([0.25, 0, 0]),
              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,
Ejemplo n.º 2
0
pos[2][2] = pos[0][2] - 3.172/2
layer.set_positions(pos)
layer.set_calculator(calc)
layer.get_potential_energy()
response = calc.hamiltonian.xc.xcs['RESPONSE']
response.calculate_delta_xc()
E_ks, dis = response.calculate_delta_xc_perturbation()
    

bse = BSE(calc,
          w=np.linspace(0., 5., 501),
          q=np.array([0.0001, 0., 0.]),
          optical_limit=True,
          ecut=10,
          eta=0.02,
          nv=np.array([8,9]),
          nc=np.array([9,10]),
          eshift=dis,
          nbands=15,
          mode='BSE',
          vcut='2D', 
          )

bse.get_dielectric_function('bse_cut.dat')

if rank == 0 and os.path.isfile('phi_qaGp'):
    os.remove('phi_qaGp')
    
    d = np.loadtxt('bse_cut.dat')
    Nw = 88
    if d[Nw,2] > d[Nw-1,2] and d[Nw,2] > d[Nw+1,2]:
Ejemplo n.º 3
0
                mixer=Mixer(0.1,3),
                kpts=(4,2,2),
                xc='LDA',
                nbands=4,
                convergence={'bands':'all'})
    
    atoms.set_calculator(calc)
    atoms.get_potential_energy()
    calc.write('Al.gpw','all')

if bse:
    bse = BSE('Al.gpw',
              w=np.linspace(0,24,241),
              nv=[0,4],
              nc=[0,4],
              coupling=True,
              mode='RPA',
              q=np.array([0.25, 0, 0]),
              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,
Ejemplo n.º 4
0
    layer.set_positions(pos)
    layer.set_calculator(calc)
    layer.get_potential_energy()
    response = calc.hamiltonian.xc.xcs['RESPONSE']
    response.calculate_delta_xc()
    E_ks, dis = response.calculate_delta_xc_perturbation()
    calc.write('MoS2.gpw', mode='all')
else:
    dis = 0.5345

bse = BSE('MoS2.gpw',
          ecut=10,
          valence_bands=[8],
          conduction_bands=[9],
          eshift=dis,
          nbands=15,
          write_h=False,
          write_v=False,
          wfile=None,
          mode='BSE',
          truncation='2D')

w_w, alpha_w = bse.get_polarizability(filename='bse.csv',
                                      pbc=[True, True, False],
                                      eta=0.02,
                                      w_w=np.linspace(0., 5., 5001))
w_ = 0.833
I_ = 26.51
w, I = findpeak(w_w[:1000], alpha_w.imag[:1000])
equal(w, w_, 0.01)
equal(I, I_, 0.1)
Ejemplo n.º 5
0
                     Atom('Na', (0, 0, d)),
                     ], pbc=True)
    cluster.set_cell((15.,15.,18.), scale_atoms=False)
    cluster.center()
    calc = GPAW(h=0.3, nbands=8, setups={'Na': '1'})

    cluster.set_calculator(calc)
    cluster.get_potential_energy()
    calc.write('Na2.gpw','all')

if bse:    
    bse = BSE('Na2.gpw',
              w=np.linspace(0,15,151),
              nv=[0,8],
              nc=[0,8],
              mode='RPA',
              coupling=True,
              q=np.array([0,0,0.0001]),
              optical_limit=True,
              ecut=50.,
              nbands=8)
    bse.initialize()
    H_SS = bse.calculate()
    bse.diagonalize(H_SS)
    
    w = np.real(bse.w_S) * Hartree
    print np.shape(w)
    energies = np.sort(w)[len(w)/2:]
    print 'BSE:', energies

if casida:
    from gpaw.lrtddft import LrTDDFT
Ejemplo n.º 6
0
kpts2 = bzk_kc + shift_c # Gamma centered

for kpts in (kpts2,):

    calc = GPAW(h=0.20, kpts=kpts)      
    atoms.set_calculator(calc)               
    atoms.get_potential_energy()
    calc.write('Si.gpw','all')
    
    # no symmetry BSE
    eshift = 0.8
    bse = BSE('Si.gpw',
              w=np.linspace(0,10,201),
              q=np.array([0.0001, 0, 0.0]),
              optical_limit=True,
              ecut=150.,
              nc=np.array([4,6]),
              nv=np.array([2,4]),
              eshift=eshift,
              nbands=8,
              qsymm=False)
    bse.get_dielectric_function('bse_nosymm.dat')

    if rank == 0 and os.path.isfile('phi_qaGp'):
        os.remove('phi_qaGp')

    
    # with symmetry BSE
    eshift = 0.8
    bse = BSE('Si.gpw',
              w=np.linspace(0,10,201),
              q=np.array([0.0001,0,0.0]),
Ejemplo n.º 7
0
ecut = 50
eshift = 0.8
eta = 0.2

df = DielectricFunction('gs_Si.gpw',
                        ecut=ecut,
                        frequencies=np.linspace(0., 10., 1001),
                        nbands=8,
                        intraband=False,
                        hilbert=False,
                        eta=eta,
                        eshift=eshift,
                        txt='rpa_Si.txt')

df.get_dielectric_function(filename='eps_rpa_Si.csv')

bse = BSE('gs_Si.gpw',
          ecut=ecut,
          valence_bands=range(0, 4),
          conduction_bands=range(4, 8),
          nbands=50,
          eshift=eshift,
          mode='BSE',
          integrate_gamma=0,
          txt='bse_Si.txt')

bse.get_dielectric_function(filename='eps_bse_Si.csv',
                            eta=eta,
                            write_eig='bse_Si_eig.dat',
                            w_w=np.linspace(0.0, 10.0, 10001))
Ejemplo n.º 8
0
    atoms = bulk('C', 'diamond', a=a)

    calc = GPAW(h=0.2,
                kpts=(2,2,2),
                occupations=FermiDirac(0.001),
                nbands=8,
                convergence={'band':'all'})

    atoms.set_calculator(calc)
    atoms.get_potential_energy()
    calc.write('C_kpt8.gpw','all')

if bse:
    
    bse = BSE('C_kpt8.gpw',w=np.linspace(0,20,201),
              q=np.array([0,0,0.5]),optical_limit=True,ecut=50.,
              nbands=8)

    bse.get_dielectric_function('C_bse.dat')

if df:
    from gpaw.response.df import DF
    df = DF('C_kpt8.gpw',w=np.linspace(0,20,201),q=np.array([0,0,0.5]),
            optical_limit=True,ecut=50., hilbert_trans=False)
    df.get_absorption_spectrum(filename='C.dat')


if check_spectrum:

    d = np.loadtxt('C_bse.dat')[:,2]
    Nw1 = 97
Ejemplo n.º 9
0
import numpy as np
from gpaw.response.bse import BSE

w_grid = np.linspace(0, 15, 1001)

# It stores the four-points kernel used for building the two-particles
# Hamiltonian in LiF_W_qGG.
bse = BSE('LiF_fulldiag.gpw',
          w=w_grid,
          q=np.array([0.0001, 0., 0.]),
          optical_limit=True,
          ecut=30,
          nbands=60,
          eta=0.1,
          kernel_file='LiF_W_qGG',
          txt='LiF_BSE_out.txt')

# Calculate the dielectric function calculated at the BSE level:
df_BSE = bse.get_dielectric_function()
Ejemplo n.º 10
0
                    'size': (2, 2, 2),
                    'gamma': True
                },
                occupations=FermiDirac(0.001),
                nbands=12,
                convergence={'bands': -4})
    atoms.set_calculator(calc)
    atoms.get_potential_energy()
    calc.write('Si.gpw', 'all')

if bse:
    eshift = 0.8
    bse = BSE('Si.gpw',
              ecut=50.,
              valence_bands=range(4),
              conduction_bands=range(4, 8),
              eshift=eshift,
              nbands=8,
              write_h=False,
              write_v=False)
    w_w, eps_w = bse.get_dielectric_function(filename=None,
                                             eta=0.2,
                                             w_w=np.linspace(0, 10, 2001))
if check:
    w_ = 2.552
    I_ = 421.15
    w, I = findpeak(w_w, eps_w.imag)
    equal(w, w_, 0.01)
    equal(I, I_, 0.1)

if GS and nosym:
    atoms = bulk('Si', 'diamond', a=a)
Ejemplo n.º 11
0
    cluster = Atoms([Atom('Na', (0, 0, 0)),
                     Atom('Na', (0, 0, d)),
                     ], pbc=True)
    cluster.set_cell((15.,15.,18.), scale_atoms=False)
    cluster.center()
    calc=GPAW(h=0.3,nbands=8)

    
    cluster.set_calculator(calc)
    cluster.get_potential_energy()
    calc.write('Na2.gpw','all')

if bse:
    
    bse = BSE('Na2.gpw',w=np.linspace(0,15,151),
              q=np.array([0,0,0.0001]),optical_limit=True,ecut=50.,
              nbands=8)
    bse.initialize()
    bse.calculate()
    
    w = np.real(bse.w_S) * Hartree
    energies = np.sort(w[:,np.nonzero(w>0)[0]])
    print energies

if casida:

    from gpaw.lrtddft import LrTDDFT
    from gpaw.lrtddft import photoabsorption_spectrum

    calc = GPAW('Na2.gpw',txt=None)
Ejemplo n.º 12
0
    calc = GPAW(h=0.2,
                kpts=kpts,
                occupations=FermiDirac(0.001),
                nbands=12,
                convergence={'bands': -4})
    atoms.set_calculator(calc)
    atoms.get_potential_energy()
    calc.write('Si.gpw', 'all')

if bse:
    eshift = 0.8
    bse = BSE('Si.gpw',
              w=np.linspace(0, 10, 201),
              q=np.array([0.0001, 0, 0.0]),
              optical_limit=True,
              ecut=50.,
              nc=np.array([4, 6]),
              nv=np.array([2, 4]),
              eshift=eshift,
              nbands=8)
    bse.get_dielectric_function('Si_bse.dat')

    if rank == 0 and os.path.isfile('phi_qaGp'):
        os.remove('phi_qaGp')

if check:
    d = np.loadtxt('Si_bse.dat')

    Nw1 = 64
    Nw2 = 77
    if d[Nw1, 2] > d[Nw1-1, 2] and d[Nw1, 2] > d[Nw1+1, 2] \
Ejemplo n.º 13
0
    atoms.center()
    calc = GPAW(h=0.2,
                kpts=(4, 2, 2),
                xc='LDA',
                nbands=4,
                convergence={'band': 'all'})

    atoms.set_calculator(calc)
    atoms.get_potential_energy()
    calc.write('Al.gpw', 'all')

if bse:

    bse = BSE('Al.gpw',
              w=np.linspace(0, 24, 241),
              q=np.array([0.25, 0, 0]),
              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)
    df1, df2 = df.get_dielectric_function()
    df.get_EELS_spectrum(df1, df2, filename='Al_df.dat')
    df.write('Al.pckl')
Ejemplo n.º 14
0
                mixer=Mixer(0.1, 3),
                kpts=(2, 2, 2),
                occupations=FermiDirac(0.001),
                nbands=8,
                convergence={'bands': 'all'})

    atoms.set_calculator(calc)
    atoms.get_potential_energy()
    calc.write('C_kpt8.gpw', 'all')

if bse:
    bse = BSE('C_kpt8.gpw',
              w=np.linspace(0, 20, 201),
              mode='RPA',
              nc=[0, 8],
              nv=[0, 8],
              coupling=True,
              q=np.array([0.0001, 0, 0.]),
              optical_limit=True,
              ecut=50.,
              nbands=8)
    bse.get_dielectric_function('C_bse.dat')

if df:
    from gpaw.response.df0 import DF
    df = DF('C_kpt8.gpw',
            w=np.linspace(0, 20, 201),
            q=np.array([0.0001, 0, 0.]),
            optical_limit=True,
            ecut=50.,
            hilbert_trans=False)
    df.get_absorption_spectrum(filename='C.dat')
Ejemplo n.º 15
0
                        ecut=ecut,
                        frequencies=np.linspace(0, 5, 1001),
                        nbands=50,
                        intraband=False,
                        hilbert=False,
                        eta=eta,
                        eshift=eshift,
                        txt='rpa_MoS2.txt')

df.get_polarizability(filename='pol_rpa_MoS2.csv', pbc=[True, True, False])

bse = BSE('gs_MoS2.gpw',
          spinors=True,
          ecut=ecut,
          valence_bands=[8],
          conduction_bands=[9],
          nbands=50,
          eshift=eshift,
          mode='BSE',
          txt='bse_MoS2.txt')

bse.get_polarizability(filename='pol_bse_MoS2.csv',
                       eta=eta,
                       pbc=[True, True, False],
                       write_eig='bse_MoS2_eig.dat',
                       w_w=np.linspace(0, 5, 5001))

bse = BSE('gs_MoS2.gpw',
          spinors=True,
          ecut=ecut,
          valence_bands=[8],
Ejemplo n.º 16
0
                convergence={'bands': 'all'})
    
    atoms.set_calculator(calc)
    atoms.get_potential_energy()
    calc.write('Al.gpw', 'all')

q_c = np.array([0.25, 0.0, 0.0])
w_w = np.linspace(0, 24, 241)
eta = 0.2
ecut = 50
if bse:
    bse = BSE('Al.gpw',
              valence_bands=range(4),
              conduction_bands=range(4),
              mode='RPA',
              nbands=4,
              ecut=ecut,
              write_h=False,
              write_v=False,
              )
    bse_w = bse.get_eels_spectrum(filename=None,
                                  q_c=q_c,
                                  w_w=w_w,
                                  eta=eta)[1]
    
if df:
    df = DielectricFunction(calc='Al.gpw',
                            frequencies=w_w,
                            eta=eta,
                            ecut=ecut,
                            hilbert=False)