|
|
Line 1: |
Line 1: |
| | ==Graphene using grid=== |
| | |
| | *[[Media:graphene_grid.py|graphene_grid.py]]: |
| | |
| <pre> | | <pre> |
| import numpy as np
| | |
| 2 from math import sqrt
| | </pre> |
| 3 from sys import argv
| | |
| 4 from ase import Atoms
| | ===Graphene using LCAO=== |
| 5 from ase.lattice.surface import hcp0001
| | |
| 6 from gpaw import GPAW, restart, Mixer
| | *[[Media:graphene_lcao.py|graphene_lcao.py]]: |
| 7
| | |
| 8 a = 2.4437
| | <pre> |
| 9 # Set up graphene structure
| | |
| 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),
| |
| 13 (0.5*a,+0.5*3**0.5*a,0),
| |
| 14 (0.0,0.0,2*vacuum)])
| |
| 15 atoms.set_pbc((True,True,False))
| |
| 16
| |
| 17 # Gamma-point calculation of graphene
| |
| 18 calc = GPAW(h=0.2, width=0.15, kpts=(1,1,1), xc='LDA')
| |
| 19 atoms.set_calculator(calc)
| |
| 20 atoms.get_potential_energy()
| |
| 21
| |
| 22
| |
| 23 kpts = [ (1/2.0, 1/3.0, 0) ]
| |
| 24
| |
| 25 # Calculate one K-point with usesymm=True
| |
| 26 calc.set(kpts = kpts, usesymm=True, fixdensity=True)
| |
| 27 calc.get_potential_energy()
| |
| 28 eigs_True = calc.get_eigenvalues(kpt=0)
| |
| 29
| |
| 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)
| |
| 34
| |
| 35 print eigs_True
| |
| 36 print eigs_False
| |
| 37 assert abs(eigs_True[0]-eigs_False[0])<1e-4
| |
| </pre> | | </pre> |