PROGRESS  master
prg_normalize_mod.F90
Go to the documentation of this file.
1 
2 !
3 !
4 
6 
7  use bml
8  use prg_graph_mod
10 
11  implicit none
12 
13  private !Everything is private by default
14 
15  integer, parameter :: dp = kind(1.0d0)
16 
17  public :: prg_normalize
19  public :: prg_normalize_fermi
20  public :: prg_normalize_cheb
21  public :: prg_gershgorinreduction
22 
23 contains
24 
32  subroutine prg_normalize(h_bml)
33 
34  type(bml_matrix_t),intent(inout) :: h_bml
35 
36  real(dp) :: alpha, beta, maxminusmin
37  real(dp), allocatable :: gbnd(:)
38 
39  allocate(gbnd(2))
40 
41  call bml_gershgorin(h_bml, gbnd)
42  call bml_normalize(h_bml, gbnd(1), gbnd(2))
43 
44  deallocate(gbnd)
45 
46  end subroutine prg_normalize
47 
59  subroutine prg_normalize_fermi(h_bml, h1, hN, mu)
60 
61  type(bml_matrix_t),intent(inout) :: h_bml
62  real(dp), intent(in) :: h1, hn, mu
63 
64  real(dp) :: alpha, beta, maxminusmininverse
65 
66  maxminusmininverse = 1.0_dp/(hn - h1)
67  alpha = -1.0_dp
68  beta = hn - mu
69  call bml_scale_add_identity(h_bml, alpha, beta, 0.00_dp)
70  call bml_scale(maxminusmininverse, h_bml)
71 
72  end subroutine prg_normalize_fermi
73 
83  subroutine prg_normalize_implicit_fermi(h_bml, cnst, mu)
84 
85  type(bml_matrix_t),intent(inout) :: h_bml
86  real(dp), intent(in) :: cnst, mu
87 
88  real(dp) :: alpha, beta
89 
90  alpha = -cnst
91  beta = 0.5_dp + cnst * mu
92  call bml_scale_add_identity(h_bml, alpha, beta, 0.00_dp)
93 
94  end subroutine prg_normalize_implicit_fermi
95 
97  subroutine prg_gershgorinreduction(gp)
98 
99  implicit none
100 
101  type(graph_partitioning_t), intent(inout) :: gp
102 
103  integer :: i, nranks
104  real(dp) :: localval
105 
106  nranks = getnranks()
107  if (nranks .eq. 1) return
108 
109  localval = gp%mineval
110  call prg_minrealreduce(localval)
111  gp%mineval = localval
112 
113  localval = gp%maxeval
114  call prg_maxrealreduce(localval)
115  gp%maxeval = localval
116 
117  end subroutine prg_gershgorinreduction
118 
126  subroutine prg_normalize_cheb(h_bml,mu,emin,emax,alpha,scaledmu)
127 
128  implicit none
129  type(bml_matrix_t),intent(inout) :: h_bml
130 
131  real(dp) :: beta, maxminusmin
132  real(dp), intent(in) :: mu, emin, emax
133  real(dp), intent(inout) :: scaledmu, alpha
134 
135  maxminusmin = emax - emin
136  alpha = 2.00_dp / maxminusmin
137  beta = -1.00_dp*(2.00_dp*emin/maxminusmin + 1.00_dp)
138  call bml_scale_add_identity(h_bml, alpha, beta, 0.00_dp)
139  scaledmu = alpha*mu + beta
140 
141  end subroutine prg_normalize_cheb
142 
143 
144 end module prg_normalize_mod
The graph module.
integer, parameter dp
The prg_normalize module.
subroutine, public prg_gershgorinreduction(gp)
Determine gershgorin bounds across all parts, local and distributed.
subroutine, public prg_normalize_fermi(h_bml, h1, hN, mu)
Normalize a Hamiltonian matrix prior to running the truncated SP2 algorithm.
subroutine, public prg_normalize(h_bml)
Normalize a Hamiltonian matrix prior to running the SP2 algorithm.
subroutine, public prg_normalize_cheb(h_bml, mu, emin, emax, alpha, scaledmu)
Normalize a Hamiltonian matrix prior to running the Chebyshev algorithm.
subroutine, public prg_normalize_implicit_fermi(h_bml, cnst, mu)
Normalize a Hamiltonian matrix prior to running the implicit fermi dirac algorithm.
The parallel module.
subroutine, public prg_maxrealreduce(rvalue)
integer function, public getnranks()
subroutine, public prg_minrealreduce(rvalue)