-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Original v1.5 release from http://www.physics.rutgers.edu/~dhv/pytb/
- Loading branch information
1 parent
2bb9636
commit 842274a
Showing
17 changed files
with
2,980 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
In order to install PyTB package, simply execute this command as root | ||
|
||
python setup.py install | ||
|
||
or execute this command as normal (non-root) user | ||
|
||
sudo python setup.py install | ||
|
||
If you do not have root privileges then you can use the following command | ||
to install PyTB in arbitrary folder DIR | ||
|
||
python setup.py install --home=DIR | ||
|
||
After executing this command you will need to add "DIR/lib/python" or equivalent | ||
to PYTHONPATH variable. For example, in bash you would use | ||
|
||
export PYTHONPATH=$PYTHONPATH:DIR/lib/python | ||
|
||
|
||
For more details on PyTB package go to | ||
|
||
http://www.physics.rutgers.edu/~dhv/pytb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Metadata-Version: 1.0 | ||
Name: pytb | ||
Version: 1.5 | ||
Summary: Simple solver for tight binding models. | ||
Home-page: http://www.physics.rutgers.edu/~dhv/pytb | ||
Author: Sinisa Coh and David Vanderbilt | ||
Author-email: [email protected] [email protected] | ||
License: gpl-3.0 | ||
Description: The tight binding method is an approximate | ||
approach for solving for the electronic wave functions for | ||
electrons in solids assuming a basis of localized atomic-like | ||
orbitals. | ||
Platform: UNIX | ||
Platform: Windows | ||
Platform: Mac OS X |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env python | ||
|
||
# Version 1.5 | ||
# zero dimensional tight-binding model of a NH3 molecule | ||
|
||
# Copyright under GNU General Public License 2010, 2012 | ||
# by Sinisa Coh and David Vanderbilt (see gpl-pytb.txt) | ||
|
||
from pytb import * # import TB model class | ||
import numpy as nu | ||
import pylab as pl | ||
|
||
# define lattice vectors | ||
lat=[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]] | ||
# define coordinates of orbitals | ||
sq32=nu.sqrt(3.0)/2.0 | ||
orb=[[(2./3.)*sq32,0.,0.], | ||
[(-1./3.)*sq32,1./2.,0.], | ||
[(-1./3.)*sq32,-1./2.,0.], | ||
[0.,0.,1.]] | ||
# make zero dimensional tight-binding model | ||
my_model=tbmodel(0,3,lat,orb) | ||
|
||
# set model parameters | ||
delta=0.5 | ||
t_first=1.0 | ||
|
||
# change on-site energies so that N and H don't have the same energy | ||
my_model.set_sites([-delta,-delta,-delta,delta]) | ||
# set hoppings (one for each connected pair of orbitals) | ||
# (amplitude, i, j) | ||
my_model.add_hop(t_first, 0, 1) | ||
my_model.add_hop(t_first, 0, 2) | ||
my_model.add_hop(t_first, 0, 3) | ||
my_model.add_hop(t_first, 1, 2) | ||
my_model.add_hop(t_first, 1, 3) | ||
my_model.add_hop(t_first, 2, 3) | ||
|
||
# print tight-binding model | ||
my_model.display() | ||
|
||
print '---------------------------------------' | ||
print 'starting calculation' | ||
print '---------------------------------------' | ||
print 'Calculating bands...' | ||
print 'Band energies' | ||
# solve for eigenenergies of hamiltonian | ||
evals=my_model.solve_all() | ||
|
||
# First make a figure object | ||
fig=pl.figure() | ||
# plot all states | ||
pl.plot(evals,"bo") | ||
pl.ylim(-1.8,3.2) | ||
pl.xlim(-1.,4.) | ||
# put title | ||
pl.title("Molecule levels") | ||
# make an PDF figure of a plot | ||
pl.savefig("spectrum.pdf") | ||
|
||
print 'Done.\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/env python | ||
|
||
# Version 1.5 | ||
# two dimensional tight-binding checkerboard model | ||
|
||
# Copyright under GNU General Public License 2010, 2012 | ||
# by Sinisa Coh and David Vanderbilt (see gpl-pytb.txt) | ||
|
||
from pytb import * # import TB model class | ||
import numpy as nu | ||
import pylab as pl | ||
|
||
# define lattice vectors | ||
lat=[[1.0,0.0],[0.0,1.0]] | ||
# define coordinates of orbitals | ||
orb=[[0.0,0.0],[0.5,0.5]] | ||
|
||
# make two dimensional tight-binding checkerboard model | ||
my_model=tbmodel(2,2,lat,orb) | ||
|
||
# set model parameters | ||
delta=1.1 | ||
t=0.6 | ||
|
||
# set on-site energies | ||
my_model.set_sites([-delta,delta]) | ||
# set hoppings (one for each connected pair of orbitals) | ||
# (amplitude, i, j, [lattice vector to cell containing j]) | ||
my_model.add_hop(t, 1, 0, [0, 0]) | ||
my_model.add_hop(t, 1, 0, [1, 0]) | ||
my_model.add_hop(t, 1, 0, [0, 1]) | ||
my_model.add_hop(t, 1, 0, [1, 1]) | ||
|
||
# print tight-binding model | ||
my_model.display() | ||
|
||
# generate list of k-points following some high-symmetry line in | ||
# the k-space. Variable kpts here is just an array of k-points | ||
path=[[0.0,0.0],[0.0,0.5],[0.5,0.5],[0.0,0.0]] | ||
kpts=k_path(path,100) | ||
print '---------------------------------------' | ||
print 'report of k-point path' | ||
print '---------------------------------------' | ||
print 'Path runs over',len(kpts),'k-points connecting:' | ||
for k in path: | ||
print k | ||
|
||
print '---------------------------------------' | ||
print 'starting calculation' | ||
print '---------------------------------------' | ||
print 'Calculating bands...' | ||
|
||
# solve for eigenenergies of hamiltonian on | ||
# the set of k-points from above | ||
evals=my_model.solve_all(kpts) | ||
|
||
# plotting of band structure | ||
print 'Plotting bandstructure...' | ||
|
||
# First make a figure object | ||
fig=pl.figure() | ||
# plot first band | ||
pl.plot(evals[0]) | ||
# plot second band | ||
pl.plot(evals[1]) | ||
# put title | ||
pl.title("Checkerboard band structure") | ||
# make an PDF figure of a plot | ||
pl.savefig("band.pdf") | ||
|
||
print 'Done.\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env python | ||
|
||
# Version 1.5 | ||
# prints out eigenvectors of two dimensional tight-binding checkerboard model | ||
|
||
# Copyright under GNU General Public License 2010, 2012 | ||
# by Sinisa Coh and David Vanderbilt (see gpl-pytb.txt) | ||
|
||
from pytb import * # import TB model class | ||
import numpy as nu | ||
import pylab as pl | ||
|
||
# define lattice vectors | ||
lat=[[1.0,0.0],[0.0,1.0]] | ||
# define coordinates of orbitals | ||
orb=[[0.0,0.0],[0.5,0.5]] | ||
|
||
# make two dimensional tight-binding checkerboard model | ||
my_model=tbmodel(2,2,lat,orb) | ||
|
||
# set model parameters | ||
delta=1.1 | ||
t=0.6 | ||
|
||
# set on-site energies | ||
my_model.set_sites([-delta,delta]) | ||
# set hoppings (one for each connected pair of orbitals) | ||
# (amplitude, i, j, [lattice vector to cell containing j]) | ||
my_model.add_hop(t, 1, 0, [0, 0]) | ||
my_model.add_hop(t, 1, 0, [1, 0]) | ||
my_model.add_hop(t, 1, 0, [0, 1]) | ||
my_model.add_hop(t, 1, 0, [1, 1]) | ||
|
||
# print tight-binding model | ||
my_model.display() | ||
|
||
# generate list of k-points following some high-symmetry line in | ||
# the k-space. Variable kpts here is just an array of k-points | ||
path=[[0.0,0.0],[0.0,0.5]] | ||
kpts=k_path(path,10) | ||
print '---------------------------------------' | ||
print 'report of k-point path' | ||
print '---------------------------------------' | ||
print 'Path runs over',len(kpts),'k-points connecting:' | ||
for k in path: | ||
print k | ||
|
||
print '---------------------------------------' | ||
print 'starting calculation' | ||
print '---------------------------------------' | ||
print 'Calculating bands...' | ||
|
||
# solve for eigenenergies of hamiltonian on | ||
# the set of k-points from above | ||
(evals,evects)=my_model.solve_all(kpts,eig_vectors=True) | ||
|
||
print 'Print out eigenvalues and eigenvectors' | ||
|
||
# go over all k-points | ||
for k in range(len(kpts)): | ||
print 'k-vector --> ',kpts[k] | ||
# go over all bands | ||
for b in range(2): | ||
print ' band --> ', b | ||
print ' eigenvalue --> ',evals[b,k] | ||
# go over all sites | ||
for s in range(2): | ||
print ' u_nk(orbital='+str(s)+') --> ', | ||
print evects[b,k,s] | ||
|
||
# First make a figure object | ||
fig=pl.figure() | ||
# plot real part of the wavefunction of first band at second orbital | ||
pl.plot(evects[0,:,1].real) | ||
pl.ylim(-1.,1.) | ||
# put title | ||
pl.title("Real part of the wf. of 1st band at 2nd orbital") | ||
# make an PDF figure of a plot | ||
pl.savefig("evec.pdf") | ||
|
||
print 'Done.\n' |
Oops, something went wrong.