1! ---
2! Copyright (C) 1996-2016	The SIESTA group
3!  This file is distributed under the terms of the
4!  GNU General Public License: see COPYING in the top directory
5!  or http://www.gnu.org/copyleft/gpl.txt .
6! See Docs/Contributors.txt for a list of contributors.
7! ---
8
9module m_ts_global_vars
10
11  implicit none
12
13  save
14
15  ! Whether transiesta is the solver
16  logical :: TSmode = .false.
17
18  ! Controls the change from diagon to transiesta solver
19  logical :: TSinit = .false. , TSrun = .false.
20
21  ! Whether this is an only overlap calculation
22  logical :: onlyS = .false.
23
24contains
25
26  subroutine ts_method_init( start )
27
28    use parallel, only : IONode
29    use densematrix, only: resetDenseMatrix
30
31    logical, intent(in) :: start
32
33    ! If we are not in transiesta mode, return
34    if ( .not. TSmode ) return
35
36    if ( start ) then
37       ! Quick return if we are already inside transiesta
38       if ( TSrun ) return
39
40       ! We will immediately start Transiesta
41       TSinit = .false.
42       TSrun  = .true.
43
44       if ( IONode ) then
45          write(*,'(/a)')'transiesta: Starting immediately'
46       end if
47
48       ! Be sure to not have *too* much memory allocated
49       ! before entering transiesta
50       ! NOTE, this should not be needed, but just in case
51       ! future developments "forgets" about these arrays.
52       call resetDenseMatrix()
53
54       call ts_print_transiesta()
55
56    else
57
58       ! Tell transiesta to initialize the Hamiltonian with siesta
59
60       TSinit = .true.
61       TSrun  = .false.
62
63       if ( IONode ) then
64          write(*,'(/,a,/)') 'transiesta: Initialization run using siesta'
65       end if
66
67    end if
68
69  end subroutine ts_method_init
70
71  subroutine ts_print_transiesta()
72    use parallel, only : IONode
73    if ( IONode ) then
74       write(*,'(/,t22,a)') repeat('*',27)
75       write(*,  '(t22,a)') '*  WELCOME TO TRANSIESTA  *'
76       write(*,'(t22,a,/)') repeat('*',27)
77    end if
78  end subroutine ts_print_transiesta
79
80end module m_ts_global_vars
81