mirror of
https://github.com/triqs/dft_tools
synced 2024-10-31 19:23:45 +01:00
Add doc for tightbinding and bravaislattice.
This commit is contained in:
parent
c74105636c
commit
cd77520a78
@ -40,33 +40,33 @@ In TRIQS, the tail is implemented as an object ``tail``. Here is a simple exampl
|
|||||||
|
|
||||||
API
|
API
|
||||||
****
|
****
|
||||||
|
Here are the main methods of the ``tail`` class:
|
||||||
|
|
||||||
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
|
||||||
| Member | Description | Type |
|
| Member | Description | Type |
|
||||||
+=================================+========================================================================================+==========================+
|
+=================================+=========================================================================================+==========================+
|
||||||
| data() | 3-dim array of the coefficients: ``data(i,n,m)`` :math:`=(\mathbf{a}_{i+o_{min}})_{nm}` | data_view_type |
|
| data() | 3-dim array of the coefficients: ``data(i,n,m)`` :math:`=(\mathbf{a}_{i+o_{min}})_{nm}` | data_view_type |
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
| mask_view() | 2-dim (:math:`N_1 \times N_2`) array of the maximum non-zero indices | mask_view_type |
|
| mask_view() | 2-dim (:math:`N_1 \times N_2`) array of the maximum non-zero indices | mask_view_type |
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
| order_min() | minimum order | long |
|
| order_min() | minimum order | long |
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
| order_max() | maximum order | long |
|
| order_max() | maximum order | long |
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
| size() | first dim of data() | size_t |
|
| size() | first dim of data() | size_t |
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
| shape() | shape of data() | shape_type |
|
| shape() | shape of data() | shape_type |
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
| smallest_nonzeros() | order of the smallest_nonzero coefficient | long |
|
| smallest_nonzeros() | order of the smallest_nonzero coefficient | long |
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
| is_decreasing_at_infinity() | true if the tail is decreasing at infinity | bool |
|
| is_decreasing_at_infinity() | true if the tail is decreasing at infinity | bool |
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
| operator() (int n) | matrix_valued coefficient :math:`(\mathbf{a}_i)_{nm}` | mv_type |
|
| operator() (int n) | matrix_valued coefficient :math:`(\mathbf{a}_i)_{nm}` | mv_type |
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
| get_or_zero (int n) | matrix_valued coefficient :math:`(\mathbf{a}_i)_{nm}` | const_mv_type |
|
| get_or_zero (int n) | matrix_valued coefficient :math:`(\mathbf{a}_i)_{nm}` | const_mv_type |
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
| evaluate(dcomplex const &omega) | value of the tail at frequency omega | arrays::matrix<dcomplex> |
|
| evaluate(dcomplex const &omega) | value of the tail at frequency omega | arrays::matrix<dcomplex> |
|
||||||
+---------------------------------+----------------------------------------------------------------------------------------+--------------------------+
|
+---------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
|
||||||
|
|
||||||
|
|
||||||
The tail is DefaultConstructible, H5Serializable and BoostSerializable.
|
The tail is DefaultConstructible, H5Serializable and BoostSerializable.
|
||||||
|
@ -19,7 +19,7 @@ This is done with the code :
|
|||||||
|
|
||||||
.. plot:: reference/python/green/example.py
|
.. plot:: reference/python/green/example.py
|
||||||
:include-source:
|
:include-source:
|
||||||
:scale: 70
|
:scale: 50
|
||||||
|
|
||||||
In this very simple example, the Green's function is just a 1x1 block. Let's go through
|
In this very simple example, the Green's function is just a 1x1 block. Let's go through
|
||||||
the different steps of the example:
|
the different steps of the example:
|
||||||
|
@ -30,11 +30,3 @@ oplot(d,'-o')
|
|||||||
plt.xlim ( -5,5 )
|
plt.xlim ( -5,5 )
|
||||||
plt.ylim ( 0, 0.4)
|
plt.ylim ( 0, 0.4)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
plt.savefig("./ex1.png")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
127
doc/reference/python/lattice/ex2.py
Normal file
127
doc/reference/python/lattice/ex2.py
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
from numpy import array, zeros
|
||||||
|
import math
|
||||||
|
from pytriqs.lattice.tight_binding import *
|
||||||
|
|
||||||
|
# Define the Bravais Lattice : a square lattice in 2d
|
||||||
|
BL_1 = BravaisLattice(units = [(1,0,0) , (0,1,0) ], orbital_positions= {"": (0,0,0)} )
|
||||||
|
BL_2 = BravaisLattice(units = [(1,1,0) , (-1,1,0) ], orbital_positions= {"A": (0,0,0), "B": (.5,.5,0)} )
|
||||||
|
BL_4 = BravaisLattice(units = [(2,0,0) , (0,2,0) ], orbital_positions= {"A": (0,0,0), "B": (0,.5,0), "C": (.5,0,0), "D": (.5,.5,0)} )
|
||||||
|
|
||||||
|
# Hopping dictionaries
|
||||||
|
t = .25; tp = -.1;
|
||||||
|
|
||||||
|
hop_1= { (1,0) : [[ t]], (-1,0) : [[ t]], (0,1) : [[ t]], (0,-1) : [[ t]],
|
||||||
|
(1,1) : [[ tp]], (-1,-1): [[ tp]], (1,-1) : [[ tp]], (-1,1) : [[ tp]]
|
||||||
|
}
|
||||||
|
|
||||||
|
hop_2= { (0,0) :[[0.,t],
|
||||||
|
[t,0.]],
|
||||||
|
(1,0) : [[ tp, 0],
|
||||||
|
[ t ,tp]],
|
||||||
|
(-1,0) : [[ tp, t],
|
||||||
|
[ 0 ,tp]],
|
||||||
|
(0,1) :[[ tp, 0],
|
||||||
|
[ t, tp]],
|
||||||
|
(0,-1) :[[ tp, t],
|
||||||
|
[ 0 ,tp]],
|
||||||
|
(1,1) : [[ 0, 0],
|
||||||
|
[ t,0]],
|
||||||
|
(-1,-1) :[[ 0, t],
|
||||||
|
[ 0,0]],
|
||||||
|
(-1,1) : [[ 0, 0],
|
||||||
|
[ 0,0]],
|
||||||
|
(1,-1) : [[ 0, 0],
|
||||||
|
[ 0,0]]
|
||||||
|
}
|
||||||
|
|
||||||
|
hop_4= { (0,0) :[[0.,t, tp,t],
|
||||||
|
[t,0., t,tp],
|
||||||
|
[tp,t,0,t],
|
||||||
|
[t,tp,t,0]],
|
||||||
|
|
||||||
|
(1,0) : [[0.,0, 0,0],
|
||||||
|
[t,0.,0,tp],
|
||||||
|
[tp,0,0,t],
|
||||||
|
[0,0,0,0]],
|
||||||
|
|
||||||
|
(-1,0) : [[0.,t, tp,0],
|
||||||
|
[0,0.,0,0],
|
||||||
|
[0,0,0,0],
|
||||||
|
[0,tp,t,0]],
|
||||||
|
|
||||||
|
(0,1) : [[0.,0, 0,0],
|
||||||
|
[0,0.,0,0],
|
||||||
|
[tp,t,0,0],
|
||||||
|
[t,tp,0,0]],
|
||||||
|
|
||||||
|
(0,-1) :[[0.,0, tp,t],
|
||||||
|
[0,0.,t,tp],
|
||||||
|
[0,0,0,0],
|
||||||
|
[0,0,0,0]],
|
||||||
|
|
||||||
|
(1,1) : [[0.,0, 0,0],
|
||||||
|
[0,0.,0,0],
|
||||||
|
[tp,0,0,0],
|
||||||
|
[0,0,0,0]],
|
||||||
|
|
||||||
|
(-1,-1) : [[0.,0, tp,0],
|
||||||
|
[0,0.,0,0],
|
||||||
|
[0,0,0,0],
|
||||||
|
[0,0,0,0]],
|
||||||
|
|
||||||
|
(-1,1) : [[0.,0, 0,0],
|
||||||
|
[0,0.,0,0],
|
||||||
|
[0,0,0,0],
|
||||||
|
[0,tp,0,0]],
|
||||||
|
|
||||||
|
(1,-1) :[[0.,0, 0,0],
|
||||||
|
[0,0.,0,tp],
|
||||||
|
[0,0,0,0],
|
||||||
|
[0,0,0,0]],
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TB_1 = TightBinding(BL_1, hop_1)
|
||||||
|
TB_2 = TightBinding(BL_2, hop_2)
|
||||||
|
TB_4 = TightBinding(BL_4, hop_4)
|
||||||
|
|
||||||
|
# High-symmetry points
|
||||||
|
Gamma = array([0. ,0. ]);
|
||||||
|
PiPi = array([math.pi ,math.pi ])*1/(2*math.pi);
|
||||||
|
Pi0 = array([math.pi ,0 ])*1/(2*math.pi);
|
||||||
|
PihPih = array([math.pi/2 ,math.pi/2])*1/(2*math.pi)
|
||||||
|
TwoPi0 = array([2*math.pi ,0 ])*1/(2*math.pi);
|
||||||
|
TwoPiTwoPi= array([math.pi*2 ,math.pi*2])*1/(2*math.pi)
|
||||||
|
|
||||||
|
n_pts=50
|
||||||
|
|
||||||
|
# Paths along high-symmetry directions
|
||||||
|
path_1=[Gamma,Pi0,PiPi,Gamma]
|
||||||
|
path_2=[Gamma,PiPi,TwoPi0,Gamma] #equivalent to path_1 in coordinates of 2at/ucell basis
|
||||||
|
path_4=[Gamma,TwoPi0,TwoPiTwoPi,Gamma] #equivalent to path_1 in coordinates of 4at/ucell basis
|
||||||
|
|
||||||
|
def energies_on_path(path, TB, n_pts, n_orb=1):
|
||||||
|
E=zeros((n_orb,n_pts*(len(path)-1)))
|
||||||
|
for i in range(len(path)-1,0,-1):
|
||||||
|
energies = energies_on_bz_path (TB, path[i-1], path[i], n_pts)
|
||||||
|
for orb in range(n_orb): E[orb,(i-1)*n_pts:(i)*n_pts]=energies[orb,:]
|
||||||
|
print "index of point #"+str(i-1)+" = "+str((i-1)*n_pts)
|
||||||
|
|
||||||
|
return E
|
||||||
|
E_1= energies_on_path(path_1,TB_1,n_pts,1)
|
||||||
|
E_2= energies_on_path(path_2,TB_2,n_pts,2)
|
||||||
|
E_4= energies_on_path(path_4,TB_4,n_pts,4)
|
||||||
|
|
||||||
|
from matplotlib import pylab as plt
|
||||||
|
plt.plot(E_1[0], '--k', linewidth=4, label = "1 at/unit cell")
|
||||||
|
plt.plot(E_2[0],'-.g', linewidth=4, label = "2 ats/unit cell")
|
||||||
|
plt.plot(E_2[1],'-.g', linewidth=4)
|
||||||
|
plt.plot(E_4[0],'-r', label = "4 ats/unit cell")
|
||||||
|
plt.plot(E_4[1],'-r')
|
||||||
|
plt.plot(E_4[2],'-r')
|
||||||
|
plt.plot(E_4[3],'-r')
|
||||||
|
plt.grid()
|
||||||
|
plt.legend()
|
||||||
|
plt.axes().set_xticks([0,50,100,150])
|
||||||
|
plt.axes().set_xticklabels([r'$\Gamma_1$',r'$M_1$',r'$X_1$',r'$\Gamma_1$'])
|
||||||
|
plt.ylabel(r"$\epsilon$")
|
@ -32,7 +32,7 @@ Reference manual
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
|
|
||||||
bravais
|
bravais
|
||||||
tightbinding
|
tightbinding_and_example
|
||||||
dos
|
dos
|
||||||
hilbert
|
hilbert
|
||||||
sumk
|
sumk
|
||||||
|
74
doc/reference/python/lattice/tightbinding_and_example.rst
Normal file
74
doc/reference/python/lattice/tightbinding_and_example.rst
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
The BravaisLattice and TightBinding classes: definitions and example
|
||||||
|
====================================================================
|
||||||
|
|
||||||
|
|
||||||
|
The following example is aimed at demonstrating the use of **TRIQS
|
||||||
|
Lattice tools**.
|
||||||
|
|
||||||
|
BravaisLattice
|
||||||
|
--------------
|
||||||
|
|
||||||
|
A ``BravaisLattice`` is constructed as
|
||||||
|
``BravaisLattice(units, orbital_positions )`` where
|
||||||
|
|
||||||
|
- ``units`` is the list the coordinates (given as triplets) of the
|
||||||
|
basis vectors :math:`\lbrace \mathbf{e}_i \rbrace _{i=1\dots d}`
|
||||||
|
(:math:`d` is the dimension)
|
||||||
|
- ``orbital_positions`` is a dictionary of the atoms forming the basis
|
||||||
|
of the Bravais Lattice: the key is the name of the atom/orbital, the
|
||||||
|
value is the triplet of its coordinates.
|
||||||
|
|
||||||
|
TightBinding
|
||||||
|
------------
|
||||||
|
|
||||||
|
A tight-binding lattice is defined by the relation:
|
||||||
|
|
||||||
|
.. math:: \mathbf{t}_k = \sum_{\mathbf{R}\in \mathrm{BL}} e^{i \mathbf{k}\cdot \mathbf{R}} \mathbf{t}_\mathbf{R}
|
||||||
|
|
||||||
|
where :math:`\mathbf{t}_i` is the matrix of the hoppings from a
|
||||||
|
reference unit cell (:math:`\mathbf{R}=O`\ ) to a unit cell indexed by
|
||||||
|
:math:`\mathbf{R}`\ . :math:`(\mathbf{t}_\mathbf{R})_{n,m}` is the
|
||||||
|
tight-binding integral between atom :math:`n` of site :math:`O` and atom
|
||||||
|
:math:`m` of site :math:`\mathbf{R}`\ , ie
|
||||||
|
|
||||||
|
.. math:: (\mathbf{t}_\mathbf{R})_{n,m} \equiv \int d^3\mathbf{r} \phi_n(\mathbf{r})^{*} V(\mathbf{r}) \phi_m(\mathbf{r}-\mathbf{R})
|
||||||
|
|
||||||
|
where :math:`\phi_n(\mathbf{r}-\mathbf{R})` is the Wannier orbital of
|
||||||
|
atom :math:`n` centered at site :math:`\mathbf{R}`\ . The corresponding
|
||||||
|
class in **Lattice Tools** is the ``TightBinding`` class. Its instances
|
||||||
|
are constructed as follows:
|
||||||
|
|
||||||
|
``TightBinding ( bravais_lattice, hopping_dictionary)`` where
|
||||||
|
|
||||||
|
- ``bravais_lattice`` is an instance of ``BravaisLattice``
|
||||||
|
- ``hopping_dictionary`` is a dictionary of the hoppings
|
||||||
|
:math:`\mathbf{t}_\mathbf{R}`\ , where the keys correspond to the
|
||||||
|
coordinates of :math:`\mathbf{R}` in the unitary basis
|
||||||
|
:math:`\lbrace \mathbf{e}_i \rbrace _{i=1\dots d}`\ , and the values
|
||||||
|
to the corresponding matrix: :math:`(\mathbf{t}_\mathbf{R})_{n,m}`
|
||||||
|
|
||||||
|
energies_on_bz_path
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
The function ``energies_on_bz_path (TB, start, end, n_pts)`` returns a
|
||||||
|
:math:`n_{at} \times n_{pts}` matrix :math:`E` such that
|
||||||
|
|
||||||
|
``E[n,k]``:math:`= \epsilon_n(\mathbf{k})`
|
||||||
|
|
||||||
|
where ``k`` indexes the ``n_pts`` :math:`\mathbf{k}`\ -points of the
|
||||||
|
line joining ``start`` and ``end``, and :math:`\epsilon_n(k)` is the
|
||||||
|
:math:`n`\ th eigenvector of :math:`t_\mathbf{k}`\ .
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
|
The following example illustrates the usage of the above tools for the
|
||||||
|
case of a two-dimensional, square lattice with various unit cells. We
|
||||||
|
successively construct three Bravais lattices ``BL_1``, ``BL_2`` and
|
||||||
|
``BL_4`` with, respectively, 1, 2 and 4 atoms per unit cell, as well as
|
||||||
|
three tight-binding models with hopping dictionaries ``hop_1``,
|
||||||
|
``hop_2`` and ``hop_4``
|
||||||
|
|
||||||
|
.. plot:: reference/python/lattice/ex2.py
|
||||||
|
:include-source:
|
||||||
|
:scale: 70
|
@ -9,12 +9,9 @@ neighbour hopping using the ``BravaisLattice`` class of TRIQS, compute its
|
|||||||
density of states (DOS) and then plot it by using again the ``oplot`` function.
|
density of states (DOS) and then plot it by using again the ``oplot`` function.
|
||||||
|
|
||||||
|
|
||||||
.. literalinclude:: ../../reference/python/lattice/ex1.py
|
.. plot:: reference/python/lattice/ex1.py
|
||||||
:lines: 1-34
|
:include-source:
|
||||||
|
:scale: 70
|
||||||
.. image:: ../../reference/python/lattice/ex1.png
|
|
||||||
:width: 700
|
|
||||||
:align: center
|
|
||||||
|
|
||||||
More information on the lattice tools implemeted in TRIQS can be :doc:`found here <../../reference/python/lattice/lattice>`
|
More information on the lattice tools implemeted in TRIQS can be :doc:`found here <../../reference/python/lattice/lattice>`
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user