Guest User

Untitled

a guest
Apr 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import export_lattice as ex
  3. import numpy as np
  4. import pybinding as pb
  5.  
  6. from pybinding.repository.graphene import t, a_cc, a
  7.  
  8. # define lattice of monolayer graphene with a_cc [nm] interatomic distance and t [eV] hopping,
  9. # EnergyScale is the scaling factor of the hopping parameters, important for the rescaling of the spectral quantity.
  10. energy_scale = 9.5
  11.  
  12.  
  13. def graphene(onsite=(0, 0)):
  14. """Return the basic lattice specification for monolayer graphene with nearest neighbor"""
  15.  
  16. from math import sqrt
  17.  
  18. # create a lattice with 2 primitive vectors
  19. lat = pb.Lattice(a1=[a, 0], a2=[a/2, a/2 * sqrt(3)])
  20.  
  21. # Add sublattices
  22. lat.add_sublattices(
  23. # name, position, and onsite potential
  24. ('A', [0, -a_cc/2], onsite[0]),
  25. ('B', [0, +a_cc/2], onsite[1])
  26. )
  27.  
  28. # Add hoppings
  29. lat.add_hoppings(
  30. # inside the main cell, between which atoms, and the value
  31. ([0, 0], 'A', 'B', t / energy_scale),
  32. # between neighboring cells, between which atoms, and the value
  33. ([1, -1], 'A', 'B', t / energy_scale),
  34. ([0, -1], 'A', 'B', t / energy_scale),
  35. )
  36.  
  37. return lat
  38.  
  39.  
  40. lattice, disorder, disorded_structural = graphene()
  41.  
  42. # number of decomposition parts in each direction of matrix. This divides the lattice into various sections, each of which is calculated in parallel
  43. nx = ny = 1
  44.  
  45. # number of unit cells in each direction.
  46. lx = 256
  47. ly = 256
  48.  
  49. # make config object which caries info about
  50. # - the number of decomposition parts [nx, ny],
  51. # - lengths of structure [lx, ly]
  52. # - boundary conditions, setting True as periodic boundary conditions, and False elsewise,
  53. # - info if the exported hopping and onsite data should be complex,
  54. # - info of the precision of the exported hopping and onsite data, 0 - float, 1 - double, and 2 - long double.
  55. configuration = ex.Configuration(divisions=[nx, ny], length=[lx, ly], boundaries=[True, True],
  56. is_complex=False, precision=1, energy_scale=energy_scale)
  57.  
  58. # make calculation object which caries info about
  59. # - the name of the function
  60. # DOS - denstity of states == 1,
  61. # CondXX - conductivity in xx direction == 2,
  62. # CondXY - conductivity in xy direction == 3,
  63. # OptCond - optical conductivity == 4
  64. # SpinCond - spin conductivity == 5
  65. # SingleCondXX - single energy XX conductivity == 6
  66. # SingleCondXY - single energy XY conductivity == 7
  67. # - number of moments for the calculation,
  68. # - number of different random vector realisations,
  69. # - number of disorder realisations.
  70. # - energy and gamma for single energy calculations.
  71. calculation = ex.Calculation(fname=['DOS'], num_moments=[500], num_random=[1], num_disorder=[1])
  72.  
  73. # make modification object which caries info about (TODO: Other modifications can be added here)
  74. # - magnetic field can be set to True. Default case is False. In exported file it's converted to 1 and 0.
  75. modification = ex.Modification(magnetic_field=False)
  76.  
  77. # export the lattice from the lattice object, config and calculation object and the name of the file
  78. # the disorder is optional. If there is disorder in the lattice for now it should be given separately
  79. ex.export_lattice(lattice, configuration, calculation, modification, 'graphene_example.h5')
  80.  
  81. # plotting the lattice
  82. lattice.plot()
  83. plt.show()
Add Comment
Please, Sign In to add comment