Band structure of bulk graphene: Difference between revisions

From phys824
Jump to navigationJump to search
(Created page with "<pre> import numpy as np 2 from math import sqrt 3 from sys import argv 4 from ase import Atoms 5 from ase.lattice.surface import hcp0001 6 from gpaw import GPA...")
 
 
(22 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Graphene using grid==
*graphene_grid.py:
<pre>
<pre>
import numpy as np
from gpaw import GPAW, FermiDirac
from math import sqrt
from ase import Atoms
3  from sys import argv
from ase.io import read, write
from ase import Atoms  
from gpaw import GPAW, PoissonSolver, Mixer
from ase.lattice.surface import hcp0001
from ase.structure import bulk
from gpaw import GPAW, restart, Mixer  
 
 
a = 2.4437
# -------------------------------------------------------------
  9 # Set up graphene structure
# Bulk configuration
10  vacuum = 3
# -------------------------------------------------------------
11  atoms = Atoms(symbols='C2', positions=[(0.5*a,-sqrt(3)/6*a,vacuum),(0.5*a, +sqrt(3)/6*a, vacuum)],
 
12                cell=[(0.5*a,-0.5*3**0.5*a,0),
gnr = bulk('C', 'hcp', a=2.4612, c=6.709) # hexagonal close-packed (hpc)
13                      (0.5*a,+0.5*3**0.5*a,0),
gnr.positions=([[ 0. , 0., 0.], [ 1.23060,  0.7104873,  0. ]])
14                      (0.0,0.0,2*vacuum)])  
 
15  atoms.set_pbc((True,True,False))  
write('gr.traj', gnr)
16 
 
17  # Gamma-point calculation of graphene
# Make self-consistent calculation and save results
18  calc = GPAW(h=0.2, width=0.15, kpts=(1,1,1), xc='LDA')
calc = GPAW(h=0.18,
19  atoms.set_calculator(calc)  
            mode='fd', #finite difference(fd)
20  atoms.get_potential_energy()  
            xc='PBE',
21 
            kpts=(5,5,1),
22 
            occupations=FermiDirac(width=0.05, maxiter=2000),
23  kpts = [ (1/2.0, 1/3.0, 0) ]
            mixer=Mixer(beta=0.010, nmaxold=8, weight=100.0),
24 
            poissonsolver=PoissonSolver(eps=1e-12),
25  # Calculate one K-point with usesymm=True
            txt='band_sc.txt')
26  calc.set(kpts = kpts, usesymm=True, fixdensity=True)  
 
27  calc.get_potential_energy()  
gnr.set_calculator(calc)
28  eigs_True = calc.get_eigenvalues(kpt=0)  
gnr.get_potential_energy()
29 
calc.write('band_sc.gpw')
30  # Redo with the same K-point with usesymm=False
 
31  calc.set(kpts = kpts, usesymm=False, fixdensity=True)  
 
32  calc.get_potential_energy()  
 
33  eigs_False = calc.get_eigenvalues(kpt=0)  
from ase.dft.kpoints import ibz_points, get_bandpath
34 
points = ibz_points['hexagonal']
35  print eigs_True
G = points['Gamma']
36  print eigs_False
K = points['K']
37  assert abs(eigs_True[0]-eigs_False[0])<1e-4
M = points['M']
kpts, x, X = get_bandpath([K, G, M, K], gnr.cell, 60)
 
calc = GPAW('band_sc.gpw',
            mode='fd',
            kpts=kpts,
            txt='band_harris.txt',
            fixdensity=True,
            parallel={'domain': 1},
            eigensolver='cg', # 'cg' is allowed for grid method only
            usesymm=None,
            convergence={'bands': 'all'})
 
if calc.input_parameters['mode'] == 'lcao':
    calc.scf.reset()
 
 
calc.get_potential_energy()
ef = calc.get_fermi_level()
calc.write('band_harris.gpw')
 
# Extract eigenenergies into a file for plotting with some external package
 
import numpy as np
 
calc = GPAW('band_harris', txt=None)
eps_skn = np.array([[calc.get_eigenvalues(k,s)
                    for k in range(40)]
                    for s in range(1)]) - ef
 
f = open('bands.dat', 'w')
for n in range(8):
    for k in range(40):
        print >>f, k, eps_skn[0, k, n]
    print >>f
</pre>
 
==Graphene using LCAO==
 
*graphene_lcao.py:
 
<pre>
from gpaw import GPAW, FermiDirac
from ase import Atoms
from ase.io import read, write
from gpaw import GPAW, PoissonSolver, Mixer
from ase.structure import bulk
 
# -------------------------------------------------------------
# Bulk configuration
# -------------------------------------------------------------
 
gnr = bulk('C', 'hcp', a=2.4612, c=6.709)
 
gnr.positions=([[ 0. 0., 0.], [ 1.23060,  0.7104873, 0. ]])
 
write('gnr.traj', gnr)
 
# Make self-consistent calculation and save results
calc = GPAW(h=0.18,
            mode='lcao',
            xc='PBE',
            basis='szp(dzp)',
            kpts=(5,5,1),
            occupations=FermiDirac(width=0.05, maxiter=2000),
            mixer=Mixer(beta=0.010, nmaxold=8, weight=100.0),
            poissonsolver=PoissonSolver(eps=1e-12),
            txt='band_sc.txt')
 
gnr.set_calculator(calc)
gnr.get_potential_energy()
calc.write('band_sc.gpw')
 
from ase.dft.kpoints import ibz_points, get_bandpath
points = ibz_points['hexagonal']
G = points['Gamma']
K = points['K']
M = points['M']
kpts, x, X = get_bandpath([K, G, M, K], gnr.cell, 40)
 
calc = GPAW('band_sc.gpw',
            mode='lcao',
            xc='PBE',
            basis='szp(dzp)',
            kpts=kpts,
            txt='band_harris.txt',
            fixdensity=True,
            parallel={'domain': 1},
            usesymm=None,
            convergence={'bands': 'all'})
 
if calc.input_parameters['mode'] == 'lcao':
    calc.scf.reset()
 
calc.get_potential_energy()
ef = calc.get_fermi_level()
calc.write('band_harris.gpw')
 
# Extract eigenenergies into a file for plotting with some external package
 
import numpy as np
 
calc = GPAW('band_harris', txt=None)
eps_skn = np.array([[calc.get_eigenvalues(k,s)
                    for k in range(40)]
                    for s in range(1)]) - ef
 
f = open('bands.dat', 'w')
for n in range(8):
    for k in range(40):
        print >>f, k, eps_skn[0, k, n]
    print >>f
</pre>
</pre>

Latest revision as of 14:41, 17 November 2014

Graphene using grid

  • graphene_grid.py:
from gpaw import GPAW, FermiDirac
from ase import Atoms
from ase.io import read, write
from gpaw import GPAW, PoissonSolver, Mixer
from ase.structure import bulk 


# -------------------------------------------------------------
# Bulk configuration
# -------------------------------------------------------------

gnr = bulk('C', 'hcp', a=2.4612, c=6.709) # hexagonal close-packed (hpc)
gnr.positions=([[ 0. ,  0.,  0.], [ 1.23060,  0.7104873,  0. ]])

write('gr.traj', gnr)

# Make self-consistent calculation and save results
calc = GPAW(h=0.18,
            mode='fd', #finite difference(fd)
            xc='PBE',
            kpts=(5,5,1),
            occupations=FermiDirac(width=0.05, maxiter=2000),
            mixer=Mixer(beta=0.010, nmaxold=8, weight=100.0),
            poissonsolver=PoissonSolver(eps=1e-12),
            txt='band_sc.txt')

gnr.set_calculator(calc)
gnr.get_potential_energy()
calc.write('band_sc.gpw')



from ase.dft.kpoints import ibz_points, get_bandpath
points = ibz_points['hexagonal']
G = points['Gamma']
K = points['K']
M = points['M']
kpts, x, X = get_bandpath([K, G, M, K], gnr.cell, 60)

calc = GPAW('band_sc.gpw',
            mode='fd',
            kpts=kpts,
            txt='band_harris.txt',
            fixdensity=True,
            parallel={'domain': 1},
            eigensolver='cg', # 'cg' is allowed for grid method only
            usesymm=None,
            convergence={'bands': 'all'})

if calc.input_parameters['mode'] == 'lcao':
    calc.scf.reset()


calc.get_potential_energy()
ef = calc.get_fermi_level()
calc.write('band_harris.gpw')

# Extract eigenenergies into a file for plotting with some external package

import numpy as np

calc = GPAW('band_harris', txt=None)
eps_skn = np.array([[calc.get_eigenvalues(k,s)
                     for k in range(40)]
                    for s in range(1)]) - ef

f = open('bands.dat', 'w')
for n in range(8):
    for k in range(40):
        print >>f, k, eps_skn[0, k, n]
    print >>f

Graphene using LCAO

  • graphene_lcao.py:
from gpaw import GPAW, FermiDirac
from ase import Atoms
from ase.io import read, write
from gpaw import GPAW, PoissonSolver, Mixer
from ase.structure import bulk 

# -------------------------------------------------------------
# Bulk configuration
# -------------------------------------------------------------

gnr = bulk('C', 'hcp', a=2.4612, c=6.709)

gnr.positions=([[ 0. ,  0.,  0.], [ 1.23060,  0.7104873,  0. ]])

write('gnr.traj', gnr)

# Make self-consistent calculation and save results
calc = GPAW(h=0.18,
            mode='lcao',
            xc='PBE',
            basis='szp(dzp)',
            kpts=(5,5,1),
            occupations=FermiDirac(width=0.05, maxiter=2000),
            mixer=Mixer(beta=0.010, nmaxold=8, weight=100.0),
            poissonsolver=PoissonSolver(eps=1e-12),
            txt='band_sc.txt')

gnr.set_calculator(calc)
gnr.get_potential_energy()
calc.write('band_sc.gpw')

from ase.dft.kpoints import ibz_points, get_bandpath
points = ibz_points['hexagonal']
G = points['Gamma']
K = points['K']
M = points['M']
kpts, x, X = get_bandpath([K, G, M, K], gnr.cell, 40)

calc = GPAW('band_sc.gpw',
            mode='lcao',
            xc='PBE',
            basis='szp(dzp)',
            kpts=kpts,
            txt='band_harris.txt',
            fixdensity=True,
            parallel={'domain': 1},
            usesymm=None,
            convergence={'bands': 'all'})

if calc.input_parameters['mode'] == 'lcao':
    calc.scf.reset()

calc.get_potential_energy()
ef = calc.get_fermi_level()
calc.write('band_harris.gpw')

# Extract eigenenergies into a file for plotting with some external package

import numpy as np

calc = GPAW('band_harris', txt=None)
eps_skn = np.array([[calc.get_eigenvalues(k,s)
                     for k in range(40)]
                    for s in range(1)]) - ef

f = open('bands.dat', 'w')
for n in range(8):
    for k in range(40):
        print >>f, k, eps_skn[0, k, n]
    print >>f