Skip to content

Commit 2cb81a5

Browse files
committed
detect duplicate presence of the same function nwchemgit#799
1 parent 9a4c4df commit 2cb81a5

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

src/ddscf/int_1e_ga.F

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ subroutine int_1e_ga(ibas, jbas, g, integ_type, oskel)
4848
#include "cscfps.fh"
4949
#include "sym.fh"
5050
#include "geom.fh"
51+
#include "util.fh"
5152
c
5253
c Compute the desired type of integrals (kinetic, potential, overlap)
5354
c and ADD them into the given global array.
@@ -68,13 +69,16 @@ subroutine int_1e_ga(ibas, jbas, g, integ_type, oskel)
6869
c local variables
6970
c
7071
integer type
71-
logical dobq
72+
integer bad_ovl,adrs,lds,i0,i1,j0,j1
73+
logical dobq,oprint_s,oprint_check_s
7274
character*255 integ_type1
7375
c
7476
call ga_sync()
7577
c
7678
dobq = geom_extbq_on()
7779
integ_type1 = integ_type
80+
oprint_check_s = util_print('check_s',print_high)
81+
oprint_s = util_print('ao overlap',print_debug)
7882
c
7983
if (inp_compare(.false., integ_type1, 'potential0')) then
8084
integ_type1='potential'
@@ -157,6 +161,23 @@ subroutine int_1e_ga(ibas, jbas, g, integ_type, oskel)
157161
call int_1e_oldga(ibas, jbas, g, integ_type1, oskel)
158162
end if
159163
c
164+
c overlap: check if offdiagonal elements are 1 -> same basis
165+
if(type.eq.3.and.oprint_s) call ga_print(g)
166+
if(type.eq.3.and.oprint_check_s) then
167+
bad_ovl=0
168+
call ga_distribution(g,
169+
. ga_nodeid(), i0, i1, j0, j1)
170+
if (i0.gt.0 .and. i0.le.i1) then
171+
call ga_access(g, i0, i1, j0, j1, adrs, lds)
172+
call int_checks(i0, i1, j0, j1,dbl_mb(adrs),
173+
A bad_ovl)
174+
endif
175+
call ga_igop(2023,bad_ovl,1, '+')
176+
if(bad_ovl.gt.0) then
177+
call errquit('int_1e_ga: same basis from S matrix',
178+
A bad_ovl, BASIS_ERR)
179+
endif
180+
endif
160181
end
161182
c
162183
subroutine int_1e_ooldga(ibas, jbas, g, integ_type, oskel)
@@ -715,3 +736,28 @@ subroutine int_1e_oldga0(ibas, g, type, oskel,
715736
if (oscfps) call pstat_off(ps_int_1e)
716737
c
717738
end
739+
subroutine int_checks(i0, i1, j0, j1, s, sing_vals)
740+
implicit none
741+
#include "stdio.fh"
742+
integer i0, i1, j0, j1
743+
double precision s(i0:i1,j0:j1)
744+
integer sing_vals
745+
c
746+
integer i,j
747+
double precision eps
748+
parameter(eps=1d-8)
749+
c
750+
if(i0.lt.j0) return
751+
do j=j0,j1
752+
do i=i0,min(i1,j1)
753+
if(i.gt.j) then
754+
if (abs(s(i,j)-1d0).lt.eps) then
755+
write(luout,1) i,j
756+
sing_vals=sing_vals+1
757+
endif
758+
endif
759+
enddo
760+
enddo
761+
1 format(' basis ',i5,' and ',i5,' are the same')
762+
return
763+
end

0 commit comments

Comments
 (0)