Skip to content

Instantly share code, notes, and snippets.

@quantum-kite
Last active June 11, 2018 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quantum-kite/19472b95b0348a161b8987137ea7e063 to your computer and use it in GitHub Desktop.
Save quantum-kite/19472b95b0348a161b8987137ea7e063 to your computer and use it in GitHub Desktop.
first example
""" Graphene DOS
Lattice : Graphene lattice;
Disorder : None;
Configuration : size of the system 512x512, without domain decomposition (nx=ny=1), periodic boundary conditions,
double precision, automatic scaling;
Calculation : DOS;
Modification : magnetic field is off;
"""
import numpy as np
import pybinding as pb
import kite
def graphene(onsite=(0, 0)):
"""Make a honeycomb lattice with nearest neighbor hopping
Parameters
----------
onsite : tuple or list
Onsite energy at different sublattices.
"""
theta = np.pi / 3
t = 2.8 # eV
a1 = np.array([1 + np.cos(theta), np.sin(theta)])
a2 = np.array([0, 2 * np.sin(theta)])
lat = pb.Lattice(
a1=a1, a2=a2
)
lat.add_sublattices(
# name, position, and onsite potential
('A', [0, 0], onsite[0]),
('B', [1, 0], onsite[1])
)
lat.add_hoppings(
([0, 0], 'A', 'B', - t),
([-1, 0], 'A', 'B', - t),
([-1, 1], 'A', 'B', - t)
)
return lat
# make a graphene lattice
lattice = graphene_initial()
# number of decomposition parts in each direction of matrix.
# This divides the lattice into various sections, each of which is calculated in parallel
nx = ny = 1
# number of unit cells in each direction.
lx = ly = 512
# make config object which caries info about
# - the number of decomposition parts [nx, ny],
# - lengths of structure [lx, ly]
# - boundary conditions, setting True as periodic boundary conditions, and False elsewise,
# - info if the exported hopping and onsite data should be complex,
# - info of the precision of the exported hopping and onsite data, 0 - float, 1 - double, and 2 - long double.
# - scaling, if None it's automatic, if present select spectrum_bound=[e_min, e_max]
configuration = kite.Configuration(divisions=[nx, ny], length=[lx, ly], boundaries=[True, True],
is_complex=False, precision=1)
# require the calculation of DOS
calculation = kite.Calculation(configuration)
calculation.dos(num_points=1000, num_moments=512, num_random=5, num_disorder=1)
# configure the *.h5 file
kite.config_system(lattice, configuration, calculation, filename='example1.h5')
@quantum-kite
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment