Skip to content

Commit f7c4301

Browse files
committed
version 6.0.8 errors detected by valgrind
1 parent 95d1ca5 commit f7c4301

File tree

8 files changed

+63
-19
lines changed

8 files changed

+63
-19
lines changed

Src/atom_all.f90

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
!> Calls the whole atomic pseudo-potential test plot chain
22
!>
33
!> \author Jose Luis Martins
4-
!> \version 6.0.6
5-
!> \date 21 October 2021
4+
!> \version 6.0.8
5+
!> \date 21 October 2021. 25 May 2022.
66
!> \copyright GNU Public License v2
77

88
program atom_all
99

10+
11+
! Initializes lkb. 25 May 2022. JLM
12+
1013
implicit none
1114

1215
integer, parameter :: REAL64 = selected_real_kind(12)
@@ -279,6 +282,8 @@ program atom_all
279282

280283
call atom_psd_print_info(iowrite, ioae, fileae, nameat)
281284

285+
lkb = .TRUE.
286+
282287
if(lint) then
283288

284289
write(6,*)' Enter distance (in a.u.) at which the'
@@ -287,8 +292,6 @@ program atom_all
287292
write(6,*)
288293
write(6,*)
289294

290-
lkb = .TRUE.
291-
292295
else
293296

294297
call atom_p_tbl_psd_tm2(nameat, rc_tab, status)

Src/lib_atom/atom_atm_vpseudo.f90

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!>
44
!> \author Sverre Froyen, Norm Troullier, Jose Luis Martins
55
!> \version 6.0.8
6-
!> \date 22 June 2021, 18 May 2022.
6+
!> \date 22 June 2021, 25 May 2022.
77
!> \copyright GNU Public License v2
88

99
subroutine atom_atm_vpseudo(ispp, icorr, ifcore, &
@@ -29,6 +29,7 @@ subroutine atom_atm_vpseudo(ispp, icorr, ifcore, &
2929
! remove Coulomb and rsh, zsh, 6 August 2021. JLM
3030
! vionic, cdd, 10 September 2021. JLM
3131
! psdtitle, 18 May 2022. JLM
32+
! initialize np. 25 May 2022. JLM
3233

3334

3435
implicit none
@@ -106,6 +107,12 @@ subroutine atom_atm_vpseudo(ispp, icorr, ifcore, &
106107

107108
allocate(np(0:mxdl,-1:1))
108109

110+
do j = -1,1
111+
do i = 0,mxdl
112+
np(i,j) = 0
113+
enddo
114+
enddo
115+
109116
do i = 1,6
110117
iray(i) = ' '
111118
enddo

Src/lib_kb/atom_kb_sub.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
!>
33
!> \author Norm Troullier, J.L.Martins
44
!> \version 6.0.8
5-
!> \date November 90, May 2012, July 2021, 19 May 2022.
5+
!> \date November 90, May 2012, July 2021, 25 May 2022.
66
!> \copyright GNU Public License v2
77

88
subroutine atom_kb_sub(llocal, nql, delql, nqbas, delqbas, &
@@ -31,6 +31,7 @@ subroutine atom_kb_sub(llocal, nql, delql, nqbas, delqbas, &
3131
! ev for scattering basis functions. 19 October 2021. JLM
3232
! printing. 21 October 2021. JLM
3333
! psdtitle. 19 May 2022. JLM
34+
! dated. 25 May 2022. JLM
3435

3536

3637
implicit none
@@ -81,7 +82,7 @@ subroutine atom_kb_sub(llocal, nql, delql, nqbas, delqbas, &
8182

8283
! general variables
8384

84-
character(len=10) :: dated ! date of calculation
85+
character(len=9) :: dated ! date of calculation
8586
character(len=5) :: version ! program version (should be the same as in atomic program)
8687

8788
character(len=30) :: filekb ! name of default tape for writing pseudopotential in KB format

Src/lib_kb/atom_kb_test_scf.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
!>
33
!> \author Norm Troullier, Jose Luis Martins
44
!> \version 6.0.8
5-
!> \date 22 June 2021, 13 August 2021. 19 May 2022.
5+
!> \date 22 June 2021, 13 August 2021. 25 May 2022.
66
!> \copyright GNU Public License v2
77

88
subroutine atom_kb_test_scf(etotal, &
@@ -16,6 +16,7 @@ subroutine atom_kb_test_scf(etotal, &
1616
! number of iterations. 21 October 2021. JLM
1717
! vhxc_orb in dsolv1. 28 October 2021. JLM
1818
! psdtitle, 19 May 2022. JLM
19+
! initialize itype. 25 May 2022. JLM
1920

2021

2122
implicit none
@@ -326,6 +327,7 @@ subroutine atom_kb_test_scf(etotal, &
326327

327328
! Find the total energy. jlm
328329

330+
itype = 4
329331
call atom_atm_etotal(itype, nameat, norb, &
330332
no, lo, iso, zo, etot, ev, ek, ep, &
331333
iowrite, mxdorb)

Src/lib_num/ft_charge.f90

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
!> Four point formula. 4 pi r^2 in the input function
33
!>
44
!> \author Sverre Froyen, Norm Troullier, JL Martins
5-
!> \version 6.013
6-
!> \date 80s, April 2012
5+
!> \version 6.0.8
6+
!> \date 80s, April 2012. 25 May 2022.
77
!> \copyright GNU Public License v2
88

99
subroutine ft_charge(nr, nql, r, drdi, qp, fin, fout)
1010

11+
12+
! correct initialization of w and y. 25 May 2022. JLM
13+
1114
implicit none
1215

1316
integer, parameter :: REAL64 = selected_real_kind(12)
@@ -17,7 +20,7 @@ subroutine ft_charge(nr, nql, r, drdi, qp, fin, fout)
1720
integer, intent(in) :: nr !< number of points in the radial grid
1821
integer, intent(in) :: nql !< number of points for the local Fourier grid
1922

20-
real(REAL64), intent(in) :: r(0:nr) !< radial grid points r(i) = a*(exp(b*i)-1), i=1,...,nr
23+
real(REAL64), intent(in) :: r(0:nr) !< radial grid points r(i) = a*(exp(b*i)-1), i=1,...,nr
2124
real(REAL64), intent(in) :: drdi(0:nr) !< d r(i) / d i
2225
real(REAL64), intent(in) :: qp(0:nql) !< fourier grid points
2326

@@ -34,7 +37,7 @@ subroutine ft_charge(nr, nql, r, drdi, qp, fin, fout)
3437
! parameters
3538

3639
real(REAL64), parameter :: ZERO = 0.0_REAL64
37-
40+
3841
! counters
3942

4043
integer :: j, k
@@ -46,6 +49,10 @@ subroutine ft_charge(nr, nql, r, drdi, qp, fin, fout)
4649
w(j) = drdi(j)*fin(j)/r(j)
4750
enddo
4851
w(0) = ZERO
52+
do j = nr+1,nr+4
53+
w(j) = ZERO
54+
y(j) = ZERO
55+
enddo
4956

5057
do k = 1,nql
5158
fout(k) = ZERO

Src/lib_plot/atom_plot_kb_input.f90

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!>
44
!> \author Peter Schuster, Manuel Maria Alemany, Jose Luis Martins
55
!> \version 6.0.8
6-
!> \date 4 September 2021, 21 October 2021. 19 May 2022.
6+
!> \date 4 September 2021, 21 October 2021. 25 May 2022.
77
!> \copyright GNU Public License v2
88

99
subroutine atom_plot_kb_input (iowrite, ioplot, &
@@ -19,6 +19,7 @@ subroutine atom_plot_kb_input (iowrite, ioplot, &
1919
! kinetic, 9 October 2021. JLM
2020
! printing. New interface. 21 October 2021. JLM
2121
! deallocate, 19 May 2022. JLM
22+
! initialized px,py. 25 May 2022. JLM
2223

2324

2425
implicit none
@@ -82,13 +83,21 @@ subroutine atom_plot_kb_input (iowrite, ioplot, &
8283

8384
! constants
8485

86+
real(REAL64), parameter :: ZERO = 0.0_REAL64
8587
character(len=1), parameter :: IL(7) = (/'s','p','d','f','g','h','i'/)
8688

8789
! counters
8890

89-
integer :: i
91+
integer :: i, j
9092

9193

94+
do j = 1,nump
95+
do i = 1,nmax
96+
px(i,j) = ZERO
97+
py(i,j) = ZERO
98+
enddo
99+
enddo
100+
92101
allocate(absc(nmax),ord(nmax))
93102

94103
iw = 0

Src/lib_psd/atom_psd_unscreen.f90

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
!> unscreens the pseudopotential
22
!>
33
!> \author Norm Troullier, Jose Luis Martins
4-
!> \version 6.013
5-
!> \date 1980s and 1990s, 30 June 2021
4+
!> \version 6.0.8
5+
!> \date 1980s and 1990s, 30 June 2021, 25 May 2022.
66
!> \copyright GNU Public License v2
77

88

@@ -16,6 +16,7 @@ subroutine atom_psd_unscreen(ifcore, icorr, ispp, nr, r, drdi, &
1616
! pseudopotential generation subroutines were broken in several subroutines
1717
! and converted to f90.
1818
! Modified (cleaning) 8 July 2021. JLM
19+
! Initializes vpsd. 25 May 2022. JLM
1920

2021
!mmga modifications from early Sverre code by Manuel Maria Gonzalez Alemany
2122
!njtj modifications from early Sverre code by Norm Troullier
@@ -100,9 +101,19 @@ subroutine atom_psd_unscreen(ifcore, icorr, ispp, nr, r, drdi, &
100101

101102
! counters
102103

103-
integer :: i, j
104+
integer :: i, j, l
104105

105106

107+
! initializes vpsd
108+
109+
do i =-1,1
110+
do l = 0,lc
111+
do j = 1,mxdnr
112+
vpsd(j,l,i) = ZERO
113+
enddo
114+
enddo
115+
enddo
116+
106117
! Reset the n quantum numbers to include all valence orbitals.
107118
! Compute the ratio between the valence charge present and the
108119
! valence charge of a neutral atom.

Src/plot_ln_show.f90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
!> Swows the comparison of log derivatives of all-electron and pseudo potentials.
22
!>
33
!> \author Jose Luis Martins
4-
!> \version 6.0.3
5-
!> \date September 2021
4+
!> \version 6.0.8
5+
!> \date September 2021. 25 May 2022.
66
!> \copyright GNU Public License v2
77

88
program plot_ln_show
99

10+
11+
! Initializes lkb. 25 May 2022. JLM
12+
1013
implicit none
1114

1215
integer, parameter :: REAL64 = selected_real_kind(12)
@@ -49,6 +52,7 @@ program plot_ln_show
4952
integer :: l
5053

5154

55+
lkb = .TRUE.
5256
lint = .TRUE.
5357
! lint = .FALSE.
5458

0 commit comments

Comments
 (0)