~nickpapior/siesta/tddft-work

« back to all changes in this revision

Viewing changes to Util/TS/TBtrans/m_tbt_dSE.F90

  • Committer: Rafi Ullah
  • Date: 2017-09-27 12:02:36 UTC
  • mfrom: (611.1.22 trunk)
  • Revision ID: rraffiu@gmail.com-20170927120236-68zal54nt0bu1jxp
Merged with trunk-633

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
! ---
 
2
! Copyright (C) 1996-2016       The SIESTA group
 
3
!  This file is distributed under the terms of the
 
4
!  GNU General Public License: see COPYING in the top directory
 
5
!  or http://www.gnu.org/copyleft/gpl.txt .
 
6
! See Docs/Contributors.txt for a list of contributors.
 
7
! ---
 
8
 
 
9
 
 
10
! This code has been fully implemented by:
 
11
! Nick Papior, 2017.
 
12
!
 
13
! Please attribute the original author in case of dublication
 
14
 
 
15
! Enable the feature of manipulating with the
 
16
! Hamiltonian from outside.
 
17
 
 
18
! This is easily done by letting the user
 
19
! create a NetCDF file which contain dSE elements
 
20
! which will enter the NEGF equations through:
 
21
!   H = H + dSE
 
22
! We note that the user can input several different
 
23
!  dSE 
 
24
! corresponding to different situations.
 
25
! If dSE is complex, one can use dSE as an onsite
 
26
! self-energy change, thus introducing spurious
 
27
! effects.
 
28
!
 
29
! The dSE is effectively a change in the self-energies and
 
30
! will thus NOT enter in the equations for the bond-currents.
 
31
! If one has a dSE term that should contribute to the bond-currents
 
32
! please look at m_tbt_dH.F90.
 
33
 
 
34
! There are 4 levels of usage:
 
35
!   1. constant dSE
 
36
!      This will enter in a common equation
 
37
!   2. k-dependent dSE
 
38
!      This will only enter for the corresponding
 
39
!      k-point.
 
40
!         H_k = H_k + dSE_k' with dSE_k' = 0 for k/=k'
 
41
!   3. Energy
 
42
!      This will as 2. only enter for specific
 
43
!      energy points.
 
44
!         H(E) = H(E) + dSE(E') with dSE(E') = 0 for E/=E'
 
45
!   4. k and E dependent dSE
 
46
!         H_k(E) = H_k(E) + dSE_k'(E') with dSE_k'(E') = 0 for E/=E' and k/=k'
 
47
 
 
48
! Note that the highest level has precedence above the others,
 
49
! so specifying both 1. and 4. will only be the equivalent of
 
50
! using level 4.
 
51
 
 
52
! This is particularly handy for TB calculations
 
53
! but can prove just as useful for regular DFT
 
54
! calculations as one can use an already existing
 
55
! SIESTA.nc file, and then do several "case" studies
 
56
! on such a file, thus actually having FULL control
 
57
! over EVERYTHING.
 
58
 
 
59
module m_tbt_dSE
 
60
 
 
61
  use m_tbt_delta, only: tDelta
 
62
 
 
63
  implicit none
 
64
 
 
65
  private
 
66
 
 
67
  ! The dSE global variable
 
68
  type(tDelta), save :: dSE
 
69
 
 
70
  ! Whether this is used or not
 
71
  logical :: use_dSE = .false.
 
72
 
 
73
  public :: dSE, use_dSE
 
74
 
 
75
  public :: init_dSE_options, print_dSE_options
 
76
 
 
77
contains
 
78
 
 
79
  subroutine init_dSE_options( )
 
80
    use m_tbt_delta, only: init_delta_options, delta_has_level
 
81
 
 
82
    integer :: i
 
83
 
 
84
    use_dSE = .false.
 
85
    call init_delta_options('dSE', dSE)
 
86
 
 
87
    do i = 1 , 4
 
88
       use_dSE = use_dSE .or. delta_has_level(dSE, i)
 
89
    end do
 
90
 
 
91
  end subroutine init_dSE_options
 
92
 
 
93
  subroutine print_dSE_options( )
 
94
 
 
95
    use parallel, only : IONode
 
96
 
 
97
    character(len=*), parameter :: f10='(''tbt: '',a,t53,''='',tr4,a)'
 
98
    character(len=*), parameter :: f11='(''tbt: '',a)'
 
99
    character(len=*), parameter :: f1 ='(''tbt: '',a,t53,''='',tr4,l1)'
 
100
 
 
101
    if ( .not. IONode ) return
 
102
 
 
103
#ifdef NCDF_4
 
104
    if ( len_trim(dSE%fname) == 0 ) then
 
105
       write(*,f11)'No delta self-energy'
 
106
       return
 
107
    end if
 
108
    
 
109
    write(*,f10)'User selected dSE file', trim(dSE%fname)
 
110
#else
 
111
    write(*,f11)'delta self-energy cannot be used (requires NetCDF4)'
 
112
#endif
 
113
    
 
114
  end subroutine print_dSE_options
 
115
  
 
116
end module m_tbt_dSE