GitHub PullRequestReviewCommentEvent at 2014-10-07 19:14:27
Repository: aces4
Actor: slepton
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/UFParLab/aces4/pulls/comments/18541932","id":18541932,"diff_hunk":"@@ -13,44 +13,606 @@\n C  The GNU General Public License is included in this distribution\n C  in the file COPYRIGHT.\n       subroutine compute_aabb_batch(\n-     c array_slot, rank, index_values, size, extents, data,\n+     c array_slot_1, rank_1, index_values_1, size_1, extents_1, data_1,\n+     c array_slot_2, rank_2, index_values_2, size_2, extents_2, data_2,\n      c  ierr) BIND(C)\n       use, intrinsic :: ISO_C_BINDING\n       implicit none\n-      integer(C_INT), intent(in)::array_slot\n-      integer(C_INT), intent(in)::rank\n-      integer(C_INT), intent(in)::index_values(1:rank)\n-      integer(C_INT), intent(in)::size\n-      integer(C_INT), intent(in)::extents(1:rank)\n-      real(C_DOUBLE), intent(out)::data(1:size)\n+\n+      include 'sip_interface.f' \n+      include 'imemory.h'\n+\n+c Input array used as scratch space \n+      integer(C_INT), intent(in)::array_slot_1\n+      integer(C_INT), intent(in)::rank_1\n+      integer(C_INT), intent(in)::index_values_1(1:rank_1)\n+      integer(C_INT), intent(in)::size_1\n+      integer(C_INT), intent(in)::extents_1(1:rank_1)\n+      real(C_DOUBLE), intent(out)::data_1(1:size_1)\n+\n+c Output array holding screening array  \n+      integer(C_INT), intent(in)::array_slot_2\n+      integer(C_INT), intent(in)::rank_2\n+      integer(C_INT), intent(in)::index_values_2(1:rank_2)\n+      integer(C_INT), intent(in)::size_2\n+      integer(C_INT), intent(in)::extents_2(1:rank_2)\n+      real(C_DOUBLE), intent(out)::data_2(2:size_2)\n+\n       integer(C_INT), intent(out)::ierr\n \n-c     include 'int_gen_parms.hf'\n+!     one dimensional array of atomic coordinates  \n+      TYPE(C_PTR) :: sDimCoords \n+      TYPE(C_PTR) :: coords \n+      integer, pointer :: pdim_coords(:)  \n+      real(C_DOUBLE), pointer :: pcoords(:,:)\n+\n+!     tw0 dimensional array mapping atomic coordinates to shells  \n+      TYPE(C_PTR) :: sDimTCoords \n+      TYPE(C_PTR) :: Tcoords \n+      integer, pointer :: pdim_Tcoords(:)  \n+      real(C_DOUBLE), pointer :: pTcoords(:,:)\n+\n+!     one dimensional arrays containg ccbeg and ccend  \n+      TYPE(C_PTR) :: icc, ccbeg, ccend  \n+      integer, pointer :: picc(:), pccbeg(:), pccend(:)  \n+\n+!     one dimensional array containg alphas(exponents)   \n+      TYPE(C_PTR) :: ntot_alpha, ixalphas \n+      integer, pointer :: pntot_alpha(:), pixalphas(:) \n+      TYPE(C_PTR) :: alphas\n+      real(C_DOUBLE) , pointer :: palphas(:)\n+\n+!     one dimensional array containing coefficients  \n+      TYPE(C_PTR) :: ntot_pcoeff, ixpcoeffs \n+      TYPE(C_PTR) :: pcoeffs  \n+      integer, pointer :: pntot_pcoeff(:), pixpcoeffs(:) \n+      real(C_DOUBLE), pointer :: ppcoeffs(:)\n \n-      integer*8 integral_scr\n-      integer maxblk , nsend\n+!     integer scratch array. HARD coded size should be changed  \n+c     integer(C_INT) iscr(5000000)   \n+c     real(C_DOUBLE) scr(5000000)   \n \n+      real(C_DOUBLE), pointer :: scr(:) \n+      integer, pointer :: iscr(:)\n+      TYPE(C_PTR) :: cscr\n+      TYPE(C_PTR) :: ciscr\n+!     offsets of atomic indeces  \n+      integer(C_INT) offset_1, offset_2, offset_3, offset_4\n+      integer(C_INT) i, one, two\n+\n+c aosegments \n+c     integer(C_INT) n_ao_segs(1), aosegs(6)    \n+      TYPE(C_PTR) :: n_ao_segs, aosegs\n+      integer, pointer :: pn_ao_segs(:), paosegs(:)\n+\n+c ----------------------------------------------------------------------\n+c  END_NFPS \n+      TYPE(C_PTR) :: pnalpha, pend_nfps\n+      integer, pointer :: nalpha(:)\n+      integer, pointer :: end_nfps(:)\n+c ----------------------------------------------------------------------\n+\n+      integer(C_INT) norb, nscr, niscr\n+c\n+      one = 0 ! 1\n+      two = 0 ! 2\n       ierr = 0\n+\n+c Get the predefined data \n+\n+c ----------------------------------------------------------------------\n+c  CC_BEG    \n+      call predefined_int_array(\"ccbeg\"//C_NULL_CHAR, one, icc,\n+     *                                   ccbeg)\n+      call c_f_pointer(icc, picc,[1])\n+      call c_f_pointer(ccbeg,pccbeg,picc)\n+c     write(6,*) ' CC_BEG', picc(1), (pccbeg(i), i=1, \n+c    *                                           picc(1)) \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  CC_END    \n+      call predefined_int_array(\"ccend\"//C_NULL_CHAR, one, icc,\n+     *                                   ccend)\n+      call c_f_pointer(icc, picc,[1])\n+      call c_f_pointer(ccend,pccend,picc)\n+c     write(6,*) ' CC_END', picc(1), (pccend(i), i=1, \n+c    *                                           picc(1)) \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  IXALPHAS(exponents)     \n+      call predefined_int_array(\"ixalphas\"//C_NULL_CHAR, one,\n+     *                                   ntot_alpha, ixalphas)\n+      call c_f_pointer(ntot_alpha, pntot_alpha,[1])\n+      call c_f_pointer(ixalphas, pixalphas, pntot_alpha)\n+c     write(6,*) ' IXALPHAS', pntot_alpha(1), (pixalphas(i), i=1, \n+c    *                                         pntot_alpha(1)) \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  IXCOEFFICIENTS   \n+      call predefined_int_array(\"ixpcoeffs\"//C_NULL_CHAR,one,\n+     *                                   ntot_pcoeff, ixpcoeffs)\n+      call c_f_pointer(ntot_pcoeff, pntot_pcoeff,[1])\n+      call c_f_pointer(ixpcoeffs, pixpcoeffs, pntot_pcoeff)\n+c     write(6,*) ' IXPCOEFFS', pntot_pcoeff(1), (pixpcoeffs(i), i=1, \n+c    *                                         pntot_pcoeff(1)) \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  ALPHAS(exponents)     \n+      call predefined_scalar_array(\"alphas\"//C_NULL_CHAR,\n+     *                              one, ntot_alpha, alphas)\n+      call c_f_pointer(ntot_alpha, pntot_alpha,[1])\n+      call c_f_pointer(alphas, palphas, pntot_alpha)\n+c     write(6,*) ' ALPHAS', pntot_alpha(1) , (palphas(i), i=1,\n+c    *                pntot_alpha(1))  \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  COEFFICIENTS   \n+      call predefined_scalar_array(\"pcoeffs\"//C_NULL_CHAR,\n+     *                               one, ntot_pcoeff,pcoeffs)\n+      call c_f_pointer(ntot_pcoeff, pntot_pcoeff,[1])\n+      call c_f_pointer(pcoeffs, ppcoeffs, pntot_pcoeff)\n+c     write(6,*) ' PCOEFFS', pntot_pcoeff(1) , (ppcoeffs(i), i=1,\n+c    *                pntot_pcoeff(1))  \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  ATOMIC COORDINATES  \n+      call predefined_scalar_array(\"coords\"//C_NULL_CHAR,\n+     *                                  two, sDimCoords,  coords)\n+      call c_f_pointer(sDimCoords, pdim_coords,[2])\n+      call c_f_pointer(coords, pcoords, pdim_coords)\n+c     write(6,*) ' COORDS',  (pcoords(1,i), i=1, pdim_coords(2),\n+c    *                pntot_pcoeff(1))  \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  ATOMIC COORDINATES MAPPED TO SHELLS   \n+      call predefined_scalar_array(\"tcoords\"//C_NULL_CHAR,\n+     *                                  two, sDimTCoords, tcoords)\n+      call c_f_pointer(sDimTCoords, pdim_Tcoords,[2])\n+      call c_f_pointer(tcoords, ptcoords, pdim_tcoords)\n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c Get the ao segment ranges  \n+      call predefined_int_array(\"ao_seg_ranges\"//C_NULL_CHAR, one,\n+     *                           n_ao_segs, aosegs)\n+      call c_f_pointer(n_ao_segs,pn_ao_segs,[1])\n+      call c_f_pointer(aosegs,paosegs,pn_ao_segs)\n+c     write(6,*) ' NAO_SEGS', pn_ao_segs(1), (paosegs(i), i=1, \n+c    *                                             pn_ao_segs(1)) \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  END_NFPS \n+      call predefined_int_array(\"end_nfps\"//C_NULL_CHAR, one,\n+     *                                   pnalpha, pend_nfps)\n+      call c_f_pointer(pnalpha, nalpha, [1])\n+      call c_f_pointer(pend_nfps, end_nfps, nalpha)\n+c     write(6,*) ' END_NFPS', nalpha(1), (end_nfps(i), i=1, \n+c    *                                           nalpha(1))  \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c\n+c  Set scratch space  \n+      nscr  = zmax ! 5000000 \n+      niscr = imax ! 5000000 \n+c     nscr  = 5000000 \n+c     niscr = 5000000 \n+\n+      call scratch_array(nscr, cscr)\n+      call c_f_pointer(cscr, scr, [nscr])\n+\n+      call scratch_array(niscr, ciscr)\n+      call c_f_pointer(ciscr, iscr, [niscr])\n+\n+      offset_1 = 0\n+      offset_2 = 0\n+      if (index_values_1(1).gt.1) offset_1=paosegs(index_values_1(1)-1)\n+      if (index_values_1(2).gt.1) offset_2=paosegs(index_values_1(2)-1)\n+      if (index_values_1(3).gt.1) offset_3=paosegs(index_values_1(3)-1)\n+      if (index_values_1(4).gt.1) offset_4=paosegs(index_values_1(4)-1)\n+\n+      call compute_aabb_integrals(1+offset_1, extents_1(1)+offset_1,\n+     *                       1+offset_2, extents_1(2)+offset_2,\n+     *                       1+offset_3, extents_1(3)+offset_3,\n+     *                       1+offset_4, extents_1(4)+offset_4,\n+     *                       1, extents_2(2),  \n+     *                       1, extents_2(2),  \n+     *                       data_1, !integrals data_1,  \n+     *                       data_2, ! secreening array   \n+     *                       scr, ! scratch spaces for integrals data_0,  \n+c \n+     *                       iscr, ! integer scratch spaces for integrals \n+     *                       pcoords, ptcoords,\n+     *                       ppcoeffs, pixpcoeffs, palphas, pixalphas,\n+     *                       pccbeg, pccend)\n+c \n+c ----------------------------------------------------------------------\n+c\n+c  Remove scratch space  \n+      call delete_scratch_array(cscr)\n+      call delete_scratch_array(ciscr)\n+\n+      return\n+      end\n+\n+      subroutine compute_aabb_integrals(a1,a2,b1,b2,c1,c2,d1,d2,sa1,sa2,\n+     *          da1,da2,aoint, screening_array, \n+     *          scr, iscr, coords, tcoords, coeffs, ixpcoef, alphas, \n+     *          ixalpha, ccbeg, ccend) \n+c---------------------------------------------------------------------------\n+c   The block of integrals (a1:a2,b1:b2,c1:c2,d1:d2) is computed for the \n+c   following 'types' of integrals based on atomic labels.\n+c\n+c   1. AABB \n+c---------------------------------------------------------------------------\n+\n+      use, intrinsic :: ISO_C_BINDING\n+      implicit none\n+\n+c---------------------------------------------------------------------------\n+c Interface added but should be included instead \n+\n+      include 'sip_interface.f' \n+      include 'imemory.h'\n+\n+c---------------------------------------------------------------------------\n+\n+      integer a1, a2, b1, b2, c1, c2, d1, d2, sa1, sa2, da1, da2    \n+      integer aa1,aa2,bb1,bb2,cc1,cc2,dd1,dd2\n+      integer adim, bdim, cdim, ddim  \n+      integer m1, m2, n1, n2, r1, r2, s1, s2\n+      integer i, j, k, n, m, r, s\n+      integer a,b,c,d\n+\n+      integer num_to_do\n+      integer nints \n+      integer nalpha_pack, npcoeff_pack\n+      integer ncsum, next, nfirst\n+      integer me, ierr\n+      integer nc1, nc2, nd1, nd2 \n+\n+      integer imin, zmin, iblk, zblk\n+\n+      logical skip\n+      logical mn_symmetry\n+      logical rs_symmetry\n+      logical mn_rs_symmetry\n+      logical*8 l8true, l8spherical\n+      logical spherical\n+\n+      double precision x1,y1,z1\n+      double precision x2,y2,z2\n+      double precision x3,y3,z3\n+      double precision x4,y4,z4\n+\n+      double precision coords(3,*), coeffs(*), alphas(*)\n+      double precision tcoords(3,*) \n+      double precision integrals(a1:a2,b1:b2,c1:c2,d1:d2) \n+c     double precision screening_array(sa1:sa2,da1:da2) \n+      double precision screening_array(sa2*da2), temp(sa2,da2)  \n+      double precision aoint(*) \n+\n+      double precision scr(*)   \n+      integer iscr(*)\n+\n+      integer ccbeg(*), ccend(*)\n+      integer ixalpha(*), ixpcoef(*) \n+      integer max_dim_coeff\n+      parameter (max_dim_coeff = 5000)\n+      integer ccbeg_pack(max_dim_coeff), ccend_pack(max_dim_coeff)\n+      double precision alpha_pack(max_dim_coeff)\n+      double precisionpcoeff_pack(max_dim_coeff)\n+\n+c VFL TO BE COMPLETED       common /Imax_com/sz_max(nshells,nshells), delta \n+      double precision sz_max, delta\n+      double precision itol, bmax, dtemp, emax\n+\n+      integer one\n+\n+      integer (C_INT) nshells, ncenters, nalpha_occupied, nbeta_occupied\n+      integer (C_INT) nalpha_virtual, nbeta_virtual\n+      integer (C_INT) intSpherical\n+\n+c ----------------------------------------------------------------------\n+c  END_NFPS \n+      TYPE(C_PTR) :: pnalpha, pend_nfps\n+      integer, pointer :: nalpha(:)\n+      integer, pointer :: end_nfps(:)\n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  NCFPS \n+      TYPE(C_PTR) :: pishells, pncfps\n+      integer, pointer :: ishells(:)\n+      integer, pointer :: ncfps(:)\n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  NPFPS \n+      TYPE(C_PTR) :: pnpfps\n+      integer, pointer :: npfps(:)\n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  NPFPS \n+      TYPE(C_PTR) :: pindex_cc\n+      integer, pointer :: index_cc(:)\n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  INDX_CC   \n+      TYPE(C_PTR) :: pindx_cc\n+      integer, pointer :: indx_cc(:)\n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  IVANGMOM  \n+      TYPE(C_PTR) :: pivangmom\n+      integer, pointer :: ivangmom(:)\n+c ----------------------------------------------------------------------\n+\n+      adim = a2-a1+1\n+      bdim = b2-b1+1\n+      cdim = c2-c1+1\n+      ddim = d2-d1+1\n+      l8true = .true.\n+c     spherical = (ispherical .eq. 1)\n+\n+c Get the predefined data \n+\n+      one = 1\n+\n+c ----------------------------------------------------------------------\n+c  END_NFPS \n+      call predefined_int_array(\"end_nfps\"//C_NULL_CHAR, one,\n+     *                                   pnalpha, pend_nfps)\n+      call c_f_pointer(pnalpha, nalpha, [1])\n+      call c_f_pointer(pend_nfps, end_nfps, nalpha)\n+c     write(6,*) ' END_NFPS', nalpha(1), (end_nfps(i), i=1, \n+c    *                                           nalpha(1))  \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  NCFPS \n+      call predefined_int_array(\"ncfps\"//C_NULL_CHAR, one,\n+     *                                   pishells, pncfps)\n+      call c_f_pointer(pishells, ishells, [1])\n+      call c_f_pointer(pncfps, ncfps, ishells)\n+c     write(6,*) ' NCFPS', ishells(1), (ncfps(i), i=1, \n+c    *                                           ishells(1))  \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  NPFPS \n+      call predefined_int_array(\"npfps\"//C_NULL_CHAR, one,\n+     *                                   pishells, pnpfps)\n+      call c_f_pointer(pishells, ishells, [1])\n+      call c_f_pointer(pnpfps, npfps, ishells)\n+c     write(6,*) ' NCFPS', ishells(1), (npfps(i), i=1, \n+c    *                                           ishells(1))  \n+c ----------------------------------------------------------------------\n+\n+c ----------------------------------------------------------------------\n+c  INDX_CC  \n+      call predefined_int_array(\"indx_cc\"//C_NULL_CHAR, one,\n+     *                                   pishells, pindx_cc)\n+      call c_f_pointer(pishells, ishells, [1])\n+      call c_f_pointer(pindx_cc, indx_cc, ishells)\n+c     write(6,*) ' INDX_CC', ishells(1), (indx_cc(i), i=1, \n+c    *                                           ishells(1))  \n+c ----------------------------------------------------------------------\n+c ----------------------------------------------------------------------\n+c  IVANGMOMO   \n+      call predefined_int_array(\"ivangmom\"//C_NULL_CHAR, one, pishells,\n+     *                                   pivangmom)\n+      call c_f_pointer(pishells, ishells, [1])\n+      call c_f_pointer(pivangmom, ivangmom, ishells)\n+c     write(6,*) ' IVANGMOMOM', ishells(1), (ivangmom(i), i=1, \n+c    *                                           ishells(1))  \n+c ----------------------------------------------------------------------\n+\n+      ncenters = int_constant(\"ncenters\"//C_NULL_CHAR)\n+      nshells = int_constant(\"nshells\"//C_NULL_CHAR)\n+      nalpha_occupied = int_constant(\"nalpha_occupied\"//C_NULL_CHAR)\n+      nbeta_occupied = int_constant(\"nbeta_occupied\"//C_NULL_CHAR)\n+      nalpha_virtual = int_constant(\"nalpha_virtual\"//C_NULL_CHAR)\n+      nbeta_virtual = int_constant(\"nbeta_virtual\"//C_NULL_CHAR)\n+\n+      intSpherical = int_constant(\"intspherical\"//C_NULL_CHAR)\n+      spherical = .true.\n+      if (intSpherical .ne. 1) spherical = .false.\n+\n+c-----------------------------------------------------------------------\n+c   Find the shell blocks for which we shall loop through.\n+c-----------------------------------------------------------------------\n+\n+         call lookup_shell(end_nfps, nshells, a1, m1)\n+         call lookup_shell(end_nfps, nshells, a2, m2)\n+         call lookup_shell(end_nfps, nshells, b1, n1)\n+         call lookup_shell(end_nfps, nshells, b2, n2)\n+c        call lookup_shell(end_nfps, nshells, c1, r1)\n+c        call lookup_shell(end_nfps, nshells, c2, r2)\n+c        call lookup_shell(end_nfps, nshells, d1, s1)\n+c        call lookup_shell(end_nfps, nshells, d2, s2)\n+\n+         do m = m1, m2\n+            if (m .eq. 1) then\n+               aa1 = 1\n+            else\n+               aa1 = end_nfps(m-1) + 1\n+            endif\n+            aa2 = end_nfps(m)\n+\n+            x1 = tcoords(1,m)\n+            y1 = tcoords(2,m)\n+            z1 = tcoords(3,m)\n+         do n = n1, n2\n+            if (n .eq. 1) then\n+               bb1 = 1\n+            else\n+               bb1 = end_nfps(n-1) + 1\n+            endif\n+            bb2 = end_nfps(n)\n+\n+            x2 = tcoords(1,n)\n+            y2 = tcoords(2,n)\n+            z2 = tcoords(3,n)\n+         do r = m, m\n+            if (r .eq. 1) then\n+               cc1 = 1\n+            else\n+               cc1 = end_nfps(r-1) + 1\n+            endif\n+            cc2 = end_nfps(r)\n+\n+            x3 = tcoords(1,r)\n+            y3 = tcoords(2,r)\n+            z3 = tcoords(3,r)\n+         do s = n, n\n+               x4 = tcoords(1,s)\n+               y4 = tcoords(2,s)\n+               z4 = tcoords(3,s)\n+\n c---------------------------------------------------------------------------\n-c   Compute the block of integrals.\n+c   Calling sequence for ERD version 2.\n c---------------------------------------------------------------------------\n \n-!      call compute_aabb_integrals(bval(1),eval(1), bval(2),eval(2),\n-!     *                       bval(3),eval(3),bval(4),eval(4),\n-!     *                 dbuf(integral_scr),maxblk, ibuf(ipkgscr),\n-!     *                 dbuf(icoord),dbuf(ipcoeff),dbuf(ialpha),\n-!     *                 ibuf(iccbeg), ibuf(iccend),\n-!     *                 x, nsend)\n+               ncsum = ncfps(m) + ncfps(n) + ncfps(r) + ncfps(s)\n+\n+               call pack_coeffs(alphas, ixalpha, coeffs, ixpcoef, \n+     *                          ncfps, npfps, m, n,  \n+     *                          r, s, alpha_pack, nalpha_pack, \n+     *                          pcoeff_pack, npcoeff_pack, \n+     *                          ccbeg, ccend, indx_cc,\n+     *                          ccbeg_pack, ccend_pack) \n+\n+c---------------------------------------------------------------------------\n+c   Calling sequence for ERD version 2.\n+c---------------------------------------------------------------------------\n+\n+               ncsum = ncfps(m) + ncfps(n) + ncfps(r) + ncfps(s)\n+\n+              call ERD__GENER_ERI_BATCH(imax, zmax,\n+     *                nalpha_pack, npcoeff_pack, ncsum, \n+     *                ncfps(m),ncfps(n), ncfps(r), ncfps(s),\n+     *                npfps(m),npfps(n), npfps(r), npfps(s),\n+     *                ivangmom(m), ivangmom(n), \n+     *                ivangmom(r), ivangmom(s), x1,y1,z1,\n+     *                x2,y2,z2,x3,y3,z3,x4,y4,z4, alpha_pack,\n+     *                pcoeff_pack, ccbeg_pack, ccend_pack,\n+     *                spherical, .true., iscr, nints, \n+     *                nfirst, scr)    \n+\n+\n+c---------------------------------------------------------------------------\n+c   Move the integrals into the output block.  \n+c---------------------------------------------------------------------------\n+\n+            if (nints .gt. 0) then\n+               \n+               if (s .eq. 1) then\n+                  dd1 = 1\n+               else\n+                  dd1 = end_nfps(s-1) + 1\n+               endif\n+               dd2 = end_nfps(s)\n+\n+               call find_Imax(scr(nfirst), nints, 1, sa2, 1, da2, \n+     *                        temp, m,n) \n+\n+            else \n+               \n+               call zero_Imax(1, sa2, 1, da2, temp, m,n) \n+\n+            endif\n+\n+30       continue \n+         enddo   ! s\n+20       continue \n+         enddo   ! r\n \n-c     call compute_aabb_integrals(1, extents(1),\n-c    *    1, extents(2),\n-c    *    1, extents(3),\n-c    *    1, extents(4),\n-c    *  dbuf(integral_scr),maxblk, ibuf(ipkgscr),\n-c    *  dbuf(icoord),dbuf(ipcoeff),dbuf(ialpha),\n-c    *  ibuf(iccbeg), ibuf(iccend),\n-c    *                 data, nsend)\n+c        write(6,*) ' sa1, sa2, M N IMAX :', sa1, sa2, m, n,   \n+c    *        screening_array(m,n) \n \n+c        write(6,*) ' M N :', m, n \n+c        do r = nfirst, nfirst+nints-1 \n+c           write(6,*) ' VFL ', r, scr(r) \n+c        enddo \n+\n+10       continue \n+         enddo   ! n\n+100      continue \n+         enddo   ! m\n+\n+c        write(6,*) ' SSAA:', sa1, sa2, da1, da2, m1,m2,n1,n2\n+\n+         k = 0 \n+         do i = sa1, sa2 \n+         do j = da1, da2 \n+            k = k + 1 \n+\n+               if (i.ge.n1 .and. i.le.n2 .and. j.ge.m1 .and. j.le.m2) \n+     *            then   \n+                 screening_array(k) = temp(j,i) \n+c                write(6,*) ' K M N :', temp(j,i), screening_array(k)\n+               endif \n+\n+         ENDDO \n+         ENDDO \n+\n+33    FORMAT(5I4,F12.8) \n \n       return\n       end\n+\n+      subroutine find_Imax(intblk,nints,sa1,sa2,da1,da2,sz_max,m,n)\n+\n+      implicit none\n+\n+      integer m, n, nints, d, sa1, sa2, da1, da2  \n+\n+      double precision intblk(*)\n+      double precision Int_max, tmax\n+      double precision sz_max(sa1:sa2,da1:da2)  \n+\n+      Int_max = sz_max(m,n)\n+      if (sz_max(m,n) .gt. sz_max(n,m)) Int_max = sz_max(n,m)","path":"src/sip/super_instructions/qm/compute_aabb_batch.F","position":600,"original_position":600,"commit_id":"1d610f33f7c584ce7870ab101bbb429c5a53f7bb","original_commit_id":"1d610f33f7c584ce7870ab101bbb429c5a53f7bb","user":{"login":"slepton","id":6818306,"avatar_url":"https://avatars.githubusercontent.com/u/6818306?v=2","gravatar_id":"","url":"https://api.github.com/users/slepton","html_url":"https://github.com/slepton","followers_url":"https://api.github.com/users/slepton/followers","following_url":"https://api.github.com/users/slepton/following{/other_user}","gists_url":"https://api.github.com/users/slepton/gists{/gist_id}","starred_url":"https://api.github.com/users/slepton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slepton/subscriptions","organizations_url":"https://api.github.com/users/slepton/orgs","repos_url":"https://api.github.com/users/slepton/repos","events_url":"https://api.github.com/users/slepton/events{/privacy}","received_events_url":"https://api.github.com/users/slepton/received_events","type":"User","site_admin":false},"body":"The temp array does not need to be initialized before being passed. The\nlargest integral iis put into that array.\n\n>>\n>>        return\n>>        end\n>> +\n>> +      subroutine find_Imax(intblk,nints,sa1,sa2,da1,da2,sz_max,m,n)\n>> +\n>> +      implicit none\n>> +\n>> +      integer m, n, nints, d, sa1, sa2, da1, da2\n>> +\n>> +      double precision intblk(*)\n>> +      double precision Int_max, tmax\n>> +      double precision sz_max(sa1:sa2,da1:da2)\n>> +\n>> +      Int_max = sz_max(m,n)\n>> +      if (sz_max(m,n) .gt. sz_max(n,m)) Int_max = sz_max(n,m)\n>\n> Valgrind says this:\n> ==3833== Conditional jump or move depends on uninitialised value(s)\n> ==3833==    at 0x4C5AC7: find_imax_ (compute_aabb_batch.F:587)\n> ==3833==    by 0x4C56CB: compute_aabb_integrals_\n> (compute_aabb_batch.F:529)\n> ==3833==    by 0x4C7635: compute_aabb_batch (compute_aabb_batch.F:235)\n> ==3833==    by 0x47E1C7: sip::Interpreter::handle_user_sub_op(int)\n> (interpreter.cpp:1029)\n> ==3833==    by 0x47A257: sip::Interpreter::interpret(int, int)\n> (interpreter.cpp:133)\n> ==3833==    by 0x479F57: sip::Interpreter::interpret()\n> (interpreter.cpp:87)\n> ==3833==    by 0x4693D1: main (main.cpp:201)\n> ==3833==  Uninitialised value was created by a heap allocation\n> ==3833==    at 0x4C2AB80: malloc (in\n> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)\n> ==3833==    by 0x4C3F5F: compute_aabb_integrals_\n> (compute_aabb_batch.F:300)\n> ==3833==    by 0x4C7635: compute_aabb_batch (compute_aabb_batch.F:235)\n> ==3833==    by 0x47E1C7: sip::Interpreter::handle_user_sub_op(int)\n> (interpreter.cpp:1029)\n> ==3833==    by 0x47A257: sip::Interpreter::interpret(int, int)\n> (interpreter.cpp:133)\n> ==3833==    by 0x479F57: sip::Interpreter::interpret()\n> (interpreter.cpp:87)\n> ==3833==    by 0x4693D1: main (main.cpp:201)\n>\n>\n> After looking at the code, an array called temp is being passed down.\n> temp seems to be uninitialized in the calling routine. Is this the\n> expected behavior or a bug?\n>\n>\n> ---\n> Reply to this email directly or view it on GitHub:\n> https://github.com/UFParLab/aces4/pull/6/files#r18540705\n>","created_at":"2014-10-07T19:14:27Z","updated_at":"2014-10-07T19:14:27Z","html_url":"https://github.com/UFParLab/aces4/pull/6#discussion_r18541932","pull_request_url":"https://api.github.com/repos/UFParLab/aces4/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/UFParLab/aces4/pulls/comments/18541932"},"html":{"href":"https://github.com/UFParLab/aces4/pull/6#discussion_r18541932"},"pull_request":{"href":"https://api.github.com/repos/UFParLab/aces4/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/UFParLab/aces4/pulls/6","id":22366061,"html_url":"https://github.com/UFParLab/aces4/pull/6","diff_url":"https://github.com/UFParLab/aces4/pull/6.diff","patch_url":"https://github.com/UFParLab/aces4/pull/6.patch","issue_url":"https://api.github.com/repos/UFParLab/aces4/issues/6","number":6,"state":"open","locked":false,"title":"Patch add scf screening","user":{"login":"madbosun","id":7316594,"avatar_url":"https://avatars.githubusercontent.com/u/7316594?v=2","gravatar_id":"","url":"https://api.github.com/users/madbosun","html_url":"https://github.com/madbosun","followers_url":"https://api.github.com/users/madbosun/followers","following_url":"https://api.github.com/users/madbosun/following{/other_user}","gists_url":"https://api.github.com/users/madbosun/gists{/gist_id}","starred_url":"https://api.github.com/users/madbosun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madbosun/subscriptions","organizations_url":"https://api.github.com/users/madbosun/orgs","repos_url":"https://api.github.com/users/madbosun/repos","events_url":"https://api.github.com/users/madbosun/events{/privacy}","received_events_url":"https://api.github.com/users/madbosun/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-10-07T16:38:46Z","updated_at":"2014-10-07T19:14:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"523fe234f2738a705a3f42ef80bb06927929c210","assignee":{"login":"nakul02","id":5394361,"avatar_url":"https://avatars.githubusercontent.com/u/5394361?v=2","gravatar_id":"","url":"https://api.github.com/users/nakul02","html_url":"https://github.com/nakul02","followers_url":"https://api.github.com/users/nakul02/followers","following_url":"https://api.github.com/users/nakul02/following{/other_user}","gists_url":"https://api.github.com/users/nakul02/gists{/gist_id}","starred_url":"https://api.github.com/users/nakul02/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nakul02/subscriptions","organizations_url":"https://api.github.com/users/nakul02/orgs","repos_url":"https://api.github.com/users/nakul02/repos","events_url":"https://api.github.com/users/nakul02/events{/privacy}","received_events_url":"https://api.github.com/users/nakul02/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/UFParLab/aces4/pulls/6/commits","review_comments_url":"https://api.github.com/repos/UFParLab/aces4/pulls/6/comments","review_comment_url":"https://api.github.com/repos/UFParLab/aces4/pulls/comments/{number}","comments_url":"https://api.github.com/repos/UFParLab/aces4/issues/6/comments","statuses_url":"https://api.github.com/repos/UFParLab/aces4/statuses/1d610f33f7c584ce7870ab101bbb429c5a53f7bb","head":{"label":"UFParLab:patch_add_scf_screening","ref":"patch_add_scf_screening","sha":"1d610f33f7c584ce7870ab101bbb429c5a53f7bb","user":{"login":"UFParLab","id":6758727,"avatar_url":"https://avatars.githubusercontent.com/u/6758727?v=2","gravatar_id":"","url":"https://api.github.com/users/UFParLab","html_url":"https://github.com/UFParLab","followers_url":"https://api.github.com/users/UFParLab/followers","following_url":"https://api.github.com/users/UFParLab/following{/other_user}","gists_url":"https://api.github.com/users/UFParLab/gists{/gist_id}","starred_url":"https://api.github.com/users/UFParLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UFParLab/subscriptions","organizations_url":"https://api.github.com/users/UFParLab/orgs","repos_url":"https://api.github.com/users/UFParLab/repos","events_url":"https://api.github.com/users/UFParLab/events{/privacy}","received_events_url":"https://api.github.com/users/UFParLab/received_events","type":"Organization","site_admin":false},"repo":{"id":17093599,"name":"aces4","full_name":"UFParLab/aces4","owner":{"login":"UFParLab","id":6758727,"avatar_url":"https://avatars.githubusercontent.com/u/6758727?v=2","gravatar_id":"","url":"https://api.github.com/users/UFParLab","html_url":"https://github.com/UFParLab","followers_url":"https://api.github.com/users/UFParLab/followers","following_url":"https://api.github.com/users/UFParLab/following{/other_user}","gists_url":"https://api.github.com/users/UFParLab/gists{/gist_id}","starred_url":"https://api.github.com/users/UFParLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UFParLab/subscriptions","organizations_url":"https://api.github.com/users/UFParLab/orgs","repos_url":"https://api.github.com/users/UFParLab/repos","events_url":"https://api.github.com/users/UFParLab/events{/privacy}","received_events_url":"https://api.github.com/users/UFParLab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UFParLab/aces4","description":"Parallel Computational Chemistry Application","fork":false,"url":"https://api.github.com/repos/UFParLab/aces4","forks_url":"https://api.github.com/repos/UFParLab/aces4/forks","keys_url":"https://api.github.com/repos/UFParLab/aces4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UFParLab/aces4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UFParLab/aces4/teams","hooks_url":"https://api.github.com/repos/UFParLab/aces4/hooks","issue_events_url":"https://api.github.com/repos/UFParLab/aces4/issues/events{/number}","events_url":"https://api.github.com/repos/UFParLab/aces4/events","assignees_url":"https://api.github.com/repos/UFParLab/aces4/assignees{/user}","branches_url":"https://api.github.com/repos/UFParLab/aces4/branches{/branch}","tags_url":"https://api.github.com/repos/UFParLab/aces4/tags","blobs_url":"https://api.github.com/repos/UFParLab/aces4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UFParLab/aces4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UFParLab/aces4/git/refs{/sha}","trees_url":"https://api.github.com/repos/UFParLab/aces4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UFParLab/aces4/statuses/{sha}","languages_url":"https://api.github.com/repos/UFParLab/aces4/languages","stargazers_url":"https://api.github.com/repos/UFParLab/aces4/stargazers","contributors_url":"https://api.github.com/repos/UFParLab/aces4/contributors","subscribers_url":"https://api.github.com/repos/UFParLab/aces4/subscribers","subscription_url":"https://api.github.com/repos/UFParLab/aces4/subscription","commits_url":"https://api.github.com/repos/UFParLab/aces4/commits{/sha}","git_commits_url":"https://api.github.com/repos/UFParLab/aces4/git/commits{/sha}","comments_url":"https://api.github.com/repos/UFParLab/aces4/comments{/number}","issue_comment_url":"https://api.github.com/repos/UFParLab/aces4/issues/comments/{number}","contents_url":"https://api.github.com/repos/UFParLab/aces4/contents/{+path}","compare_url":"https://api.github.com/repos/UFParLab/aces4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UFParLab/aces4/merges","archive_url":"https://api.github.com/repos/UFParLab/aces4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UFParLab/aces4/downloads","issues_url":"https://api.github.com/repos/UFParLab/aces4/issues{/number}","pulls_url":"https://api.github.com/repos/UFParLab/aces4/pulls{/number}","milestones_url":"https://api.github.com/repos/UFParLab/aces4/milestones{/number}","notifications_url":"https://api.github.com/repos/UFParLab/aces4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UFParLab/aces4/labels{/name}","releases_url":"https://api.github.com/repos/UFParLab/aces4/releases{/id}","created_at":"2014-02-22T20:08:14Z","updated_at":"2014-10-01T15:54:20Z","pushed_at":"2014-10-07T16:37:51Z","git_url":"git://github.com/UFParLab/aces4.git","ssh_url":"git@github.com:UFParLab/aces4.git","clone_url":"https://github.com/UFParLab/aces4.git","svn_url":"https://github.com/UFParLab/aces4","homepage":null,"size":14776,"stargazers_count":7,"watchers_count":7,"language":"FORTRAN","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":7,"default_branch":"master"}},"base":{"label":"UFParLab:master","ref":"master","sha":"d77895b285afeeed2ce511b97a8c1ca85b8e8d04","user":{"login":"UFParLab","id":6758727,"avatar_url":"https://avatars.githubusercontent.com/u/6758727?v=2","gravatar_id":"","url":"https://api.github.com/users/UFParLab","html_url":"https://github.com/UFParLab","followers_url":"https://api.github.com/users/UFParLab/followers","following_url":"https://api.github.com/users/UFParLab/following{/other_user}","gists_url":"https://api.github.com/users/UFParLab/gists{/gist_id}","starred_url":"https://api.github.com/users/UFParLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UFParLab/subscriptions","organizations_url":"https://api.github.com/users/UFParLab/orgs","repos_url":"https://api.github.com/users/UFParLab/repos","events_url":"https://api.github.com/users/UFParLab/events{/privacy}","received_events_url":"https://api.github.com/users/UFParLab/received_events","type":"Organization","site_admin":false},"repo":{"id":17093599,"name":"aces4","full_name":"UFParLab/aces4","owner":{"login":"UFParLab","id":6758727,"avatar_url":"https://avatars.githubusercontent.com/u/6758727?v=2","gravatar_id":"","url":"https://api.github.com/users/UFParLab","html_url":"https://github.com/UFParLab","followers_url":"https://api.github.com/users/UFParLab/followers","following_url":"https://api.github.com/users/UFParLab/following{/other_user}","gists_url":"https://api.github.com/users/UFParLab/gists{/gist_id}","starred_url":"https://api.github.com/users/UFParLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UFParLab/subscriptions","organizations_url":"https://api.github.com/users/UFParLab/orgs","repos_url":"https://api.github.com/users/UFParLab/repos","events_url":"https://api.github.com/users/UFParLab/events{/privacy}","received_events_url":"https://api.github.com/users/UFParLab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UFParLab/aces4","description":"Parallel Computational Chemistry Application","fork":false,"url":"https://api.github.com/repos/UFParLab/aces4","forks_url":"https://api.github.com/repos/UFParLab/aces4/forks","keys_url":"https://api.github.com/repos/UFParLab/aces4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UFParLab/aces4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UFParLab/aces4/teams","hooks_url":"https://api.github.com/repos/UFParLab/aces4/hooks","issue_events_url":"https://api.github.com/repos/UFParLab/aces4/issues/events{/number}","events_url":"https://api.github.com/repos/UFParLab/aces4/events","assignees_url":"https://api.github.com/repos/UFParLab/aces4/assignees{/user}","branches_url":"https://api.github.com/repos/UFParLab/aces4/branches{/branch}","tags_url":"https://api.github.com/repos/UFParLab/aces4/tags","blobs_url":"https://api.github.com/repos/UFParLab/aces4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UFParLab/aces4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UFParLab/aces4/git/refs{/sha}","trees_url":"https://api.github.com/repos/UFParLab/aces4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UFParLab/aces4/statuses/{sha}","languages_url":"https://api.github.com/repos/UFParLab/aces4/languages","stargazers_url":"https://api.github.com/repos/UFParLab/aces4/stargazers","contributors_url":"https://api.github.com/repos/UFParLab/aces4/contributors","subscribers_url":"https://api.github.com/repos/UFParLab/aces4/subscribers","subscription_url":"https://api.github.com/repos/UFParLab/aces4/subscription","commits_url":"https://api.github.com/repos/UFParLab/aces4/commits{/sha}","git_commits_url":"https://api.github.com/repos/UFParLab/aces4/git/commits{/sha}","comments_url":"https://api.github.com/repos/UFParLab/aces4/comments{/number}","issue_comment_url":"https://api.github.com/repos/UFParLab/aces4/issues/comments/{number}","contents_url":"https://api.github.com/repos/UFParLab/aces4/contents/{+path}","compare_url":"https://api.github.com/repos/UFParLab/aces4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UFParLab/aces4/merges","archive_url":"https://api.github.com/repos/UFParLab/aces4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UFParLab/aces4/downloads","issues_url":"https://api.github.com/repos/UFParLab/aces4/issues{/number}","pulls_url":"https://api.github.com/repos/UFParLab/aces4/pulls{/number}","milestones_url":"https://api.github.com/repos/UFParLab/aces4/milestones{/number}","notifications_url":"https://api.github.com/repos/UFParLab/aces4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UFParLab/aces4/labels{/name}","releases_url":"https://api.github.com/repos/UFParLab/aces4/releases{/id}","created_at":"2014-02-22T20:08:14Z","updated_at":"2014-10-01T15:54:20Z","pushed_at":"2014-10-07T16:37:51Z","git_url":"git://github.com/UFParLab/aces4.git","ssh_url":"git@github.com:UFParLab/aces4.git","clone_url":"https://github.com/UFParLab/aces4.git","svn_url":"https://github.com/UFParLab/aces4","homepage":null,"size":14776,"stargazers_count":7,"watchers_count":7,"language":"FORTRAN","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/UFParLab/aces4/pulls/6"},"html":{"href":"https://github.com/UFParLab/aces4/pull/6"},"issue":{"href":"https://api.github.com/repos/UFParLab/aces4/issues/6"},"comments":{"href":"https://api.github.com/repos/UFParLab/aces4/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/UFParLab/aces4/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/UFParLab/aces4/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/UFParLab/aces4/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/UFParLab/aces4/statuses/1d610f33f7c584ce7870ab101bbb429c5a53f7bb"}}}}