********************************************************************************
*                                                                              *
*  2DHF version 1-2003                                                         *
*  Copyright (C) 1996  Jacek Kobus, Leif Laaksonen, Dage Sundholm              *
*                                                                              *
*  This software may be used and distributed according to the terms            *
*  of the GNU General Public License, see README and COPYING.                  *
*                                                                              *
********************************************************************************
c ### exint ###
c
c     Calculates the number of exchange integrals within one open nonsigma 
c     shell.
c
      subroutine exint (iorb1,ox1)
      implicit integer*4 (i-n)
      implicit real*8 (a-h,o-z)
      character*8 alpha,beta

      include 'commons8.inc'
      data alpha,beta /'+','-'/

      ox1=0.d0
      ip1=4*(iorb1-1)

c     interaction within nonsigma shell

      do i1=1,2
         if(spin(ip1+i1).ne.alpha.and.spin(ip1+i1).ne.beta) goto 10
         do i2=3,4
            if(spin(ip1+i2).ne.alpha.and.spin(ip1+i2).ne.beta) goto 12
            if(spin(ip1+i1).eq.spin(ip1+i2)) ox1=ox1+1.d0
00012       continue
         enddo
00010    continue
      enddo

      return
      end
