~siesta-ts/siesta/trunk_ts_soc

« back to all changes in this revision

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

  • Committer: Nils Wittemeier
  • Date: 2019-02-14 07:45:07 UTC
  • mfrom: (746.1.15 trunk)
  • Revision ID: nils@4wittemeier.de-20190214074507-1mvzbmj9kw19gllr
MergedĀ trunkĀ 761

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
! ---
2
 
! Copyright (C) 1996-2016       The SIESTA group
 
2
! Copyright (C) 1996-2016       The SIESTA group
3
3
!  This file is distributed under the terms of the
4
4
!  GNU General Public License: see COPYING in the top directory
5
5
!  or http://www.gnu.org/copyleft/gpl.txt .
13
13
module m_tbt_contour
14
14
 
15
15
  use precision, only : dp
16
 
  use fdf, only : leqi
 
16
  use fdf, only : leqi, fdf_convfac
17
17
 
18
18
! Use the type associated with the contour
19
19
! Maybe they should be collected to this module.
53
53
  subroutine read_contour_options(N_Elec,Elecs,N_mu,mus)
54
54
 
55
55
    use parallel, only : Node
56
 
    use units, only : eV
57
56
    use fdf
58
57
    use m_ts_electype
59
58
 
63
62
    integer, intent(in) :: N_mu
64
63
    type(ts_mu), intent(in), target :: mus(N_mu)
65
64
    
66
 
    real(dp) :: Volt, tmp, max_kT
 
65
    real(dp) :: Volt, tmp, max_kT, Ry2eV
67
66
    character(len=C_N_NAME_LEN) :: ctmp
68
67
#ifdef TBT_PHONON
69
68
    integer :: i
70
69
#endif
71
70
 
 
71
    Ry2eV = fdf_convfac('Ry', 'eV')
 
72
 
72
73
    ! broadening
73
74
    tbt_Eta = fdf_get('TBT.Contours.Eta',0._dp,'Ry')
74
 
#ifdef TBT_PHONON
75
 
    ! The half-width is squared as the phonon energy is
76
 
    tbt_Eta = tbt_Eta ** 2
77
 
#endif
78
75
    if ( tbt_Eta < 0._dp .and. Node == 0 ) then
 
76
      call die('tbtrans: error cannot use the advanced Green function')
79
77
       write(*,'(a)')'*** NOTICE ***'
80
78
       write(*,'(a)')'tbtrans will use the advanced Green function'
81
79
    end if
114
112
          tbt_io(1)%ca = '0. eV'
115
113
          tbt_io(1)%a  = 0._dp
116
114
          tbt_io(1)%cb = '0.5 eV'
117
 
          tbt_io(1)%b  =  0.5_dp * eV
 
115
          tbt_io(1)%b  =  0.5_dp / Ry2eV
118
116
          tbt_io(1)%cd = '0.0025 eV'
119
 
          tbt_io(1)%d = 0.0025_dp * eV
 
117
          tbt_io(1)%d = 0.0025_dp / Ry2eV
120
118
#else
121
119
          tbt_io(1)%ca = '-2. eV'
122
 
          tbt_io(1)%a  = - 2._dp * eV
 
120
          tbt_io(1)%a  = - 2._dp / Ry2eV
123
121
          tbt_io(1)%cb = '2. eV'
124
 
          tbt_io(1)%b  =  2._dp * eV
 
122
          tbt_io(1)%b  =  2._dp / Ry2eV
125
123
          tbt_io(1)%cd = '0.01 eV'
126
 
          tbt_io(1)%d = 0.01_dp * eV
 
124
          tbt_io(1)%d = 0.01_dp / Ry2eV
127
125
#endif
128
126
          tbt_io(1)%method = 'mid-rule'
129
127
       end if
136
134
    end if
137
135
 
138
136
#ifdef TBT_PHONON
 
137
    ! The half-width is squared as the phonon energy
 
138
    ! Important to do it here since the Eta should be propagated
 
139
    ! in units of Ry (and not Ry ** 2). All contours should be
 
140
    ! created with units Ry.
 
141
    tbt_Eta = tbt_Eta ** 2
 
142
    
139
143
    do i = 1 , N_tbt
140
144
       if ( tbt_io(i)%a < 0._dp ) then
141
145
          call die('Phonon transport is only defined for positive &
325
329
 
326
330
    end select
327
331
 
328
 
    c%c = dcmplx(ce,Eta)
329
 
    c%w(:,1) = dcmplx(cw,0._dp)
 
332
    c%c(:) = cmplx(ce,Eta, dp)
 
333
    c%w(:,1) = cmplx(cw,0._dp, dp)
330
334
 
331
335
    deallocate(ce,cw)
332
336
    
387
391
        read(line, *, iostat=iostat) rE, iE, rW, iW
388
392
      end if
389
393
      if ( iostat == 0 ) then
390
 
        c%c(ne) = dcmplx(rE,iE) * conv
391
 
        c%w(ne,1) = dcmplx(rW,iW) * conv
 
394
        c%c(ne) = cmplx(rE,iE, dp) * conv
 
395
        c%w(ne,1) = cmplx(rW,iW, dp) * conv
392
396
        cycle
393
397
      end if
394
398
 
401
405
        read(line, *, iostat=iostat) rE, iE, rW
402
406
      end if
403
407
      if ( iostat == 0 ) then
404
 
        c%c(ne) = dcmplx(rE,iE) * conv
405
 
        c%w(ne,1) = dcmplx(rW,iW) * conv
 
408
        c%c(ne) = cmplx(rE,iE, dp) * conv
 
409
        c%w(ne,1) = cmplx(rW,iW, dp) * conv
406
410
        cycle
407
411
      end if
408
412
 
416
420
        read(line, *, iostat=iostat) rE, rW
417
421
      end if
418
422
      if ( iostat == 0 ) then
419
 
        c%c(ne) = dcmplx(rE * conv,iE)
420
 
        c%w(ne,1) = dcmplx(rW,iW) * conv
 
423
        c%c(ne) = cmplx(rE * conv,iE, dp)
 
424
        c%w(ne,1) = cmplx(rW,iW, dp) * conv
421
425
        cycle
422
426
      end if
423
427
 
461
465
    integer :: i,j,iE
462
466
    c%exist = .false.
463
467
    c%fake  = .false.
464
 
    c%e     = dcmplx(0._dp,0._dp)
 
468
    c%e     = cmplx(0._dp,0._dp, dp)
465
469
    c%idx   = 0
466
470
    if ( id < 1 ) return
467
471
 
527
531
  subroutine print_contour_tbt_options(prefix)
528
532
 
529
533
    use parallel, only : IONode
530
 
    use units, only : eV
531
 
 
532
534
    use m_ts_io_contour
533
535
 
534
536
    character(len=*), intent(in) :: prefix
535
537
    character(len=200) :: chars
536
538
    integer :: i
537
539
    type(ts_c_opt_ll), pointer :: opt
 
540
    real(dp) :: Ry2eV
538
541
 
539
542
    if ( .not. IONode ) return
 
543
 
 
544
    Ry2eV = fdf_convfac('Ry', 'eV')
540
545
    
541
546
    write(*,opt_n) '             >> TBtrans contour << '
542
547
#ifdef TBT_PHONON
543
548
    write(*,opt_g_u) 'Device Green function imaginary Eta', &
544
 
         tbt_Eta/eV**2,'eV**2'
 
549
         tbt_Eta*Ry2eV**2,'eV**2'
545
550
#else
546
 
    write(*,opt_g_u) 'Device Green function imaginary Eta',tbt_Eta/eV,'eV'
 
551
    write(*,opt_g_u) 'Device Green function imaginary Eta',tbt_Eta*Ry2eV,'eV'
547
552
#endif
548
553
    do i = 1 , N_tbt
549
554
       chars = '  '//trim(tbt_io(i)%part)
583
588
    call io_assign( iu )
584
589
    open( iu, file=trim(fname), status='unknown' )
585
590
    write(iu,'(a)') '# Contour path for the transport part'
586
 
    write(iu,'(a,a19,3(tr1,a20))') '#','Re(c) [eV]','Im(c) [eV]','Weight'
 
591
    write(iu,'(a,a24,3(tr1,a25))') '#','Re(c) [eV]','Im(c) [eV]','w [eV]'
587
592
 
588
593
    cidx%idx(1) = CONTOUR_TBT
589
594
 
599
604
  end subroutine io_contour_tbt
600
605
 
601
606
  subroutine io_contour_c(iu,cidx)
602
 
    use units,    only : eV
 
607
    use fdf, only: fdf_convfac
603
608
    use m_ts_aux, only : nf
604
609
    integer, intent(in) :: iu
605
610
    type(ts_c_idx), intent(inout) :: cidx
606
611
    type(ts_cw), pointer :: c
607
612
    integer :: i
 
613
    real(dp) :: Ry2eV
 
614
    
 
615
    Ry2eV = fdf_convfac('Ry', 'eV')
608
616
 
609
617
    if ( cidx%idx(1) == CONTOUR_TBT ) then
610
618
       c => tbt_c(cidx%idx(2))
613
621
    end if
614
622
 
615
623
    do i = 1 , size(c%c)
616
 
       write(iu,'(3(e20.13,tr1))') c%c(i) / eV,real(c%w(i,1),dp) / eV
 
624
       write(iu,'(3(e25.17,tr1))') c%c(i) * Ry2eV, real(c%w(i,1),dp) * Ry2eV
617
625
    end do
618
626
 
619
627
  end subroutine io_contour_c