|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +# This tutorial setup the necessary files for running |
| 4 | +# a simple graphene system example. |
| 5 | + |
| 6 | +# We will HEAVILY encourage to use Python3 compliant code |
| 7 | +# This line ensures the code will run using either Python2 or Python3 |
| 8 | +from __future__ import print_function |
| 9 | + |
| 10 | +# First we require the use of the sisl Python module. |
| 11 | +import sisl |
| 12 | + |
| 13 | +# Instead of manually defining the graphene system we use |
| 14 | +# the build-in sisl capability of defining the graphene |
| 15 | +# structure. |
| 16 | +graphene = sisl.geom.graphene() |
| 17 | + |
| 18 | +# Print out some basic information about the geometry we have |
| 19 | +# just created. |
| 20 | +print("Graphene geometry information:") |
| 21 | +print(graphene) |
| 22 | +print() |
| 23 | +# It should print that the geometry consists of |
| 24 | +# 2 atoms (na) |
| 25 | +# 2 orbitals (no), one per atom |
| 26 | +# 1 specie (C), both atoms are the same atomic specie |
| 27 | +# orbital range of 1.4342 AA (dR) |
| 28 | +# 3x3 supercell (nsc), this is determined from dR |
| 29 | + |
| 30 | +# Now as we have the graphene unit-cell, we can create the |
| 31 | +# Hamiltonian for the system. |
| 32 | +H = sisl.Hamiltonian(graphene) |
| 33 | +print("Graphene initial Hamiltonian information:") |
| 34 | +print(H) |
| 35 | +print() |
| 36 | + |
| 37 | +# Currently this Hamiltonian is an empty entity, i.e. |
| 38 | +# no hopping elements has been assigned (all H[i,j] == 0). |
| 39 | +# For graphene, one may use these tight-binding parameters: |
| 40 | +# on-site: 0. eV |
| 41 | +# nearest-neighbour: -2.7 eV |
| 42 | +# In the following loop we setup the Hamiltonian with the above |
| 43 | +# tight-binding parameters: |
| 44 | +for ia, io in H: |
| 45 | + # This loop construct loops over all atoms and the orbitals |
| 46 | + # corresponding to the atom. |
| 47 | + # In this case the geometry has one orbital per atom, hence |
| 48 | + # ia == io |
| 49 | + # in all cases. |
| 50 | + |
| 51 | + # In order to figure out which atoms atom `ia` is connected |
| 52 | + # to, we must find those atoms |
| 53 | + # To do this we access the geometry attached to the |
| 54 | + # Hamiltonian (H.geom) |
| 55 | + # and use a function called `close` which returns ALL |
| 56 | + # atoms within certain ranges of a given point or atom |
| 57 | + idx = H.geom.close(ia, dR = (0.1, 1.43)) |
| 58 | + # the argument dR has two entries: |
| 59 | + # 0.1 and 1.43 |
| 60 | + # Each value represents a radii of a sphere. |
| 61 | + # The `close` function will then return |
| 62 | + # a list of equal length of the dR argument (i.e. a list with |
| 63 | + # two values). |
| 64 | + # Then idx[0] is the first element and this contains a list |
| 65 | + # of all atoms within a sphere of 0.1 AA of atom `ia`. |
| 66 | + # This should obviously only contain the atom it-self. |
| 67 | + # The second element, idx[1] contains all atoms within a sphere |
| 68 | + # with radius of 1.43 AA, but not including those within 0.1 AA. |
| 69 | + # In this case this is then all atoms that are the nearest neighbour |
| 70 | + # atoms |
| 71 | + |
| 72 | + # Now we know the on-site atoms (idx[0]) and the nearest neighbour |
| 73 | + # atoms (idx[1]), all we need to do is set the Hamiltonian |
| 74 | + # elements: |
| 75 | + |
| 76 | + # on-site (0. eV) |
| 77 | + H[io, idx[0]] = 0. |
| 78 | + |
| 79 | + # nearest-neighbour (-2.7 eV) |
| 80 | + H[io, idx[1]] = -2.7 |
| 81 | + |
| 82 | +# At this point we have created all Hamiltonian elements for all orbitals |
| 83 | +# in the graphene geometry. |
| 84 | +# Let's try and print the information of the Hamiltonian object: |
| 85 | +print("Hamiltonian after setting up the parameters:") |
| 86 | +print(H) |
| 87 | +print() |
| 88 | +# It now prints that there are 8 non-zero elements. |
| 89 | +# Please convince yourself that this is the correct number of |
| 90 | +# Hamiltonian elements (regard the on-site value of 0. eV as a non-zero |
| 91 | +# value). HINT: count the number of on-site and nearest-neighbour terms) |
| 92 | + |
| 93 | +# At this point we have all the ingredients for manipulating the electronic |
| 94 | +# structure of graphene in a tight-binding model with nearest neighbour |
| 95 | +# interactions. |
| 96 | + |
| 97 | +# We may, for instance, calculate the eigen-spectrum at the Gamma-point: |
| 98 | +print("Eigenvalues at Gamma:") |
| 99 | +print(H.eigh()) |
| 100 | +print("Eigenvalues at K:") |
| 101 | +print(H.eigh(k=[1./3,2./3,0])) |
| 102 | +print() |
| 103 | + |
| 104 | +# Additionally we may calculate the band-structure of graphene |
| 105 | +# We want to plot the band-structure of graphene |
| 106 | + |
| 107 | +from graphene_band_structure import bandstructure |
| 108 | + |
| 109 | +# Now lets plot the band-structure (requires matplotlib) |
| 110 | +bandstructure(301, H) |
| 111 | + |
0 commit comments