~nickpapior/siesta/tddft-work

« back to all changes in this revision

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

  • Committer: Rafi Ullah
  • Date: 2017-08-30 14:09:10 UTC
  • mfrom: (611.1.19 trunk)
  • Revision ID: rraffiu@gmail.com-20170830140910-bhu0osuh4d59wn8e
Merged with trunk-630

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
    type(parsed_line), pointer :: pline => null()
119
119
    character(len=50) :: g, csort
120
120
    integer :: i, ia1, ia2, no_u
 
121
    integer :: init_nz
121
122
    type(tRgn) :: r_tmp, r_tmp2, r_tmp3, r_Els, priority
122
123
    real(dp) :: tmp
123
124
 
213
214
       ! populate the device region with all atoms
214
215
       call rgn_range(r_aDev, 1, na_u)
215
216
    end if
 
217
    ! Just to speed up the following stuff
 
218
    call rgn_sort(r_aDev)
216
219
    
217
220
    ! remove the buffer and electrode atoms
218
221
    if ( r_aBuf%n > 0 ) then
318
321
 
319
322
    end do
320
323
 
 
324
 
 
325
    ! Retrieve initial number of non-zero elements
 
326
    ! Note that this number of non-zero elements is _after_
 
327
    ! we have removed those terms that connect across
 
328
    ! the cell boundaries.
 
329
    init_nz = nnzs(sp)
 
330
    
321
331
    do iEl = 1 , N_Elec - 1
322
332
 
323
333
       ! in order to get the correct connections
341
351
 
342
352
    end do
343
353
 
 
354
    ! Issue a warning if there are any removed elements
 
355
    ! from the above loop
 
356
    ! That would mean that there are connections across the device region
 
357
    ! which would mean a leak in the transmission.
 
358
    i = nnzs(sp)
 
359
    if ( i < init_nz .and. IONode ) then
 
360
       write(*,'(/a,i0,a/)')'*** WARNING! Removed ',init_nz - i, ' elements &
 
361
            &which connect electrodes across the device region!'
 
362
    end if
 
363
       
 
364
 
344
365
#ifdef TRANSIESTA_DEBUG
345
366
    open(file='NO_ELECTRODE_CONNECTIONS_SP',unit=1400,form='formatted')
346
367
    call sp_to_file(1400,sp)
538
559
    ! at TB models where number of connections is the same
539
560
 
540
561
    ! Prepare the check-regions
541
 
 
542
 
    csort = 'atom+'//trim(Elecs(1)%name)
 
562
    ! Default the device region pivoting to start from the electrode
 
563
    ! which has the largest overlap in the device region.
 
564
    ! This seems like the option that will provide the best BTD
 
565
    ! due to the larger initial base.
 
566
    iEl = 1
 
567
    do i = 2, N_Elec
 
568
       if ( rgn_size(Elecs(iEl)%o_inD) < rgn_size(Elecs(i)%o_inD) ) then
 
569
          iEl = i
 
570
       end if
 
571
    end do
 
572
    
 
573
    csort = 'atom+'//trim(Elecs(iEl)%name)
543
574
    csort = fdf_get('TS.BTD.Pivot',trim(csort))
544
575
    csort = fdf_get('TBT.BTD.Pivot',trim(csort))
545
576
    csort = fdf_get('TBT.BTD.Pivot.Device',trim(csort))