********************************************************************************
*                                                                              *
*  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 ### homo ###
c
c     Determines Ci symmetry of a given orbital (or set of orbitals) and uses 
c     it to replace the values in the [pi/2,pi] region by these from the
c     [0,pi/2] one. 

      subroutine homo (iorb,psi)
      implicit integer*4 (i-n)
      implicit real*8 (a-h,o-z)
      include 'commons8.inc'
      dimension psi(*)

c     ihsym = 1 - symmetry g
c     ihsym =-1 - symmetry u

      if (iorb.eq.0) then
         iorb1=1
         iorb2=norb
      else
         iorb1=iorb
         iorb2=iorb
      endif

      n2=nni/2+1
      
      do i=iorb1,iorb2
         ibeg = i1b(i)
         nmut = i1mu(i)	  
         ihsym=ihomo(i)
         call homo_det (n2,nmut,psi(ibeg),ihsym)
         if (idbg(99).ne.0) then
            write(*,*) 'homo: ihomo(iorb),ihsym',
     &           iorn(i),bond(i),gut(i),ihomo(i),ihsym
         endif
      enddo
      return
      end




