Commit c42999ca authored by Nick R. Papior's avatar Nick R. Papior
Browse files

transiesta now dies if the principal cell is not enforced

This may be controlled by the:
  TS.Elecs.Neglect.Principal
or for tbtrans
  TBT.Elecs.Neglect.Principal
We do this because it may often be misused by people unaware of the
physical implications of not having principal cell connections.
parent 7170066d
......@@ -1524,12 +1524,20 @@ contains
subroutine init_Electrode_HS(El)
use m_ts_electype
use fdf, only: fdf_get
#ifdef MPI
use mpi_siesta
#endif
use class_Sparsity
use class_dSpData1D
use class_dSpData2D
use m_ts_electype
type(Elec), intent(inout) :: El
#ifdef MPI
integer :: error
#endif
logical :: neglect_conn
! Read-in and create the corresponding transfer-matrices
call delete(El) ! ensure clean electrode
......@@ -1542,7 +1550,22 @@ contains
! print out the precision of the electrode (whether it extends
! beyond first principal layer)
call check_Connectivity(El)
if ( check_connectivity(El) ) then
neglect_conn = .true.
else
neglect_conn = fdf_get('TS.Elecs.Neglect.Principal', .false.)
#ifdef TBTRANS
neglect_conn = fdf_get('TBT.Elecs.Neglect.Principal', neglect_conn)
#endif
end if
#ifdef MPI
call MPI_Barrier(MPI_Comm_World,error)
#endif
if ( .not. neglect_conn ) then
call die('Electrode connectivity is not perfect, &
&refer to the manual for achieving a perfect electrode.')
end if
call create_sp2sp01(El)
! Clean-up, we will not need these!
......
......@@ -1650,7 +1650,7 @@ contains
end subroutine delete_
subroutine check_connectivity(this)
function check_connectivity(this) result(good)
use parallel, only : IONode
use units, only : eV
......@@ -1665,6 +1665,7 @@ contains
#endif
type(Elec), intent(inout) :: this
logical :: good
real(dp), pointer :: H(:,:)
real(dp), pointer :: S(:)
......@@ -1753,6 +1754,10 @@ contains
! clean-up
call delete(sp02)
! If both number
good = ind == 0
if ( .not. good ) good = maxi == 0
if ( .not. IONode ) return
if ( ind == 0 ) then
......@@ -1771,7 +1776,7 @@ contains
maxi,',',maxj,')|@R=',tm(this%t_dir),' = ',maxS
end if
end subroutine check_connectivity
end function check_connectivity
! Routine for checking the validity of the electrode against the
! system setup in transiesta
......
......@@ -31,6 +31,7 @@ contains
use parallel, only : IONode
use m_os, only : file_exist
use fdf, only: fdf_get
use m_ts_gf, only : do_Green, do_Green_Fermi
use m_ts_electrode, only : init_Electrode_HS
......@@ -66,6 +67,7 @@ contains
! *********************
! * LOCAL variables *
! *********************
logical :: neglect_conn
integer :: i, ia
integer :: nC, nTS
real(dp) :: mean_kT
......@@ -210,17 +212,35 @@ contains
end do
else
neglect_conn = .false.
do i = 1 , N_Elec
call delete(Elecs(i)) ! ensure clean electrode
call read_Elec(Elecs(i),Bcast=.true.)
! print out the precision of the electrode (whether it extends
! beyond first principal layer)
call check_Connectivity(Elecs(i))
if ( .not. check_Connectivity(Elecs(i)) ) then
neglect_conn = .true.
end if
call delete(Elecs(i))
end do
if ( neglect_conn ) then
neglect_conn = fdf_get('TS.Elecs.Neglect.Principal', .false.)
if ( .not. neglect_conn ) then
call die('Electrode connectivity is not perfect, refer &
&to the manual for achieving a perfect electrode.')
end if
end if
end if
end subroutine ts_init
......
trunk-536--transiesta-1
trunk-536--transiesta-2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment