1!
2! Copyright (C) 2003 A. Smogunov
3! This file is distributed under the terms of the
4! GNU General Public License. See the file `License'
5! in the root directory of the present distribution,
6! or http://www.gnu.org/copyleft/gpl.txt .
7!
8!----------------------------------------------------------------------------
9!
10! ... Common variables for conductance calculation
11!
12!
13!
14MODULE geomcell_cond
15  USE kinds, only : DP
16  !
17  SAVE
18  !
19  INTEGER  ::  &
20     nrx,      &   !  number of mesh points in the x direction
21     nry,      &   !              -||-                 y direction
22     nrzl,     &   !  number of slabsh in the z direction for the left lead
23     nrzs,     &   !              -||-                    for the scatt. region
24     nrzr,     &   !              -||-                    for the right lead
25     nrzpl,    &   !  number of slabs per CPU for the left lead
26     nrzps,    &   !              -||-        for the scatt. region
27     nrzpr,    &   !              -||-        for the right lead
28     ngper,    &   !  number of perpendicular G vectors
29     ngpsh,    &   !  number of shells for G
30     nkpts,    &   !  number of kpts in the perpendicular direction
31     n2d,      &   !  dimension of reduced vector space in XY
32     nz1           !  number of subslabs in the slab
33  INTEGER   :: &
34            nk1ts, nk2ts, &    ! k-point mesh dimensions
35            k1ts, k2ts         ! k-point mesh shift
36  INTEGER, ALLOCATABLE :: &
37     ninsh(:),   & !  number of G in shell
38     nl_2ds(:),  & !  correspondence G list 2D smooth fft_mesh
39     nl_2d(:)      !  correspondence G list 2D fine fft_mesh
40  REAL(DP)    :: &
41     bdl,      &   !  right boundary of the left lead
42     bds,      &   !        -||-     of the scatt. region
43     bdr,      &   !        -||-     of the right lead
44     sarea         !  the cross section
45  REAL(DP), ALLOCATABLE ::  &
46     zl(:),    &   !  the division in the z direction of the left lead
47     zs(:),    &   !             -||-                 of the scatt. reg.
48     zr(:),    &   !             -||-                 of the right lead
49     xyk(:,:), &   !  coordinates of perpendicular k points
50     wkpt(:),  &   !  the weight of k point
51     gper(:,:),&   !  coordinates of perpendicular G
52     gnsh(:)       !  the norm of the G shell
53END MODULE geomcell_cond
54!
55!
56MODULE orbcell_cond
57  USE upf_params,   only: npsx
58  use radial_grids, only: ndmx
59  USE kinds, only : DP
60  !
61  !  description of nonlocal orbitals
62  SAVE
63  !
64  INTEGER, PARAMETER :: nbrx = 14
65  !
66  INTEGER     ::     &
67     norbl,          &  ! number of orbitals for the left lead
68     norbs,          &  !           -||-      for the scatt. region
69     norbr,          &  !           -||-      for the right lead
70     nocrosl,        &  ! number of crossing orbitals for left lead
71     nocrosr,        &  !           -||-      for the right lead
72     noinsl,         &  ! number of interior orbitals for the left lead
73     noinss,         &  !           -||-      for the scatt. region
74     noinsr,         &  !           -||-      for the right lead
75     norbf              ! max number of needed orbitals
76  INTEGER, ALLOCATABLE :: &
77     tblml(:,:),       &  ! the type/beta/l/m of each orbital for the left lead
78     tblms(:,:),       &  !         -||-                      for the scatt. reg.
79     tblmr(:,:),       &  !         -||-                      for the right lead
80     crosl(:,:),       &  ! 1 if the orbital crosses the slab - for the left lead
81     cross(:,:),       &  !                -||-                 for the scatt. reg.
82     crosr(:,:)           !                -||-                 for the right lead
83  REAL(DP) ::     &
84     rl(ndmx,npsx),          &  ! radial mesh for the left lead
85     rs(ndmx,npsx),          &  !      -||-   for the scatt. reg.
86     rr(ndmx,npsx),          &  !      -||-   for the right lead
87     rabl(ndmx,npsx),        &  ! log. mesh for the left lead
88     rabs(ndmx,npsx),        &  !      -||- for the scatt. reg.
89     rabr(ndmx,npsx),        &  !      -||- for the right lead
90     betarl(ndmx,nbrx,npsx), &  ! beta functions for the left lead
91     betars(ndmx,nbrx,npsx), &  !      -||-      for the scatt. reg.
92     betarr(ndmx,nbrx,npsx)     !      -||-      for the right lead
93  REAL(DP), ALLOCATABLE :: &
94     taunewl(:,:),  &  ! center of each orbital and its radius - left lead
95     taunews(:,:),  &  !                 -||-                  - scatt. reg.
96     taunewr(:,:),  &  !                 -||-                  - right lead
97     zpseul(:,:,:), &  ! coefficients of nonlocal pseudopotential - left lead
98     zpseus(:,:,:), &  !                 -||-                     - scatt. reg.
99     zpseur(:,:,:)     !                 -||-                     - right lead
100  COMPLEX(DP), ALLOCATABLE :: &
101     zpseul_nc(:,:,:,:), &! coefficients of nonlocal PP (nc case) - left lead
102     zpseus_nc(:,:,:,:), &!              -||-                     - scatt. reg.
103     zpseur_nc(:,:,:,:)   !              -||-                     - right lead
104END MODULE orbcell_cond
105!
106!
107MODULE eigen_cond
108  USE kinds, only : DP
109  !
110  !   Eigenvalue equation for local potential
111  SAVE
112  !
113  COMPLEX(DP), ALLOCATABLE  :: &
114     vppotl(:,:,:,:),  & ! Fourier comp. of local potential in each slab - left lead
115     vppots(:,:,:,:),  & !             -||-                              - scatt. reg.
116     vppotr(:,:,:,:),  & !             -||-                              - right lead
117     psiperl(:,:,:),   & ! eigenvectors in each slab - left lead
118     psipers(:,:,:),   & !             -||-          - scatt. reg.
119     psiperr(:,:,:),   & !             -||-          - right lead
120     zkl(:,:),         & ! the k for each eigenvalue (computed through zkr) - left lead
121     zks(:,:),         & !             -||-                                 - scatt. reg.
122     zkr(:,:),         & !             -||-                                 - right lead
123     newbg(:,:)          ! reduced basis set --> exp(G)
124  REAL(DP), ALLOCATABLE ::  &
125     zkrl(:,:),        & ! 2d eigenvalues - left lead
126     zkrs(:,:),        & !     -||-       - scatt. reg.
127     zkrr(:,:)           !     -||-       - right lead
128END MODULE eigen_cond
129!
130!
131MODULE control_cond
132  USE kinds, only : DP
133  !
134  !   control of the run
135  SAVE
136  !
137  INTEGER     :: &
138     orbj_in, orbj_fin, &
139     ikind,       &    ! the kind of calculation
140     nenergy,     &    ! number of energies computed
141     iofspin,     &    ! spin index for calculation
142     tk_plot,     &    ! if <>0 plot T(kx,ky) at each energy in the region (tk_plot x BZ)
143     start_e,last_e,  &! first and last energy to be computed
144     start_k,last_k    ! first and last k-point to be computed
145  REAL(DP)  :: &
146     efl,           &  ! the Ef of the left lead
147     efs,           &  ! the Ef of the scatt. reg.
148     efr,           &  ! the Ef of the right lead
149     energy0,       &  ! initial energy
150     eryd,          &  ! the current energy in Ry
151     denergy,       &  ! delta of energy
152     ecut2d,        &  ! 2D cutoff
153     ewind,         &  ! the window above energy for 2D computation
154     delgep,        &  ! infinitesimal for GEP
155     epsproj,       &  ! accuracy of n2d reduction
156     cutplot           ! cutoff of Im(k) for CB plotting
157  REAL(DP), ALLOCATABLE  :: &
158     earr(:),       &  ! energy array
159     tran_tot(:),   &  ! transmission array
160     tran_k(:),     &  ! k-resolved T(kx,ky)
161     rho_scatt(:,:)    ! charge and spin density
162  LOGICAL        :: &
163     loop_ek,       &  ! if .t. the energy loop is outside the k-point loop
164     lorb,          &  ! if .t. calculate the scattering (or Bloch) states
165     lorb3d,        &  ! if .t. 3D output of scatt. states (in XCRYSDENS format)
166     lcharge,       &  ! if .t. computes the total charge and spin density
167     lwrite_loc,    &  ! if .t. save eigenproblem result on fil_loc
168     lread_loc,     &  ! if .t. read eigenproblem result from fil_loc
169     lwrite_cond,   &  ! if .t. save variables needed for pwcond
170     lread_cond,    &  ! if .t. read variables needed for pwcond
171     llocal,        &  ! if .t. the local implementation
172     recover           ! if .t. restarts from previous run
173END MODULE control_cond
174!
175!
176MODULE scattnl_cond
177  USE kinds
178  !
179  ! ... The variables computed by scatter_forw
180  !
181  SAVE
182  !
183  COMPLEX(DP), ALLOCATABLE :: &
184       fun0(:,:),      &!  local fun. on         left boundary
185       fun1(:,:),      &!       --              right boundary
186       fund0(:,:),     &!  local fun.' on        left boundary
187       fund1(:,:),     &!       --              right boundary
188       funl0(:,:),     &!  nonloc. fun. on       left boundary
189       funl1(:,:),     &!       --              right boundary
190       fundl0(:,:),    &!  nonlocal fun.' on     left boundary
191       fundl1(:,:),    &!       --              right boundary
192       funz0(:,:,:),   &!  local+nonlocal fun. on all slabs
193       korbl(:,:),     &!  integrals of Bloch states with boundary orbitals for LEFT
194       korbr(:,:),     &!          and  RIGHT leads
195       intw1(:,:),     &!  integrals with beta-fun. of loc. fun.
196       intw2(:,:)       !       --                   nonloc fun.
197  !
198END MODULE scattnl_cond
199!
200!
201MODULE cb_cond
202  USE kinds
203  !
204  ! ... Some variables of CBS for the leads needed for matching
205  !
206  SAVE
207  !
208  INTEGER :: &
209       nchanl,         &!  number of prop. channels in the left lead
210       nchanr           !            -- || --              right lead
211  COMPLEX(DP), ALLOCATABLE :: &
212       kvall(:),       &!  k           for the left lead
213       kfunl(:,:),     &!  phi_k(z=d)  for the left lead
214       kfundl(:,:),    &!  phi_k'(z=d) for the left lead
215       kintl(:,:),     &!  integral of phi_k with beta-fun.
216       kcoefl(:,:),    &!  coeff. of phi_k over nonloc. fun.
217       kvalr(:),       &!  k           for the right lead
218       kfunr(:,:),     &!  phi_k(z=0)  for the right lead
219       kfundr(:,:),    &!  phi_k'(z=0) for the right lead
220       kintr(:,:),     &!  integral of phi_k with beta-fun.
221       kcoefr(:,:)      !  coeff. of phi_k over nonloc. fun.
222  !
223END MODULE cb_cond
224!
225MODULE cond_files
226  !
227  ! ... File names
228  !
229  SAVE
230  !
231  CHARACTER(LEN=256) :: band_file = ' '
232  CHARACTER(LEN=256) :: tran_file = ' '   !
233  CHARACTER(LEN=256) :: save_file = ' '   !
234  CHARACTER(LEN=256) :: prefixt   = ' '
235  CHARACTER(LEN=256) :: prefixl   = ' '
236  CHARACTER(LEN=256) :: prefixs   = ' '
237  CHARACTER(LEN=256) :: prefixr   = ' '
238  CHARACTER(LEN=256) :: tran_prefix = ' '  !  prefix for restart directory
239  CHARACTER(LEN=12), PARAMETER :: tk_file = 'transmission'
240  CHARACTER(LEN=256) :: fil_loc = ' '      !  file with 2D eigenvectors and eigenvalues
241  !
242END MODULE cond_files
243!
244MODULE cond
245  use geomcell_cond
246  USE orbcell_cond
247  USE eigen_cond
248  USE control_cond
249  USE scattnl_cond
250  USE cb_cond
251  USE cond_files
252END MODULE cond
253
254