      subroutine efiss(m,n,icontr,inddyy,esp,efix,efiy,efiz,ccx,ccy,ccz,
     &                 g,density,zeta,px,py,pz,base,ss0,sscond,pxcx,
     &                 pycy,pzcz,u,ss1,saxs0,says0,sazs0,saxscond,
     &                 sayscond,sazscond)

c  this subroutine written by roger gallant and alain st-amant of the
c  department of chemistry, university of ottawa, ottawa, canada.
c  all rights reserved.  this is part of the DeFT project.

      implicit real*8(a-h,o-z)

      dimension icontr(*),inddyy(*)

      dimension g(*),density(*),zeta(*),px(*),py(*),pz(*),base(*),
     &          ss0(*),sscond(*),pxcx(*),pycy(*),pzcz(*),u(*),ss1(*),
     &          saxs0(*),says0(*),sazs0(*),saxscond(*),sayscond(*),
     &          sazscond(*)

      data zero,two,three,pi/0.0d0,2.0d0,3.0d0,3.1415926535898d0/

      twopi=two*pi

      do 1001 i=1,n
      pxcx(i)=px(i)-ccx
      pycy(i)=py(i)-ccy
      pzcz(i)=pz(i)-ccz
 1001 u(i)=zeta(i)*(pxcx(i)*pxcx(i)+pycy(i)*pycy(i)+pzcz(i)*pzcz(i))

      do 1002 i=1,n
      call augg(2,u(i),g)
      ss0(i)=base(i)*g(1)*twopi/zeta(i)
 1002 ss1(i)=base(i)*g(2)*twopi/zeta(i)

      do 1003 i=1,n
      saxs0(i)=two*zeta(i)*pxcx(i)*ss1(i)
      says0(i)=two*zeta(i)*pycy(i)*ss1(i)
 1003 sazs0(i)=two*zeta(i)*pzcz(i)*ss1(i)

      do 1004 i=1,m
 1004 sscond(i)=zero

      do 1005 i=1,n
 1005 sscond(icontr(i))=sscond(icontr(i))+ss0(i)

      do 1006 i=1,m
      saxscond(i)=zero
      sayscond(i)=zero
 1006 sazscond(i)=zero

      do 1007 i=1,n
      saxscond(icontr(i))=saxscond(icontr(i))+saxs0(i)
      sayscond(icontr(i))=sayscond(icontr(i))+says0(i)
 1007 sazscond(icontr(i))=sazscond(icontr(i))+sazs0(i)

      do 1008 i=1,m
 1008 esp=esp-density(inddyy(i))*sscond(i)

      do 1009 i=1,m
      efix=efix-density(inddyy(i))*saxscond(i)
      efiy=efiy-density(inddyy(i))*sayscond(i)
 1009 efiz=efiz-density(inddyy(i))*sazscond(i)

      return
      end
