~nickpapior/siesta/tddft-work

« back to all changes in this revision

Viewing changes to Src/m_ts_sparse.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:
46
46
  ! After using this sparsity pattern, we do not need the listud[g] arrays
47
47
  ! as this sparsity pattern is a reflection of the mask used by listud[g]
48
48
  ! This reflects the local sparsity pattern updated elements.
 
49
  ! This is a *SORTED* sparse matrix
49
50
  type(Sparsity), save :: ltsup_sp_sc ! TS-update-local (SC)
50
51
 
51
52
  ! This is an index array which points from ltsup_sp_sc to the local siesta
280
281
  subroutine ts_Sp_calculation(dit,s_sp,N_Elec,Elecs, &
281
282
       ucell, nsc, isc_off, &
282
283
       ts_sp)
 
284
 
 
285
    use parallel, only: IONode
283
286
    
284
287
    use class_OrbitalDistribution
285
288
    use class_Sparsity
302
305
    type(tRgn) :: r_oE(N_Elec), r_tmp1, r_tmp2
303
306
    integer :: iEl, i
304
307
 
 
308
    integer :: init_nz, old_nz
 
309
 
305
310
    if ( r_oBuf%n > 0 ) then
306
311
       ! Remove buffer atoms...
307
312
       call Sp_remove_region(dit,s_sp,r_oBuf,ts_sp)
309
314
       ts_sp = s_sp
310
315
    end if
311
316
 
 
317
    ! Get initial number of nnz
 
318
    init_nz = nnzs(ts_sp)
 
319
 
312
320
    ! Remove all electrode to other side connections
313
321
    ! this only has effect when we cross 
314
322
    do iEl = 1 , N_Elec
327
335
       ! direction in the big cell
328
336
       i = Elecs(iEl)%pvt(Elecs(iEl)%t_dir)
329
337
 
 
338
       old_nz = nnzs(ts_sp)
330
339
       ! Remove connections from this electrode across the boundary...
331
340
       call Sp_remove_crossterms(dit,ts_sp,product(nsc),isc_off, &
332
341
            i, ts_sp, r = r_tmp2)
 
342
       ! Update init_nz for the valid removed elements
 
343
       init_nz = init_nz - (old_nz - nnzs(ts_sp))
333
344
 
334
345
       ! We also be sure to remove all direct connections
335
346
       if ( iEl > 1 ) then
344
355
       call rgn_delete(r_tmp1,r_tmp2)
345
356
       
346
357
    end do
 
358
 
 
359
    i = nnzs(ts_sp)
 
360
    if ( i < init_nz .and. IONode ) then
 
361
       write(*,'(/a,i0,a/)')'*** WARNING! Removed ',init_nz - i, ' elements &
 
362
            &which connect electrodes across the device region!'
 
363
    end if
 
364
    
347
365
    do iEl = 1 , N_Elec
348
366
       call rgn_delete(r_oE(iEl))
349
367
    end do