1c $Id$
2*
3C> \ingroup nwint
4C> @{
5C>
6C> \brief Initialize the blocking 2nd derivative integral API based on the input
7C> of a group of shell quartets (a block)
8C>
9C> Initialize the blocking 2nd derivative integral API based on the input
10C> of a group of shell quartets (a block). This routine must be called
11C> before attempting to calculate the integrals of the block.
12C>
13C> The shell quartet information may be reordered
14C> since this routine pulls out blocks that consist of only \f$s\f$, \f$p\f$,
15C> and \f$sp\f$ functions.  These blocks are computed using the \f$sp\f$ rotated
16C> axis code since it is faster than even the Texas integral code.
17C>
18C> \return Returns .true. if the initialization was successfull and the 2nd
19C> derivative integrals are ready to be calculated by `intbdd_2e4c`, and .false.
20C> otherwise (i.e. a problem was detected).
21C>
22c:tex-\subsection{intbdd\_init4c}
23c:tex-This logical function sets up the blocking integral second derivative
24c:tex-API based on the input of a group of shell quartets (a block).
25c:tex-
26c:tex-{\it Return Values:}
27c:tex-\begin{tabular}{|c|p{60mm}|} \hline
28c:tex- .true.  & blocking API initialization okay\\ \hline
29c:tex- .false. & blocking API detected a problem \\ \hline
30c:tex-\end{tabular}
31c:tex-
32c:tex-
33c:tex-The following code excerpt describes the proper use of the blocking
34c:tex-API routines.\\
35c:tex-{\it Pseudo Code:}
36c:tex-\begin{verbatim}
37c:tex-
38c:tex-* begin atom/shell loops
39c:tex-
40c:tex-      call collect_group_of_shells()
41c:tex-      okay = intbdd_init4c($\cdots$) ! with group of shells info
42c:tex-      if (.not.okay) stop ' error setting up blocking interface '
43c:tex-00001 continue
44c:tex-      more = intbdd_2e4c($\cdots$) ! with group of shells info
45c:tex-      call use_integrals_in_some_way()
46c:tex-      if (more) goto 00001
47c:tex-
48c:tex-* end atom/shell loops
49c:tex-
50c:tex-\end{verbatim}
51c:tex-
52c:tex-{\it Syntax:}
53c:tex-\begin{verbatim}
54      logical function intbdd_init4c(brain, icl, jcl, ketin, kcl, lcl,
55     &    num_q, q4, use_q4, lscr, scr, l_erilab, block_eff)
56c:tex-\end{verbatim}
57      implicit none
58*
59c
60c blocking initialization routine for 2 electron 4 center integrals
61c
62*
63c:tex-\begin{verbatim}
64      integer brain      ! [input] basis set handle for bra basis
65      integer ketin      ! [input] basis set handle for ket basis
66      integer num_q      ! [input] number of quartets
67      integer icl(num_q) ! [input] i-contraction labels for quartets
68      integer jcl(num_q) ! [input] j-contraction labels for quartets
69      integer kcl(num_q) ! [input] k-contraction labels for quartets
70      integer lcl(num_q) ! [input] l-contraction labels for quartets
71      double precision q4(num_q) ! [input] scaling factors
72      logical use_q4            ! [input] true if scaling
73      integer l_erilab   ! [input] size of eri and label arrays that
74*................................. will be used in intbdd_2e4c.F
75      integer lscr       ! [input] length of scratch array
76      double precision scr(lscr)  ! [input] scratch array
77      double precision block_eff  ! [output] blocking efficiency
78c:tex-\end{verbatim}
79#include "candoP.fh"
80#include "numb_qP.fh"
81c
82      logical status
83c
84      logical cando_txs
85      external cando_txs
86c
87      integer iq
88c
89      num_q_start = 1
90      num_q_last  = -1
91c
92      more_ints_txs = .false.
93      intbdd_init4c = .true.
94      if (num_q.eq.0) return
95      block_eff = -1.0d00
96c
97*.... check shells for txs only after intbdd_init is called and established
98      txs_b2e4c = .true.
99      status = .true.
100*.... check first 20 quartets but every other one
101      do iq = 1,min(20,num_q),2
102        status = status.and. (cando_txs(brain,icl(iq),jcl(iq)))
103        status = status.and. (cando_txs(ketin,kcl(iq),lcl(iq)))
104        if (.not.status) then
105          txs_b2e4c = .false.
106          return
107        endif
108      enddo
109      end
110C> @}
111