Skip to content

Commit ea456f4

Browse files
authored
Changes for ibm xlf compiler compatibility (#128)
* Changes for ibm xlf compiler compatibility * Made suggested changes * changes -qs by --report-identical-files
1 parent e8636ad commit ea456f4

10 files changed

+100
-74
lines changed

src/latte_mods/tbparams_latte_mod.F90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,8 @@ subroutine write_latteTBparams(latteTBparams,filename)
528528
,latteTBparams%w(3,i)&
529529
,latteTBparams%w(4,i)
530530
enddo
531+
532+
close(io_unit)
531533

532534
end subroutine write_latteTBparams
533535

src/prg_chebyshev_mod.F90

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,22 +318,23 @@ subroutine prg_build_density_cheb_fermi(ham_bml, rho_bml, athr, threshold, ncoef
318318
real(dp), allocatable :: domain2(:), gbnd(:), tn(:), tnm1(:)
319319
real(dp), allocatable :: tnp1(:), tnp1_dense(:,:), tracesT(:)
320320
real(dp), intent(in) :: athr, bndfil, kbt, threshold
321-
real(dp), intent(inout) :: ef
321+
real(dp), intent(out) :: ef
322322
type(bml_matrix_t) :: aux_bml, tn_bml, tnm1_bml, tnp1_bml
323323
type(bml_matrix_t) :: x_bml
324324
type(bml_matrix_t), intent(in) :: ham_bml
325325
type(bml_matrix_t), intent(inout) :: rho_bml
326326
logical, intent(in) :: getef, jon, trkfunc
327327

328328
if(verbose >= 1)write(*,*)"Building rho via Chebyshev expansion of the Fermi function ..."
329-
329+
ef = 0.0_dp
330+
write(*,*)"ef",ef
330331
norb = bml_get_n(ham_bml) !Get the number of orbitals from H
331332
mdim = bml_get_m(ham_bml)
332333
bml_type = bml_get_type(ham_bml) !Get the bml type
333334
mdim = bml_get_m(ham_bml)
334-
335335
if(verbose >= 1)mls_I = mls()
336336
call bml_copy_new(ham_bml,x_bml)
337+
allocate(gbnd(2))
337338
call bml_gershgorin(x_bml, gbnd)
338339
if(verbose >= 1)write(*,*)"Estimation for emin, emax", gbnd(1), gbnd(2)
339340
call prg_normalize_cheb(x_bml,ef,gbnd(1),gbnd(2),alpha,scaledef)

src/prg_densitymatrix_mod.F90

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ subroutine prg_build_density_T(ham_bml, rho_bml, threshold, bndfil, kbt, ef, eig
109109

110110
character(20) :: bml_type
111111
integer :: i, norb
112-
real(8), intent(in) :: bndfil, threshold, kbt
113-
real(8), intent(inout) :: ef
112+
real(dp), intent(in) :: bndfil, threshold, kbt
113+
real(dp), intent(inout) :: ef
114114
real(dp) :: nocc, fleveltol
115115
real(dp), allocatable :: eigenvalues(:)
116116
real(dp), allocatable, optional, intent(out) :: eigenvalues_out(:)
@@ -190,9 +190,11 @@ subroutine prg_build_density_T_Fermi(ham_bml, rho_bml, threshold, kbt, ef,verbos
190190
type(bml_matrix_t), intent(inout) :: rho_bml
191191

192192
if (printRank() .eq. 1) then
193-
if(present(verbose).and.verbose >= 1)then
194-
write(*,*)"In get_density_t_Fermi ..."
195-
write(*,*)"Ef = ",ef
193+
if(present(verbose))then
194+
if(verbose >= 1)then
195+
write(*,*)"In get_density_t_Fermi ..."
196+
write(*,*)"Ef = ",ef
197+
endif
196198
endif
197199
endif
198200

src/prg_genz_mod.F90

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,10 @@ subroutine prg_buildZdiag(smat_bml,zmat_bml,threshold,mdimin,bml_type,verbose)
185185
type(bml_matrix_t) :: zmat_bml
186186
type(bml_matrix_t), intent(inout) :: smat_bml
187187

188-
if(present(verbose).and.verbose >= 1) then
189-
write(*,*)""; write(*,*)"In buildzdiag ..."
188+
if(present(verbose))then
189+
if(verbose >= 1)then
190+
write(*,*)""; write(*,*)"In buildzdiag ..."
191+
endif
190192
endif
191193

192194
if(bml_get_precision(smat_bml) == 1 .or.&
@@ -206,7 +208,6 @@ subroutine prg_buildZdiag(smat_bml,zmat_bml,threshold,mdimin,bml_type,verbose)
206208
allocate(nonotmp(norb,norb))
207209
allocate(zmat(norb,norb))
208210
allocate(smat(norb,norb))
209-
210211
!To bml dense. this is done because the diagonalization
211212
!it is only implemented for bml_dense. In future versions of bml
212213
!the api should do this automatically.
@@ -231,8 +232,10 @@ subroutine prg_buildZdiag(smat_bml,zmat_bml,threshold,mdimin,bml_type,verbose)
231232
!Eigenvectors and eigenalues of the overlap s.
232233
mls_i = mls()
233234
call bml_diagonalize(saux_bml,nono_evals,umat_bml)
234-
if(present(verbose).and.verbose >= 1) then
235-
write(*,*)"Time for S diag = "//to_string(mls() - mls_i)//" ms"
235+
if(present(verbose))then
236+
if(verbose >= 1)then
237+
write(*,*)"Time for S diag = "//to_string(mls() - mls_i)//" ms"
238+
endif
236239
endif
237240

238241
call bml_export_to_dense(umat_bml, umat)

src/prg_homolumo_mod.F90

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ subroutine prg_homolumogap(vv, imax, pp, mineval, maxeval, ehomo, elumo, &
4545
hgamma = 6.0_dp - 4.0_dp * sqrt(2.0_dp)
4646
hgamma = hgamma * (1.0_dp - hgamma)
4747

48-
if(present(verbose).and.verbose.ge.1) write(*,*)"In prg_homolumogap ..."
48+
if(present(verbose))then
49+
if(verbose.ge.1) write(*,*)"In prg_homolumogap ..."
50+
endif
4951

5052
do while (vv(i) .lt. hgamma)
5153

@@ -69,7 +71,9 @@ subroutine prg_homolumogap(vv, imax, pp, mineval, maxeval, ehomo, elumo, &
6971
x_a = max(x_a, y_a)
7072
x_b = min(x_b, y_b)
7173

72-
if(present(verbose).and.verbose.ge.2) write(*,*)"x_a = ",x_a,"x_b = ",x_b
74+
if(present(verbose))then
75+
if(verbose.ge.2) write(*,*)"x_a = ",x_a,"x_b = ",x_b
76+
endif
7377

7478
i = i - 1
7579
if (i .lt. 1) then
@@ -107,12 +111,16 @@ subroutine prg_sp2sequence(pp, imax, mineval, maxeval, ehomo, elumo, errlimit, v
107111

108112
it = 0
109113

110-
if(present(verbose).and.verbose.ge.1) write(*,*)"In prg_sp2sequence ..."
114+
if(present(verbose))then
115+
if(verbose.ge.1) write(*,*)"In prg_sp2sequence ..."
116+
endif
111117

112118
do while (error .gt. errlimit)
113119
it = it + 1
114120

115-
if(present(verbose).and.verbose.ge.2) write(*,*)"error = ",error
121+
if(present(verbose))then
122+
if(verbose.ge.2) write(*,*)"error = ",error
123+
endif
116124

117125
if ((abs(1.0_dp - eh * eh) + abs(el * el)) .lt. &
118126
(abs(1.0_dp - (2.0_dp * eh - eh * eh) + &

src/prg_normalize_mod.F90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ end subroutine prg_gershgorinReduction
128128
!! \param h_bml Input/Output Hamiltonian matrix
129129
subroutine prg_normalize_cheb(h_bml,mu,emin,emax,alpha,scaledmu)
130130

131+
implicit none
131132
type(bml_matrix_t),intent(inout) :: h_bml
132133

133134
real(dp) :: beta, maxMinusMin
@@ -142,4 +143,5 @@ subroutine prg_normalize_cheb(h_bml,mu,emin,emax,alpha,scaledmu)
142143

143144
end subroutine prg_normalize_cheb
144145

146+
145147
end module prg_normalize_mod

src/prg_sp2_fermi_mod.F90

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ subroutine prg_sp2_fermi_init_norecs(h_bml, nsteps, nocc, tscale, threshold, &
217217
integer :: N, M, i
218218
integer, optional :: verbose
219219

220-
if(present(verbose) .and. verbose >= 1) write(*,*)"Inside prg_sp2_fermi_init_norecs ..."
220+
if(present(verbose))then
221+
if(verbose >= 1) write(*,*)"Inside prg_sp2_fermi_init_norecs ..."
222+
endif
221223

222224
bml_type = bml_get_type(h_bml)
223225
N = bml_get_N(h_bml)
@@ -319,9 +321,11 @@ subroutine prg_sp2_fermi_init_norecs(h_bml, nsteps, nocc, tscale, threshold, &
319321
! write(1000,*)gbnd(1) + ((gbnd(2)-gbnd(1))/1000.0_dp)*i,probe(i)
320322
! enddo
321323

322-
if(present(verbose) .and. verbose >= 1) then
323-
write(*,*)"beta = ",beta
324-
write(*,*)"kbT = ",1.0_dp/beta
324+
if(present(verbose))then
325+
if(verbose >= 1) then
326+
write(*,*)"beta = ",beta
327+
write(*,*)"kbT = ",1.0_dp/beta
328+
endif
325329
endif
326330

327331
firstTime = .false.

src/prg_sp2_mod.F90

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,10 @@ subroutine prg_sp2_alg1(h_bml, rho_bml, threshold, bndfil, minsp2iter, maxsp2ite
672672
endif
673673
#endif
674674

675-
if(present(verbose).and.verbose.ge.10)then
676-
if (printRank() .eq. 1) write(*,*) 'iter = ', iter, 'trx = ', trx, ' trx2 = ', trx2
675+
if(present(verbose))then
676+
if(verbose.ge.10)then
677+
if (printRank() .eq. 1) write(*,*) 'iter = ', iter, 'trx = ', trx, ' trx2 = ', trx2
678+
endif
677679
endif
678680

679681
limdiff = abs(trx - trx2 - occ) - abs(trx + trx2 - occ)

src/prg_system_mod.F90

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,9 @@ subroutine prg_translateandfoldtobox(coords,lattice_vectors,origin, verbose)
12741274
real(dp), allocatable, intent(inout) :: origin(:),coords(:,:)
12751275
real(dp), intent(in) :: lattice_vectors(:,:)
12761276

1277-
if(present(verbose) .and. verbose >= 1)write(*,*)"In prg_translateandfoldtobox ..."
1277+
if(present(verbose))then
1278+
if(verbose >= 1)write(*,*)"In prg_translateandfoldtobox ..."
1279+
endif
12781280

12791281
if(.not.allocated(origin)) allocate(origin(3))
12801282

@@ -1324,7 +1326,9 @@ subroutine prg_centeratbox(coords,lattice_vectors,verbose)
13241326
real(dp), allocatable, intent(inout) :: coords(:,:)
13251327
real(dp), intent(in) :: lattice_vectors(:,:)
13261328

1327-
if(present(verbose) .and. verbose >= 1)write(*,*)"In prg_centeratbox ..."
1329+
if(present(verbose))then
1330+
if(verbose >= 1)write(*,*)"In prg_centeratbox ..."
1331+
endif
13281332

13291333
nats=size(coords,dim=2)
13301334

@@ -1365,7 +1369,9 @@ subroutine prg_wraparound(coords,lattice_vectors,index,verbose)
13651369
real(dp), allocatable :: origin(:)
13661370
real(dp), intent(in) :: lattice_vectors(:,:)
13671371

1368-
if(present(verbose) .and. verbose >= 1)write(*,*)"In prg_wraparound ..."
1372+
if(present(verbose))then
1373+
if(verbose >= 1)write(*,*)"In prg_wraparound ..."
1374+
endif
13691375

13701376
if(.not.allocated(origin)) allocate(origin(3))
13711377

@@ -1504,7 +1510,9 @@ subroutine prg_cleanuprepeatedatoms(nats,coords,symbols,verbose)
15041510
character(len=*), allocatable, intent(inout) :: symbols(:)
15051511
character(2), allocatable :: symbolstmp(:)
15061512

1507-
if(present(verbose) .and. verbose >= 1)write(*,*)"In prg_cleanuprepeatedatoms ..."
1513+
if(present(verbose))then
1514+
if(verbose >= 1)write(*,*)"In prg_cleanuprepeatedatoms ..."
1515+
endif
15081516

15091517
natstmp=nats
15101518

@@ -1705,10 +1713,12 @@ subroutine prg_get_covgraph(sy,nnStructMindist,nnStruct,nrnnstruct,bml_type,fact
17051713
Ly = sy%lattice_vector(2,2)
17061714
Lz = sy%lattice_vector(3,3)
17071715

1708-
if(present(verbose).and.verbose >= 1)then
1709-
write(*,*)" "
1710-
write(*,*)"Building covalency graph ..."
1711-
write(*,*)" "
1716+
if(present(verbose))then
1717+
if(verbose >= 1)then
1718+
write(*,*)" "
1719+
write(*,*)"Building covalency graph ..."
1720+
write(*,*)" "
1721+
endif
17121722
endif
17131723

17141724
allocate(ispresent(sy%nats))
@@ -1773,10 +1783,12 @@ subroutine prg_get_covgraph_int(sy,nnStructMindist,nnStruct,nrnnstruct,bml_type,
17731783

17741784
call bml_zero_matrix(bml_type,bml_element_real,dp,sy%nats,mdim,gcov_bml)
17751785

1776-
if(present(verbose).and.verbose >= 1)then
1777-
write(*,*)" "
1778-
write(*,*)"Building covalency graph ..."
1779-
write(*,*)" "
1786+
if(present(verbose))then
1787+
if(verbose >= 1)then
1788+
write(*,*)" "
1789+
write(*,*)"Building covalency graph ..."
1790+
write(*,*)" "
1791+
endif
17801792
endif
17811793

17821794
do i=1,sy%nats
@@ -1830,10 +1842,12 @@ subroutine prg_get_covgraph_h(sy,nnStructMindist,nnStruct,nrnnstruct,rcut,&
18301842

18311843
if(.not.allocated(graph_h)) allocate(graph_h(mdim,sy%nats))
18321844

1833-
if(present(verbose).and.verbose >= 1)then
1834-
write(*,*)" "
1835-
write(*,*)"Building H covalency graph ..."
1836-
write(*,*)" "
1845+
if(present(verbose))then
1846+
if(verbose >= 1)then
1847+
write(*,*)" "
1848+
write(*,*)"Building H covalency graph ..."
1849+
write(*,*)" "
1850+
endif
18371851
endif
18381852

18391853
graph_h = 0
@@ -1885,10 +1899,12 @@ subroutine prg_get_subsystem(sy,lsize,indices,sbsy,verbose)
18851899
type(system_type), intent(in) :: sy
18861900
type(system_type), intent(inout) :: sbsy
18871901

1888-
if(present(verbose).and.verbose >= 1)then
1889-
write(*,*)" "
1890-
write(*,*)"Extracting subsystem ..."
1891-
write(*,*)" "
1902+
if(present(verbose))then
1903+
if(verbose >= 1)then
1904+
write(*,*)" "
1905+
write(*,*)"Extracting subsystem ..."
1906+
write(*,*)" "
1907+
endif
18921908
endif
18931909

18941910
sbsy%nats = lsize
@@ -1970,10 +1986,12 @@ subroutine prg_destroy_subsystems(sbsy,verbose)
19701986
integer, optional, intent(in) :: verbose
19711987
integer :: nparts
19721988

1973-
if(present(verbose).and.verbose >= 1)then
1974-
write(*,*)" "
1975-
write(*,*)"Deallocating the multiple subsystem ..."
1976-
write(*,*)" "
1989+
if(present(verbose))then
1990+
if(verbose >= 1)then
1991+
write(*,*)" "
1992+
write(*,*)"Deallocating the multiple subsystem ..."
1993+
write(*,*)" "
1994+
endif
19771995
endif
19781996

19791997

@@ -2041,8 +2059,10 @@ subroutine prg_molpartition(sy,npart,nnStructMindist,nnStruct,nrnnstruct,hetatm,
20412059
type(graph_partitioning_t), intent(inout) :: gp
20422060
type(system_type), intent(in) :: sy
20432061

2044-
if(present(verbose).and.verbose >= 1)then
2045-
write(*,*)" "; write(*,*)"Partitioning by molecule ..."; write(*,*)" "
2062+
if(present(verbose))then
2063+
if(verbose >= 1)then
2064+
write(*,*)" "; write(*,*)"Partitioning by molecule ..."; write(*,*)" "
2065+
endif
20462066
endif
20472067

20482068
if(allocated(gp%nnodesInPart))then

0 commit comments

Comments
 (0)