      subroutine efidd(m,n,iminj,icontr,inddyy,esp,efix,efiy,efiz,ccx,
     &                 ccy,ccz,g,density,zeta,axbx,ayby,azbz,px,py,pz,
     &                 pxax,pyay,pzaz,base,ss0,ss1,ss2,ss3,ss4,ps0,ps1,
     &                 ps2,ps3,dscond,ds0,ds1,ds2,fscond,fs0,fs1,gscond,
     &                 gs0,dpcond,fpcond,ddcond,c,c1,c2,pxcx,pycy,
     &                 pzcz,u,twozeta,cx,cy,cz,cx1,cy1,cz1,cx2,cy2,cz2,
     &                 ss5,saxs0,says0,sazs0,saxs1,says1,sazs1,saxs2,
     &                 says2,sazs2,saxs3,says3,sazs3,saxs4,says4,sazs4,
     &                 paxs0,pays0,pazs0,paxs1,pays1,pazs1,paxs2,pays2,
     &                 pazs2,paxs3,pays3,pazs3,daxs0,days0,dazs0,daxs1,
     &                 days1,dazs1,daxs2,days2,dazs2,faxs0,fays0,fazs0,
     &                 faxs1,fays1,fazs1,gaxs0,gays0,gazs0,daxscond,
     &                 dayscond,dazscond,faxscond,fayscond,fazscond, 
     &                 gaxscond,gayscond,gazscond,daxpcond,daypcond,
     &                 dazpcond,faxpcond,faypcond,fazpcond,daxdcond,
     &                 daydcond,dazdcond)

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 iminj(*),icontr(*),inddyy(m,*)

      dimension g(*),density(*),zeta(*),axbx(*),ayby(*),azbz(*),px(*),
     &          py(*),pz(*),pxax(*),pyay(*),pzaz(*),base(*),ss0(*),
     &          ss1(*),ss2(*),ss3(*),ss4(*),ps0(n,*),ps1(n,*),ps2(n,*),
     &          ps3(n,*),dscond(m,*),ds0(n,*),ds1(n,*),ds2(n,*),
     &          fscond(m,*),fs0(n,*),fs1(n,*),gscond(m,*),gs0(n,*),
     &          dpcond(m,*),fpcond(m,*),ddcond(m,*),c(*),c1(n,*),
     &          c2(n,*),pxcx(*),pycy(*),pzcz(*),u(*),twozeta(*),
     &          cx(*),cy(*),cz(*),cx1(n,*),cy1(n,*),cz1(n,*),cx2(n,*),
     &          cy2(n,*),cz2(n,*),ss5(*),saxs0(*),says0(*),sazs0(*),
     &          saxs1(*),says1(*),sazs1(*),saxs2(*),says2(*),sazs2(*),
     &          saxs3(*),says3(*),sazs3(*),saxs4(*),says4(*),sazs4(*),
     &          paxs0(n,*),pays0(n,*),pazs0(n,*),paxs1(n,*),pays1(n,*),
     &          pazs1(n,*),paxs2(n,*),pays2(n,*),pazs2(n,*),paxs3(n,*),
     &          pays3(n,*),pazs3(n,*),daxs0(n,*),days0(n,*),dazs0(n,*),
     &          daxs1(n,*),days1(n,*),dazs1(n,*),daxs2(n,*),days2(n,*),
     &          dazs2(n,*),faxs0(n,*),fays0(n,*),fazs0(n,*),faxs1(n,*),
     &          fays1(n,*),fazs1(n,*),gaxs0(n,*),gays0(n,*),gazs0(n,*),
     &          daxscond(m,*),dayscond(m,*),dazscond(m,*),faxscond(m,*),
     &          fayscond(m,*),fazscond(m,*),gaxscond(m,*),gayscond(m,*),
     &          gazscond(m,*),daxpcond(m,*),daypcond(m,*),dazpcond(m,*),
     &          faxpcond(m,*),faypcond(m,*),fazpcond(m,*),daxdcond(m,*),
     &          daydcond(m,*),dazdcond(m,*)

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

      do 1001 i=1,n
 1001 twozeta(i)=two*zeta(i)

      twopi=two*pi

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

      do 1003 i=1,n
      call augg(6,u(i),g)
      ss0(i)=base(i)*g(1)*twopi/zeta(i)
      ss1(i)=base(i)*g(2)*twopi/zeta(i)
      ss2(i)=base(i)*g(3)*twopi/zeta(i)
      ss3(i)=base(i)*g(4)*twopi/zeta(i)
      ss4(i)=base(i)*g(5)*twopi/zeta(i)
 1003 ss5(i)=base(i)*g(6)*twopi/zeta(i)

      do 1004 i=1,n

      ps0(i,1)=pxax(i)*ss0(i)-pxcx(i)*ss1(i)
      ps0(i,2)=pyay(i)*ss0(i)-pycy(i)*ss1(i)
      ps0(i,3)=pzaz(i)*ss0(i)-pzcz(i)*ss1(i)

      ps1(i,1)=pxax(i)*ss1(i)-pxcx(i)*ss2(i)
      ps1(i,2)=pyay(i)*ss1(i)-pycy(i)*ss2(i)
      ps1(i,3)=pzaz(i)*ss1(i)-pzcz(i)*ss2(i)

      ps2(i,1)=pxax(i)*ss2(i)-pxcx(i)*ss3(i)
      ps2(i,2)=pyay(i)*ss2(i)-pycy(i)*ss3(i)
      ps2(i,3)=pzaz(i)*ss2(i)-pzcz(i)*ss3(i)

      ps3(i,1)=pxax(i)*ss3(i)-pxcx(i)*ss4(i)
      ps3(i,2)=pyay(i)*ss3(i)-pycy(i)*ss4(i)
      ps3(i,3)=pzaz(i)*ss3(i)-pzcz(i)*ss4(i)

 1004 continue

      do 1005 i=1,n
 1005 c(i)=(ss0(i)-ss1(i))/twozeta(i)

      do 1006 i=1,n
      ds0(i,1)=pxax(i)*ps0(i,1)-pxcx(i)*ps1(i,1)+c(i)
      ds0(i,2)=pyay(i)*ps0(i,1)-pycy(i)*ps1(i,1)
      ds0(i,3)=pzaz(i)*ps0(i,1)-pzcz(i)*ps1(i,1)
      ds0(i,4)=pyay(i)*ps0(i,2)-pycy(i)*ps1(i,2)+c(i)
      ds0(i,5)=pzaz(i)*ps0(i,2)-pzcz(i)*ps1(i,2)
 1006 ds0(i,6)=pzaz(i)*ps0(i,3)-pzcz(i)*ps1(i,3)+c(i)

      do 1007 i=1,n
 1007 c(i)=(ss1(i)-ss2(i))/twozeta(i)

      do 1008 i=1,n
      ds1(i,1)=pxax(i)*ps1(i,1)-pxcx(i)*ps2(i,1)+c(i)
      ds1(i,2)=pyay(i)*ps1(i,1)-pycy(i)*ps2(i,1)
      ds1(i,3)=pzaz(i)*ps1(i,1)-pzcz(i)*ps2(i,1)
      ds1(i,4)=pyay(i)*ps1(i,2)-pycy(i)*ps2(i,2)+c(i)
      ds1(i,5)=pzaz(i)*ps1(i,2)-pzcz(i)*ps2(i,2)
 1008 ds1(i,6)=pzaz(i)*ps1(i,3)-pzcz(i)*ps2(i,3)+c(i)

      do 1009 i=1,n
 1009 c(i)=(ss2(i)-ss3(i))/twozeta(i)

      do 1010 i=1,n
      ds2(i,1)=pxax(i)*ps2(i,1)-pxcx(i)*ps3(i,1)+c(i)
      ds2(i,2)=pyay(i)*ps2(i,1)-pycy(i)*ps3(i,1)
      ds2(i,3)=pzaz(i)*ps2(i,1)-pzcz(i)*ps3(i,1)
      ds2(i,4)=pyay(i)*ps2(i,2)-pycy(i)*ps3(i,2)+c(i)
      ds2(i,5)=pzaz(i)*ps2(i,2)-pzcz(i)*ps3(i,2)
 1010 ds2(i,6)=pzaz(i)*ps2(i,3)-pzcz(i)*ps3(i,3)+c(i)

      do 1011 j=1,3
      do 1011 i=1,n
 1011 c1(i,j)=(ps0(i,j)-ps1(i,j))/twozeta(i)

      do 1012 i=1,n
      fs0(i,01)=pxax(i)*ds0(i,1)-pxcx(i)*ds1(i,1)+c1(i,1)*two
      fs0(i,02)=pyay(i)*ds0(i,1)-pycy(i)*ds1(i,1)
      fs0(i,03)=pzaz(i)*ds0(i,1)-pzcz(i)*ds1(i,1)
      fs0(i,04)=pyay(i)*ds0(i,2)-pycy(i)*ds1(i,2)+c1(i,1)
      fs0(i,05)=pzaz(i)*ds0(i,2)-pzcz(i)*ds1(i,2)
      fs0(i,06)=pzaz(i)*ds0(i,3)-pzcz(i)*ds1(i,3)+c1(i,1)
      fs0(i,07)=pyay(i)*ds0(i,4)-pycy(i)*ds1(i,4)+c1(i,2)*two
      fs0(i,08)=pzaz(i)*ds0(i,4)-pzcz(i)*ds1(i,4)
      fs0(i,09)=pzaz(i)*ds0(i,5)-pzcz(i)*ds1(i,5)+c1(i,2)
 1012 fs0(i,10)=pzaz(i)*ds0(i,6)-pzcz(i)*ds1(i,6)+c1(i,3)*two

      do 1013 j=1,3
      do 1013 i=1,n
 1013 c1(i,j)=(ps1(i,j)-ps2(i,j))/twozeta(i)

      do 1014 i=1,n
      fs1(i,01)=pxax(i)*ds1(i,1)-pxcx(i)*ds2(i,1)+c1(i,1)*two
      fs1(i,02)=pyay(i)*ds1(i,1)-pycy(i)*ds2(i,1)
      fs1(i,03)=pzaz(i)*ds1(i,1)-pzcz(i)*ds2(i,1)
      fs1(i,04)=pyay(i)*ds1(i,2)-pycy(i)*ds2(i,2)+c1(i,1)
      fs1(i,05)=pzaz(i)*ds1(i,2)-pzcz(i)*ds2(i,2)
      fs1(i,06)=pzaz(i)*ds1(i,3)-pzcz(i)*ds2(i,3)+c1(i,1)
      fs1(i,07)=pyay(i)*ds1(i,4)-pycy(i)*ds2(i,4)+c1(i,2)*two
      fs1(i,08)=pzaz(i)*ds1(i,4)-pzcz(i)*ds2(i,4)
      fs1(i,09)=pzaz(i)*ds1(i,5)-pzcz(i)*ds2(i,5)+c1(i,2)
 1014 fs1(i,10)=pzaz(i)*ds1(i,6)-pzcz(i)*ds2(i,6)+c1(i,3)*two

      do 1015 j=1,6
      do 1015 i=1,n
 1015 c2(i,j)=(ds0(i,j)-ds1(i,j))/twozeta(i)

      do 1016 i=1,n
      gs0(i,01)=pxax(i)*fs0(i,01)-pxcx(i)*fs1(i,01)+c2(i,1)*three
      gs0(i,02)=pyay(i)*fs0(i,01)-pycy(i)*fs1(i,01)
      gs0(i,03)=pzaz(i)*fs0(i,01)-pzcz(i)*fs1(i,01)
      gs0(i,04)=pyay(i)*fs0(i,02)-pycy(i)*fs1(i,02)+c2(i,1)
      gs0(i,05)=pzaz(i)*fs0(i,02)-pzcz(i)*fs1(i,02)
      gs0(i,06)=pzaz(i)*fs0(i,03)-pzcz(i)*fs1(i,03)+c2(i,1)
      gs0(i,07)=pyay(i)*fs0(i,04)-pycy(i)*fs1(i,04)+c2(i,2)*two
      gs0(i,08)=pzaz(i)*fs0(i,04)-pzcz(i)*fs1(i,04)
      gs0(i,09)=pzaz(i)*fs0(i,05)-pzcz(i)*fs1(i,05)+c2(i,2)
      gs0(i,10)=pzaz(i)*fs0(i,06)-pzcz(i)*fs1(i,06)+c2(i,3)*two
      gs0(i,11)=pyay(i)*fs0(i,07)-pycy(i)*fs1(i,07)+c2(i,4)*three
      gs0(i,12)=pzaz(i)*fs0(i,07)-pzcz(i)*fs1(i,07)
      gs0(i,13)=pzaz(i)*fs0(i,08)-pzcz(i)*fs1(i,08)+c2(i,4)
      gs0(i,14)=pzaz(i)*fs0(i,09)-pzcz(i)*fs1(i,09)+c2(i,5)*two
 1016 gs0(i,15)=pzaz(i)*fs0(i,10)-pzcz(i)*fs1(i,10)+c2(i,6)*three

      do 1017 i=1,n

      saxs0(i)=twozeta(i)*pxcx(i)*ss1(i)
      says0(i)=twozeta(i)*pycy(i)*ss1(i)
      sazs0(i)=twozeta(i)*pzcz(i)*ss1(i)

      saxs1(i)=twozeta(i)*pxcx(i)*ss2(i)
      says1(i)=twozeta(i)*pycy(i)*ss2(i)
      sazs1(i)=twozeta(i)*pzcz(i)*ss2(i)

      saxs2(i)=twozeta(i)*pxcx(i)*ss3(i)
      says2(i)=twozeta(i)*pycy(i)*ss3(i)
      sazs2(i)=twozeta(i)*pzcz(i)*ss3(i)

      saxs3(i)=twozeta(i)*pxcx(i)*ss4(i)
      says3(i)=twozeta(i)*pycy(i)*ss4(i)
      sazs3(i)=twozeta(i)*pzcz(i)*ss4(i)

      saxs4(i)=twozeta(i)*pxcx(i)*ss5(i)
      says4(i)=twozeta(i)*pycy(i)*ss5(i)
      sazs4(i)=twozeta(i)*pzcz(i)*ss5(i)

 1017 continue

      do 1018 i=1,n

      paxs0(i,1)=pxax(i)*saxs0(i)-pxcx(i)*saxs1(i)+ss1(i)
      paxs0(i,2)=pyay(i)*saxs0(i)-pycy(i)*saxs1(i)
      paxs0(i,3)=pzaz(i)*saxs0(i)-pzcz(i)*saxs1(i)
      pays0(i,1)=pxax(i)*says0(i)-pxcx(i)*says1(i)
      pays0(i,2)=pyay(i)*says0(i)-pycy(i)*says1(i)+ss1(i)
      pays0(i,3)=pzaz(i)*says0(i)-pzcz(i)*says1(i)
      pazs0(i,1)=pxax(i)*sazs0(i)-pxcx(i)*sazs1(i)
      pazs0(i,2)=pyay(i)*sazs0(i)-pycy(i)*sazs1(i)
      pazs0(i,3)=pzaz(i)*sazs0(i)-pzcz(i)*sazs1(i)+ss1(i)

      paxs1(i,1)=pxax(i)*saxs1(i)-pxcx(i)*saxs2(i)+ss2(i)
      paxs1(i,2)=pyay(i)*saxs1(i)-pycy(i)*saxs2(i)
      paxs1(i,3)=pzaz(i)*saxs1(i)-pzcz(i)*saxs2(i)
      pays1(i,1)=pxax(i)*says1(i)-pxcx(i)*says2(i)
      pays1(i,2)=pyay(i)*says1(i)-pycy(i)*says2(i)+ss2(i)
      pays1(i,3)=pzaz(i)*says1(i)-pzcz(i)*says2(i)
      pazs1(i,1)=pxax(i)*sazs1(i)-pxcx(i)*sazs2(i)
      pazs1(i,2)=pyay(i)*sazs1(i)-pycy(i)*sazs2(i)
      pazs1(i,3)=pzaz(i)*sazs1(i)-pzcz(i)*sazs2(i)+ss2(i)

      paxs2(i,1)=pxax(i)*saxs2(i)-pxcx(i)*saxs3(i)+ss3(i)
      paxs2(i,2)=pyay(i)*saxs2(i)-pycy(i)*saxs3(i)
      paxs2(i,3)=pzaz(i)*saxs2(i)-pzcz(i)*saxs3(i)
      pays2(i,1)=pxax(i)*says2(i)-pxcx(i)*says3(i)
      pays2(i,2)=pyay(i)*says2(i)-pycy(i)*says3(i)+ss3(i)
      pays2(i,3)=pzaz(i)*says2(i)-pzcz(i)*says3(i)
      pazs2(i,1)=pxax(i)*sazs2(i)-pxcx(i)*sazs3(i)
      pazs2(i,2)=pyay(i)*sazs2(i)-pycy(i)*sazs3(i)
      pazs2(i,3)=pzaz(i)*sazs2(i)-pzcz(i)*sazs3(i)+ss3(i)

      paxs3(i,1)=pxax(i)*saxs3(i)-pxcx(i)*saxs4(i)+ss4(i)
      paxs3(i,2)=pyay(i)*saxs3(i)-pycy(i)*saxs4(i)
      paxs3(i,3)=pzaz(i)*saxs3(i)-pzcz(i)*saxs4(i)
      pays3(i,1)=pxax(i)*says3(i)-pxcx(i)*says4(i)
      pays3(i,2)=pyay(i)*says3(i)-pycy(i)*says4(i)+ss4(i)
      pays3(i,3)=pzaz(i)*says3(i)-pzcz(i)*says4(i)
      pazs3(i,1)=pxax(i)*sazs3(i)-pxcx(i)*sazs4(i)
      pazs3(i,2)=pyay(i)*sazs3(i)-pycy(i)*sazs4(i)
      pazs3(i,3)=pzaz(i)*sazs3(i)-pzcz(i)*sazs4(i)+ss4(i)

 1018 continue

      do 1019 i=1,n
      cx(i)=(saxs0(i)-saxs1(i))/twozeta(i)
      cy(i)=(says0(i)-says1(i))/twozeta(i)
 1019 cz(i)=(sazs0(i)-sazs1(i))/twozeta(i)

      do 1020 i=1,n
      daxs0(i,1)=pxax(i)*paxs0(i,1)-pxcx(i)*paxs1(i,1)+cx(i)+ps1(i,1)
      daxs0(i,2)=pyay(i)*paxs0(i,1)-pycy(i)*paxs1(i,1)
      daxs0(i,3)=pzaz(i)*paxs0(i,1)-pzcz(i)*paxs1(i,1)
      daxs0(i,4)=pyay(i)*paxs0(i,2)-pycy(i)*paxs1(i,2)+cx(i)
      daxs0(i,5)=pzaz(i)*paxs0(i,2)-pzcz(i)*paxs1(i,2)
      daxs0(i,6)=pzaz(i)*paxs0(i,3)-pzcz(i)*paxs1(i,3)+cx(i)
      days0(i,1)=pxax(i)*pays0(i,1)-pxcx(i)*pays1(i,1)+cy(i)
      days0(i,2)=pyay(i)*pays0(i,1)-pycy(i)*pays1(i,1)      +ps1(i,1)
      days0(i,3)=pzaz(i)*pays0(i,1)-pzcz(i)*pays1(i,1)
      days0(i,4)=pyay(i)*pays0(i,2)-pycy(i)*pays1(i,2)+cy(i)+ps1(i,2)
      days0(i,5)=pzaz(i)*pays0(i,2)-pzcz(i)*pays1(i,2)
      days0(i,6)=pzaz(i)*pays0(i,3)-pzcz(i)*pays1(i,3)+cy(i)
      dazs0(i,1)=pxax(i)*pazs0(i,1)-pxcx(i)*pazs1(i,1)+cz(i)
      dazs0(i,2)=pyay(i)*pazs0(i,1)-pycy(i)*pazs1(i,1)
      dazs0(i,3)=pzaz(i)*pazs0(i,1)-pzcz(i)*pazs1(i,1)      +ps1(i,1)
      dazs0(i,4)=pyay(i)*pazs0(i,2)-pycy(i)*pazs1(i,2)+cz(i)
      dazs0(i,5)=pzaz(i)*pazs0(i,2)-pzcz(i)*pazs1(i,2)      +ps1(i,2)
 1020 dazs0(i,6)=pzaz(i)*pazs0(i,3)-pzcz(i)*pazs1(i,3)+cz(i)+ps1(i,3)

      do 1021 i=1,n
      cx(i)=(saxs1(i)-saxs2(i))/twozeta(i)
      cy(i)=(says1(i)-says2(i))/twozeta(i)
 1021 cz(i)=(sazs1(i)-sazs2(i))/twozeta(i)

      do 1022 i=1,n
      daxs1(i,1)=pxax(i)*paxs1(i,1)-pxcx(i)*paxs2(i,1)+cx(i)+ps2(i,1)
      daxs1(i,2)=pyay(i)*paxs1(i,1)-pycy(i)*paxs2(i,1)
      daxs1(i,3)=pzaz(i)*paxs1(i,1)-pzcz(i)*paxs2(i,1)
      daxs1(i,4)=pyay(i)*paxs1(i,2)-pycy(i)*paxs2(i,2)+cx(i)
      daxs1(i,5)=pzaz(i)*paxs1(i,2)-pzcz(i)*paxs2(i,2)
      daxs1(i,6)=pzaz(i)*paxs1(i,3)-pzcz(i)*paxs2(i,3)+cx(i)
      days1(i,1)=pxax(i)*pays1(i,1)-pxcx(i)*pays2(i,1)+cy(i)
      days1(i,2)=pyay(i)*pays1(i,1)-pycy(i)*pays2(i,1)      +ps2(i,1)
      days1(i,3)=pzaz(i)*pays1(i,1)-pzcz(i)*pays2(i,1)
      days1(i,4)=pyay(i)*pays1(i,2)-pycy(i)*pays2(i,2)+cy(i)+ps2(i,2)
      days1(i,5)=pzaz(i)*pays1(i,2)-pzcz(i)*pays2(i,2)
      days1(i,6)=pzaz(i)*pays1(i,3)-pzcz(i)*pays2(i,3)+cy(i)
      dazs1(i,1)=pxax(i)*pazs1(i,1)-pxcx(i)*pazs2(i,1)+cz(i)
      dazs1(i,2)=pyay(i)*pazs1(i,1)-pycy(i)*pazs2(i,1)
      dazs1(i,3)=pzaz(i)*pazs1(i,1)-pzcz(i)*pazs2(i,1)      +ps2(i,1)
      dazs1(i,4)=pyay(i)*pazs1(i,2)-pycy(i)*pazs2(i,2)+cz(i)
      dazs1(i,5)=pzaz(i)*pazs1(i,2)-pzcz(i)*pazs2(i,2)      +ps2(i,2)
 1022 dazs1(i,6)=pzaz(i)*pazs1(i,3)-pzcz(i)*pazs2(i,3)+cz(i)+ps2(i,3)

      do 1023 i=1,n
      cx(i)=(saxs2(i)-saxs3(i))/twozeta(i)
      cy(i)=(says2(i)-says3(i))/twozeta(i)
 1023 cz(i)=(sazs2(i)-sazs3(i))/twozeta(i)

      do 1024 i=1,n
      daxs2(i,1)=pxax(i)*paxs2(i,1)-pxcx(i)*paxs3(i,1)+cx(i)+ps3(i,1)
      daxs2(i,2)=pyay(i)*paxs2(i,1)-pycy(i)*paxs3(i,1)
      daxs2(i,3)=pzaz(i)*paxs2(i,1)-pzcz(i)*paxs3(i,1)
      daxs2(i,4)=pyay(i)*paxs2(i,2)-pycy(i)*paxs3(i,2)+cx(i)
      daxs2(i,5)=pzaz(i)*paxs2(i,2)-pzcz(i)*paxs3(i,2)
      daxs2(i,6)=pzaz(i)*paxs2(i,3)-pzcz(i)*paxs3(i,3)+cx(i)
      days2(i,1)=pxax(i)*pays2(i,1)-pxcx(i)*pays3(i,1)+cy(i)
      days2(i,2)=pyay(i)*pays2(i,1)-pycy(i)*pays3(i,1)      +ps3(i,1)
      days2(i,3)=pzaz(i)*pays2(i,1)-pzcz(i)*pays3(i,1)
      days2(i,4)=pyay(i)*pays2(i,2)-pycy(i)*pays3(i,2)+cy(i)+ps3(i,2)
      days2(i,5)=pzaz(i)*pays2(i,2)-pzcz(i)*pays3(i,2)
      days2(i,6)=pzaz(i)*pays2(i,3)-pzcz(i)*pays3(i,3)+cy(i)
      dazs2(i,1)=pxax(i)*pazs2(i,1)-pxcx(i)*pazs3(i,1)+cz(i)
      dazs2(i,2)=pyay(i)*pazs2(i,1)-pycy(i)*pazs3(i,1)
      dazs2(i,3)=pzaz(i)*pazs2(i,1)-pzcz(i)*pazs3(i,1)      +ps3(i,1)
      dazs2(i,4)=pyay(i)*pazs2(i,2)-pycy(i)*pazs3(i,2)+cz(i)
      dazs2(i,5)=pzaz(i)*pazs2(i,2)-pzcz(i)*pazs3(i,2)      +ps3(i,2)
 1024 dazs2(i,6)=pzaz(i)*pazs2(i,3)-pzcz(i)*pazs3(i,3)+cz(i)+ps3(i,3)

      do 1025 j=1,3
      do 1025 i=1,n
      cx1(i,j)=(paxs0(i,j)-paxs1(i,j))/twozeta(i)
      cy1(i,j)=(pays0(i,j)-pays1(i,j))/twozeta(i)
 1025 cz1(i,j)=(pazs0(i,j)-pazs1(i,j))/twozeta(i)

      do 1026 i=1,n
      faxs0(i,01)=pxax(i)*daxs0(i,1)-pxcx(i)*daxs1(i,1)+cx1(i,1)*two
     &                                                 +ds1(i,1)
      faxs0(i,02)=pyay(i)*daxs0(i,1)-pycy(i)*daxs1(i,1)
      faxs0(i,03)=pzaz(i)*daxs0(i,1)-pzcz(i)*daxs1(i,1)
      faxs0(i,04)=pyay(i)*daxs0(i,2)-pycy(i)*daxs1(i,2)+cx1(i,1)
      faxs0(i,05)=pzaz(i)*daxs0(i,2)-pzcz(i)*daxs1(i,2)
      faxs0(i,06)=pzaz(i)*daxs0(i,3)-pzcz(i)*daxs1(i,3)+cx1(i,1)
      faxs0(i,07)=pyay(i)*daxs0(i,4)-pycy(i)*daxs1(i,4)+cx1(i,2)*two
      faxs0(i,08)=pzaz(i)*daxs0(i,4)-pzcz(i)*daxs1(i,4)
      faxs0(i,09)=pzaz(i)*daxs0(i,5)-pzcz(i)*daxs1(i,5)+cx1(i,2)
      faxs0(i,10)=pzaz(i)*daxs0(i,6)-pzcz(i)*daxs1(i,6)+cx1(i,3)*two
      fays0(i,01)=pxax(i)*days0(i,1)-pxcx(i)*days1(i,1)+cy1(i,1)*two
      fays0(i,02)=pyay(i)*days0(i,1)-pycy(i)*days1(i,1)
     &                                                 +ds1(i,1)
      fays0(i,03)=pzaz(i)*days0(i,1)-pzcz(i)*days1(i,1)
      fays0(i,04)=pyay(i)*days0(i,2)-pycy(i)*days1(i,2)+cy1(i,1)
     &                                                 +ds1(i,2)
      fays0(i,05)=pzaz(i)*days0(i,2)-pzcz(i)*days1(i,2)
      fays0(i,06)=pzaz(i)*days0(i,3)-pzcz(i)*days1(i,3)+cy1(i,1)
      fays0(i,07)=pyay(i)*days0(i,4)-pycy(i)*days1(i,4)+cy1(i,2)*two
     &                                                 +ds1(i,4)
      fays0(i,08)=pzaz(i)*days0(i,4)-pzcz(i)*days1(i,4)
      fays0(i,09)=pzaz(i)*days0(i,5)-pzcz(i)*days1(i,5)+cy1(i,2)
      fays0(i,10)=pzaz(i)*days0(i,6)-pzcz(i)*days1(i,6)+cy1(i,3)*two
      fazs0(i,01)=pxax(i)*dazs0(i,1)-pxcx(i)*dazs1(i,1)+cz1(i,1)*two
      fazs0(i,02)=pyay(i)*dazs0(i,1)-pycy(i)*dazs1(i,1)
      fazs0(i,03)=pzaz(i)*dazs0(i,1)-pzcz(i)*dazs1(i,1)
     &                                                 +ds1(i,1)
      fazs0(i,04)=pyay(i)*dazs0(i,2)-pycy(i)*dazs1(i,2)+cz1(i,1)
      fazs0(i,05)=pzaz(i)*dazs0(i,2)-pzcz(i)*dazs1(i,2)
     &                                                 +ds1(i,2)
      fazs0(i,06)=pzaz(i)*dazs0(i,3)-pzcz(i)*dazs1(i,3)+cz1(i,1)
     &                                                 +ds1(i,3)
      fazs0(i,07)=pyay(i)*dazs0(i,4)-pycy(i)*dazs1(i,4)+cz1(i,2)*two
      fazs0(i,08)=pzaz(i)*dazs0(i,4)-pzcz(i)*dazs1(i,4)
     &                                                 +ds1(i,4)
      fazs0(i,09)=pzaz(i)*dazs0(i,5)-pzcz(i)*dazs1(i,5)+cz1(i,2)
     &                                                 +ds1(i,5)
 1026 fazs0(i,10)=pzaz(i)*dazs0(i,6)-pzcz(i)*dazs1(i,6)+cz1(i,3)*two
     &                                                 +ds1(i,6)

      do 1027 j=1,3
      do 1027 i=1,n
      cx1(i,j)=(paxs1(i,j)-paxs2(i,j))/twozeta(i)
      cy1(i,j)=(pays1(i,j)-pays2(i,j))/twozeta(i)
 1027 cz1(i,j)=(pazs1(i,j)-pazs2(i,j))/twozeta(i)

      do 1028 i=1,n
      faxs1(i,01)=pxax(i)*daxs1(i,1)-pxcx(i)*daxs2(i,1)+cx1(i,1)*two
     &                                                 +ds2(i,1)
      faxs1(i,02)=pyay(i)*daxs1(i,1)-pycy(i)*daxs2(i,1)
      faxs1(i,03)=pzaz(i)*daxs1(i,1)-pzcz(i)*daxs2(i,1)
      faxs1(i,04)=pyay(i)*daxs1(i,2)-pycy(i)*daxs2(i,2)+cx1(i,1)
      faxs1(i,05)=pzaz(i)*daxs1(i,2)-pzcz(i)*daxs2(i,2)
      faxs1(i,06)=pzaz(i)*daxs1(i,3)-pzcz(i)*daxs2(i,3)+cx1(i,1)
      faxs1(i,07)=pyay(i)*daxs1(i,4)-pycy(i)*daxs2(i,4)+cx1(i,2)*two
      faxs1(i,08)=pzaz(i)*daxs1(i,4)-pzcz(i)*daxs2(i,4)
      faxs1(i,09)=pzaz(i)*daxs1(i,5)-pzcz(i)*daxs2(i,5)+cx1(i,2)
      faxs1(i,10)=pzaz(i)*daxs1(i,6)-pzcz(i)*daxs2(i,6)+cx1(i,3)*two
      fays1(i,01)=pxax(i)*days1(i,1)-pxcx(i)*days2(i,1)+cy1(i,1)*two
      fays1(i,02)=pyay(i)*days1(i,1)-pycy(i)*days2(i,1)
     &                                                 +ds2(i,1)
      fays1(i,03)=pzaz(i)*days1(i,1)-pzcz(i)*days2(i,1)
      fays1(i,04)=pyay(i)*days1(i,2)-pycy(i)*days2(i,2)+cy1(i,1)
     &                                                 +ds2(i,2)
      fays1(i,05)=pzaz(i)*days1(i,2)-pzcz(i)*days2(i,2)
      fays1(i,06)=pzaz(i)*days1(i,3)-pzcz(i)*days2(i,3)+cy1(i,1)
      fays1(i,07)=pyay(i)*days1(i,4)-pycy(i)*days2(i,4)+cy1(i,2)*two
     &                                                 +ds2(i,4)
      fays1(i,08)=pzaz(i)*days1(i,4)-pzcz(i)*days2(i,4)
      fays1(i,09)=pzaz(i)*days1(i,5)-pzcz(i)*days2(i,5)+cy1(i,2)
      fays1(i,10)=pzaz(i)*days1(i,6)-pzcz(i)*days2(i,6)+cy1(i,3)*two
      fazs1(i,01)=pxax(i)*dazs1(i,1)-pxcx(i)*dazs2(i,1)+cz1(i,1)*two
      fazs1(i,02)=pyay(i)*dazs1(i,1)-pycy(i)*dazs2(i,1)
      fazs1(i,03)=pzaz(i)*dazs1(i,1)-pzcz(i)*dazs2(i,1)
     &                                                 +ds2(i,1)
      fazs1(i,04)=pyay(i)*dazs1(i,2)-pycy(i)*dazs2(i,2)+cz1(i,1)
      fazs1(i,05)=pzaz(i)*dazs1(i,2)-pzcz(i)*dazs2(i,2)
     &                                                 +ds2(i,2)
      fazs1(i,06)=pzaz(i)*dazs1(i,3)-pzcz(i)*dazs2(i,3)+cz1(i,1)
     &                                                 +ds2(i,3)
      fazs1(i,07)=pyay(i)*dazs1(i,4)-pycy(i)*dazs2(i,4)+cz1(i,2)*two
      fazs1(i,08)=pzaz(i)*dazs1(i,4)-pzcz(i)*dazs2(i,4)
     &                                                 +ds2(i,4)
      fazs1(i,09)=pzaz(i)*dazs1(i,5)-pzcz(i)*dazs2(i,5)+cz1(i,2)
     &                                                 +ds2(i,5)
 1028 fazs1(i,10)=pzaz(i)*dazs1(i,6)-pzcz(i)*dazs2(i,6)+cz1(i,3)*two
     &                                                 +ds2(i,6)

      do 1029 j=1,6
      do 1029 i=1,n
      cx2(i,j)=(daxs0(i,j)-daxs1(i,j))/twozeta(i)
      cy2(i,j)=(days0(i,j)-days1(i,j))/twozeta(i)
 1029 cz2(i,j)=(dazs0(i,j)-dazs1(i,j))/twozeta(i)

      do 1030 i=1,n
      gaxs0(i,01)=pxax(i)*faxs0(i,01)-pxcx(i)*faxs1(i,01)+cx2(i,1)*three
     &                                                   +fs1(i,1)
      gaxs0(i,02)=pyay(i)*faxs0(i,01)-pycy(i)*faxs1(i,01)
      gaxs0(i,03)=pzaz(i)*faxs0(i,01)-pzcz(i)*faxs1(i,01)
      gaxs0(i,04)=pyay(i)*faxs0(i,02)-pycy(i)*faxs1(i,02)+cx2(i,1)
      gaxs0(i,05)=pzaz(i)*faxs0(i,02)-pzcz(i)*faxs1(i,02)
      gaxs0(i,06)=pzaz(i)*faxs0(i,03)-pzcz(i)*faxs1(i,03)+cx2(i,1)
      gaxs0(i,07)=pyay(i)*faxs0(i,04)-pycy(i)*faxs1(i,04)+cx2(i,2)*two
      gaxs0(i,08)=pzaz(i)*faxs0(i,04)-pzcz(i)*faxs1(i,04)
      gaxs0(i,09)=pzaz(i)*faxs0(i,05)-pzcz(i)*faxs1(i,05)+cx2(i,2)
      gaxs0(i,10)=pzaz(i)*faxs0(i,06)-pzcz(i)*faxs1(i,06)+cx2(i,3)*two
      gaxs0(i,11)=pyay(i)*faxs0(i,07)-pycy(i)*faxs1(i,07)+cx2(i,4)*three
      gaxs0(i,12)=pzaz(i)*faxs0(i,07)-pzcz(i)*faxs1(i,07)
      gaxs0(i,13)=pzaz(i)*faxs0(i,08)-pzcz(i)*faxs1(i,08)+cx2(i,4)
      gaxs0(i,14)=pzaz(i)*faxs0(i,09)-pzcz(i)*faxs1(i,09)+cx2(i,5)*two
      gaxs0(i,15)=pzaz(i)*faxs0(i,10)-pzcz(i)*faxs1(i,10)+cx2(i,6)*three
      gays0(i,01)=pxax(i)*fays0(i,01)-pxcx(i)*fays1(i,01)+cy2(i,1)*three
      gays0(i,02)=pyay(i)*fays0(i,01)-pycy(i)*fays1(i,01)
     &                                                   +fs1(i,1)
      gays0(i,03)=pzaz(i)*fays0(i,01)-pzcz(i)*fays1(i,01)
      gays0(i,04)=pyay(i)*fays0(i,02)-pycy(i)*fays1(i,02)+cy2(i,1)
     &                                                   +fs1(i,2)
      gays0(i,05)=pzaz(i)*fays0(i,02)-pzcz(i)*fays1(i,02)
      gays0(i,06)=pzaz(i)*fays0(i,03)-pzcz(i)*fays1(i,03)+cy2(i,1)
      gays0(i,07)=pyay(i)*fays0(i,04)-pycy(i)*fays1(i,04)+cy2(i,2)*two
     &                                                   +fs1(i,4)
      gays0(i,08)=pzaz(i)*fays0(i,04)-pzcz(i)*fays1(i,04)
      gays0(i,09)=pzaz(i)*fays0(i,05)-pzcz(i)*fays1(i,05)+cy2(i,2)
      gays0(i,10)=pzaz(i)*fays0(i,06)-pzcz(i)*fays1(i,06)+cy2(i,3)*two
      gays0(i,11)=pyay(i)*fays0(i,07)-pycy(i)*fays1(i,07)+cy2(i,4)*three
     &                                                   +fs1(i,7)
      gays0(i,12)=pzaz(i)*fays0(i,07)-pzcz(i)*fays1(i,07)
      gays0(i,13)=pzaz(i)*fays0(i,08)-pzcz(i)*fays1(i,08)+cy2(i,4)
      gays0(i,14)=pzaz(i)*fays0(i,09)-pzcz(i)*fays1(i,09)+cy2(i,5)*two
      gays0(i,15)=pzaz(i)*fays0(i,10)-pzcz(i)*fays1(i,10)+cy2(i,6)*three
      gazs0(i,01)=pxax(i)*fazs0(i,01)-pxcx(i)*fazs1(i,01)+cz2(i,1)*three
      gazs0(i,02)=pyay(i)*fazs0(i,01)-pycy(i)*fazs1(i,01)
      gazs0(i,03)=pzaz(i)*fazs0(i,01)-pzcz(i)*fazs1(i,01)
     &                                                   +fs1(i,1)
      gazs0(i,04)=pyay(i)*fazs0(i,02)-pycy(i)*fazs1(i,02)+cz2(i,1)
      gazs0(i,05)=pzaz(i)*fazs0(i,02)-pzcz(i)*fazs1(i,02)
     &                                                   +fs1(i,2)
      gazs0(i,06)=pzaz(i)*fazs0(i,03)-pzcz(i)*fazs1(i,03)+cz2(i,1)
     &                                                   +fs1(i,3)
      gazs0(i,07)=pyay(i)*fazs0(i,04)-pycy(i)*fazs1(i,04)+cz2(i,2)*two
      gazs0(i,08)=pzaz(i)*fazs0(i,04)-pzcz(i)*fazs1(i,04)
     &                                                   +fs1(i,4)
      gazs0(i,09)=pzaz(i)*fazs0(i,05)-pzcz(i)*fazs1(i,05)+cz2(i,2)
     &                                                   +fs1(i,5)
      gazs0(i,10)=pzaz(i)*fazs0(i,06)-pzcz(i)*fazs1(i,06)+cz2(i,3)*two
     &                                                   +fs1(i,6)
      gazs0(i,11)=pyay(i)*fazs0(i,07)-pycy(i)*fazs1(i,07)+cz2(i,4)*three
      gazs0(i,12)=pzaz(i)*fazs0(i,07)-pzcz(i)*fazs1(i,07)
     &                                                   +fs1(i,7)
      gazs0(i,13)=pzaz(i)*fazs0(i,08)-pzcz(i)*fazs1(i,08)+cz2(i,4)
     &                                                   +fs1(i,8)
      gazs0(i,14)=pzaz(i)*fazs0(i,09)-pzcz(i)*fazs1(i,09)+cz2(i,5)*two
     &                                                   +fs1(i,9)
 1030 gazs0(i,15)=pzaz(i)*fazs0(i,10)-pzcz(i)*fazs1(i,10)+cz2(i,6)*three
     &                                                   +fs1(i,10)

      do 1031 j=1,6
      do 1031 i=1,m
 1031 dscond(i,j)=zero

      do 1032 j=1,10
      do 1032 i=1,m
 1032 fscond(i,j)=zero

      do 1033 j=1,15
      do 1033 i=1,m
 1033 gscond(i,j)=zero

      do 1034 j=1,6
      do 1034 i=1,n
 1034 dscond(icontr(i),j)=dscond(icontr(i),j)+ds0(i,j)

      do 1035 j=1,10
      do 1035 i=1,n
 1035 fscond(icontr(i),j)=fscond(icontr(i),j)+fs0(i,j)

      do 1036 j=1,15
      do 1036 i=1,n
 1036 gscond(icontr(i),j)=gscond(icontr(i),j)+gs0(i,j)

      do 1037 i=1,m
      dpcond(i,01)=axbx(i)*dscond(i,1)+fscond(i,01)
      dpcond(i,02)=ayby(i)*dscond(i,1)+fscond(i,02)
      dpcond(i,03)=azbz(i)*dscond(i,1)+fscond(i,03)
      dpcond(i,04)=axbx(i)*dscond(i,2)+fscond(i,02)
      dpcond(i,05)=ayby(i)*dscond(i,2)+fscond(i,04)
      dpcond(i,06)=azbz(i)*dscond(i,2)+fscond(i,05)
      dpcond(i,07)=axbx(i)*dscond(i,3)+fscond(i,03)
      dpcond(i,08)=ayby(i)*dscond(i,3)+fscond(i,05)
      dpcond(i,09)=azbz(i)*dscond(i,3)+fscond(i,06)
      dpcond(i,10)=axbx(i)*dscond(i,4)+fscond(i,04)
      dpcond(i,11)=ayby(i)*dscond(i,4)+fscond(i,07)
      dpcond(i,12)=azbz(i)*dscond(i,4)+fscond(i,08)
      dpcond(i,13)=axbx(i)*dscond(i,5)+fscond(i,05)
      dpcond(i,14)=ayby(i)*dscond(i,5)+fscond(i,08)
      dpcond(i,15)=azbz(i)*dscond(i,5)+fscond(i,09)
      dpcond(i,16)=axbx(i)*dscond(i,6)+fscond(i,06)
      dpcond(i,17)=ayby(i)*dscond(i,6)+fscond(i,09)
 1037 dpcond(i,18)=azbz(i)*dscond(i,6)+fscond(i,10)

      do 1038 i=1,m
      fpcond(i,01)=axbx(i)*fscond(i,01)+gscond(i,01)
      fpcond(i,02)=ayby(i)*fscond(i,01)+gscond(i,02)
      fpcond(i,03)=azbz(i)*fscond(i,01)+gscond(i,03)
      fpcond(i,04)=axbx(i)*fscond(i,02)+gscond(i,02)
      fpcond(i,05)=ayby(i)*fscond(i,02)+gscond(i,04)
      fpcond(i,06)=azbz(i)*fscond(i,02)+gscond(i,05)
      fpcond(i,07)=axbx(i)*fscond(i,03)+gscond(i,03)
      fpcond(i,08)=ayby(i)*fscond(i,03)+gscond(i,05)
      fpcond(i,09)=azbz(i)*fscond(i,03)+gscond(i,06)
      fpcond(i,10)=axbx(i)*fscond(i,04)+gscond(i,04)
      fpcond(i,11)=ayby(i)*fscond(i,04)+gscond(i,07)
      fpcond(i,12)=azbz(i)*fscond(i,04)+gscond(i,08)
      fpcond(i,13)=axbx(i)*fscond(i,05)+gscond(i,05)
      fpcond(i,14)=ayby(i)*fscond(i,05)+gscond(i,08)
      fpcond(i,15)=azbz(i)*fscond(i,05)+gscond(i,09)
      fpcond(i,16)=axbx(i)*fscond(i,06)+gscond(i,06)
      fpcond(i,17)=ayby(i)*fscond(i,06)+gscond(i,09)
      fpcond(i,18)=azbz(i)*fscond(i,06)+gscond(i,10)
      fpcond(i,19)=axbx(i)*fscond(i,07)+gscond(i,07)
      fpcond(i,20)=ayby(i)*fscond(i,07)+gscond(i,11)
      fpcond(i,21)=azbz(i)*fscond(i,07)+gscond(i,12)
      fpcond(i,22)=axbx(i)*fscond(i,08)+gscond(i,08)
      fpcond(i,23)=ayby(i)*fscond(i,08)+gscond(i,12)
      fpcond(i,24)=azbz(i)*fscond(i,08)+gscond(i,13)
      fpcond(i,25)=axbx(i)*fscond(i,09)+gscond(i,09)
      fpcond(i,26)=ayby(i)*fscond(i,09)+gscond(i,13)
      fpcond(i,27)=azbz(i)*fscond(i,09)+gscond(i,14)
      fpcond(i,28)=axbx(i)*fscond(i,10)+gscond(i,10)
      fpcond(i,29)=ayby(i)*fscond(i,10)+gscond(i,14)
 1038 fpcond(i,30)=azbz(i)*fscond(i,10)+gscond(i,15)

      do 1039 i=1,m
      ddcond(i,01)=axbx(i)*dpcond(i,01)+fpcond(i,01)
      ddcond(i,02)=ayby(i)*dpcond(i,01)+fpcond(i,04)
      ddcond(i,03)=azbz(i)*dpcond(i,01)+fpcond(i,07)
      ddcond(i,04)=ayby(i)*dpcond(i,02)+fpcond(i,05)
      ddcond(i,05)=azbz(i)*dpcond(i,02)+fpcond(i,08)
      ddcond(i,06)=azbz(i)*dpcond(i,03)+fpcond(i,09)
      ddcond(i,07)=axbx(i)*dpcond(i,04)+fpcond(i,04)
      ddcond(i,08)=ayby(i)*dpcond(i,04)+fpcond(i,10)
      ddcond(i,09)=azbz(i)*dpcond(i,04)+fpcond(i,13)
      ddcond(i,10)=ayby(i)*dpcond(i,05)+fpcond(i,11)
      ddcond(i,11)=azbz(i)*dpcond(i,05)+fpcond(i,14)
      ddcond(i,12)=azbz(i)*dpcond(i,06)+fpcond(i,15)
      ddcond(i,13)=axbx(i)*dpcond(i,07)+fpcond(i,07)
      ddcond(i,14)=ayby(i)*dpcond(i,07)+fpcond(i,13)
      ddcond(i,15)=azbz(i)*dpcond(i,07)+fpcond(i,16)
      ddcond(i,16)=ayby(i)*dpcond(i,08)+fpcond(i,14)
      ddcond(i,17)=azbz(i)*dpcond(i,08)+fpcond(i,17)
      ddcond(i,18)=azbz(i)*dpcond(i,09)+fpcond(i,18)
      ddcond(i,19)=axbx(i)*dpcond(i,10)+fpcond(i,10)
      ddcond(i,20)=ayby(i)*dpcond(i,10)+fpcond(i,19)
      ddcond(i,21)=azbz(i)*dpcond(i,10)+fpcond(i,22)
      ddcond(i,22)=ayby(i)*dpcond(i,11)+fpcond(i,20)
      ddcond(i,23)=azbz(i)*dpcond(i,11)+fpcond(i,23)
      ddcond(i,24)=azbz(i)*dpcond(i,12)+fpcond(i,24)
      ddcond(i,25)=axbx(i)*dpcond(i,13)+fpcond(i,13)
      ddcond(i,26)=ayby(i)*dpcond(i,13)+fpcond(i,22)
      ddcond(i,27)=azbz(i)*dpcond(i,13)+fpcond(i,25)
      ddcond(i,28)=ayby(i)*dpcond(i,14)+fpcond(i,23)
      ddcond(i,29)=azbz(i)*dpcond(i,14)+fpcond(i,26)
      ddcond(i,30)=azbz(i)*dpcond(i,15)+fpcond(i,27)
      ddcond(i,31)=axbx(i)*dpcond(i,16)+fpcond(i,16)
      ddcond(i,32)=ayby(i)*dpcond(i,16)+fpcond(i,25)
      ddcond(i,33)=azbz(i)*dpcond(i,16)+fpcond(i,28)
      ddcond(i,34)=ayby(i)*dpcond(i,17)+fpcond(i,26)
      ddcond(i,35)=azbz(i)*dpcond(i,17)+fpcond(i,29)
 1039 ddcond(i,36)=azbz(i)*dpcond(i,18)+fpcond(i,30)

      do 1040 j=1,6
      do 1040 i=1,m
      daxscond(i,j)=zero
      dayscond(i,j)=zero
 1040 dazscond(i,j)=zero

      do 1041 j=1,10
      do 1041 i=1,m
      faxscond(i,j)=zero
      fayscond(i,j)=zero
 1041 fazscond(i,j)=zero

      do 1042 j=1,15
      do 1042 i=1,m
      gaxscond(i,j)=zero
      gayscond(i,j)=zero
 1042 gazscond(i,j)=zero

      do 1043 j=1,6
      do 1043 i=1,n
      daxscond(icontr(i),j)=daxscond(icontr(i),j)+daxs0(i,j)
      dayscond(icontr(i),j)=dayscond(icontr(i),j)+days0(i,j)
 1043 dazscond(icontr(i),j)=dazscond(icontr(i),j)+dazs0(i,j)

      do 1044 j=1,10
      do 1044 i=1,n
      faxscond(icontr(i),j)=faxscond(icontr(i),j)+faxs0(i,j)
      fayscond(icontr(i),j)=fayscond(icontr(i),j)+fays0(i,j)
 1044 fazscond(icontr(i),j)=fazscond(icontr(i),j)+fazs0(i,j)

      do 1045 j=1,15
      do 1045 i=1,n
      gaxscond(icontr(i),j)=gaxscond(icontr(i),j)+gaxs0(i,j)
      gayscond(icontr(i),j)=gayscond(icontr(i),j)+gays0(i,j)
 1045 gazscond(icontr(i),j)=gazscond(icontr(i),j)+gazs0(i,j)

      do 1046 i=1,m
      daxpcond(i,01)=axbx(i)*daxscond(i,1)+faxscond(i,01)
      daxpcond(i,02)=ayby(i)*daxscond(i,1)+faxscond(i,02)
      daxpcond(i,03)=azbz(i)*daxscond(i,1)+faxscond(i,03)
      daxpcond(i,04)=axbx(i)*daxscond(i,2)+faxscond(i,02)
      daxpcond(i,05)=ayby(i)*daxscond(i,2)+faxscond(i,04)
      daxpcond(i,06)=azbz(i)*daxscond(i,2)+faxscond(i,05)
      daxpcond(i,07)=axbx(i)*daxscond(i,3)+faxscond(i,03)
      daxpcond(i,08)=ayby(i)*daxscond(i,3)+faxscond(i,05)
      daxpcond(i,09)=azbz(i)*daxscond(i,3)+faxscond(i,06)
      daxpcond(i,10)=axbx(i)*daxscond(i,4)+faxscond(i,04)
      daxpcond(i,11)=ayby(i)*daxscond(i,4)+faxscond(i,07)
      daxpcond(i,12)=azbz(i)*daxscond(i,4)+faxscond(i,08)
      daxpcond(i,13)=axbx(i)*daxscond(i,5)+faxscond(i,05)
      daxpcond(i,14)=ayby(i)*daxscond(i,5)+faxscond(i,08)
      daxpcond(i,15)=azbz(i)*daxscond(i,5)+faxscond(i,09)
      daxpcond(i,16)=axbx(i)*daxscond(i,6)+faxscond(i,06)
      daxpcond(i,17)=ayby(i)*daxscond(i,6)+faxscond(i,09)
      daxpcond(i,18)=azbz(i)*daxscond(i,6)+faxscond(i,10)
      daypcond(i,01)=axbx(i)*dayscond(i,1)+fayscond(i,01)
      daypcond(i,02)=ayby(i)*dayscond(i,1)+fayscond(i,02)
      daypcond(i,03)=azbz(i)*dayscond(i,1)+fayscond(i,03)
      daypcond(i,04)=axbx(i)*dayscond(i,2)+fayscond(i,02)
      daypcond(i,05)=ayby(i)*dayscond(i,2)+fayscond(i,04)
      daypcond(i,06)=azbz(i)*dayscond(i,2)+fayscond(i,05)
      daypcond(i,07)=axbx(i)*dayscond(i,3)+fayscond(i,03)
      daypcond(i,08)=ayby(i)*dayscond(i,3)+fayscond(i,05)
      daypcond(i,09)=azbz(i)*dayscond(i,3)+fayscond(i,06)
      daypcond(i,10)=axbx(i)*dayscond(i,4)+fayscond(i,04)
      daypcond(i,11)=ayby(i)*dayscond(i,4)+fayscond(i,07)
      daypcond(i,12)=azbz(i)*dayscond(i,4)+fayscond(i,08)
      daypcond(i,13)=axbx(i)*dayscond(i,5)+fayscond(i,05)
      daypcond(i,14)=ayby(i)*dayscond(i,5)+fayscond(i,08)
      daypcond(i,15)=azbz(i)*dayscond(i,5)+fayscond(i,09)
      daypcond(i,16)=axbx(i)*dayscond(i,6)+fayscond(i,06)
      daypcond(i,17)=ayby(i)*dayscond(i,6)+fayscond(i,09)
      daypcond(i,18)=azbz(i)*dayscond(i,6)+fayscond(i,10)
      dazpcond(i,01)=axbx(i)*dazscond(i,1)+fazscond(i,01)
      dazpcond(i,02)=ayby(i)*dazscond(i,1)+fazscond(i,02)
      dazpcond(i,03)=azbz(i)*dazscond(i,1)+fazscond(i,03)
      dazpcond(i,04)=axbx(i)*dazscond(i,2)+fazscond(i,02)
      dazpcond(i,05)=ayby(i)*dazscond(i,2)+fazscond(i,04)
      dazpcond(i,06)=azbz(i)*dazscond(i,2)+fazscond(i,05)
      dazpcond(i,07)=axbx(i)*dazscond(i,3)+fazscond(i,03)
      dazpcond(i,08)=ayby(i)*dazscond(i,3)+fazscond(i,05)
      dazpcond(i,09)=azbz(i)*dazscond(i,3)+fazscond(i,06)
      dazpcond(i,10)=axbx(i)*dazscond(i,4)+fazscond(i,04)
      dazpcond(i,11)=ayby(i)*dazscond(i,4)+fazscond(i,07)
      dazpcond(i,12)=azbz(i)*dazscond(i,4)+fazscond(i,08)
      dazpcond(i,13)=axbx(i)*dazscond(i,5)+fazscond(i,05)
      dazpcond(i,14)=ayby(i)*dazscond(i,5)+fazscond(i,08)
      dazpcond(i,15)=azbz(i)*dazscond(i,5)+fazscond(i,09)
      dazpcond(i,16)=axbx(i)*dazscond(i,6)+fazscond(i,06)
      dazpcond(i,17)=ayby(i)*dazscond(i,6)+fazscond(i,09)
 1046 dazpcond(i,18)=azbz(i)*dazscond(i,6)+fazscond(i,10)

      do 1047 i=1,m
      faxpcond(i,01)=axbx(i)*faxscond(i,01)+gaxscond(i,01)
      faxpcond(i,02)=ayby(i)*faxscond(i,01)+gaxscond(i,02)
      faxpcond(i,03)=azbz(i)*faxscond(i,01)+gaxscond(i,03)
      faxpcond(i,04)=axbx(i)*faxscond(i,02)+gaxscond(i,02)
      faxpcond(i,05)=ayby(i)*faxscond(i,02)+gaxscond(i,04)
      faxpcond(i,06)=azbz(i)*faxscond(i,02)+gaxscond(i,05)
      faxpcond(i,07)=axbx(i)*faxscond(i,03)+gaxscond(i,03)
      faxpcond(i,08)=ayby(i)*faxscond(i,03)+gaxscond(i,05)
      faxpcond(i,09)=azbz(i)*faxscond(i,03)+gaxscond(i,06)
      faxpcond(i,10)=axbx(i)*faxscond(i,04)+gaxscond(i,04)
      faxpcond(i,11)=ayby(i)*faxscond(i,04)+gaxscond(i,07)
      faxpcond(i,12)=azbz(i)*faxscond(i,04)+gaxscond(i,08)
      faxpcond(i,13)=axbx(i)*faxscond(i,05)+gaxscond(i,05)
      faxpcond(i,14)=ayby(i)*faxscond(i,05)+gaxscond(i,08)
      faxpcond(i,15)=azbz(i)*faxscond(i,05)+gaxscond(i,09)
      faxpcond(i,16)=axbx(i)*faxscond(i,06)+gaxscond(i,06)
      faxpcond(i,17)=ayby(i)*faxscond(i,06)+gaxscond(i,09)
      faxpcond(i,18)=azbz(i)*faxscond(i,06)+gaxscond(i,10)
      faxpcond(i,19)=axbx(i)*faxscond(i,07)+gaxscond(i,07)
      faxpcond(i,20)=ayby(i)*faxscond(i,07)+gaxscond(i,11)
      faxpcond(i,21)=azbz(i)*faxscond(i,07)+gaxscond(i,12)
      faxpcond(i,22)=axbx(i)*faxscond(i,08)+gaxscond(i,08)
      faxpcond(i,23)=ayby(i)*faxscond(i,08)+gaxscond(i,12)
      faxpcond(i,24)=azbz(i)*faxscond(i,08)+gaxscond(i,13)
      faxpcond(i,25)=axbx(i)*faxscond(i,09)+gaxscond(i,09)
      faxpcond(i,26)=ayby(i)*faxscond(i,09)+gaxscond(i,13)
      faxpcond(i,27)=azbz(i)*faxscond(i,09)+gaxscond(i,14)
      faxpcond(i,28)=axbx(i)*faxscond(i,10)+gaxscond(i,10)
      faxpcond(i,29)=ayby(i)*faxscond(i,10)+gaxscond(i,14)
      faxpcond(i,30)=azbz(i)*faxscond(i,10)+gaxscond(i,15)
      faypcond(i,01)=axbx(i)*fayscond(i,01)+gayscond(i,01)
      faypcond(i,02)=ayby(i)*fayscond(i,01)+gayscond(i,02)
      faypcond(i,03)=azbz(i)*fayscond(i,01)+gayscond(i,03)
      faypcond(i,04)=axbx(i)*fayscond(i,02)+gayscond(i,02)
      faypcond(i,05)=ayby(i)*fayscond(i,02)+gayscond(i,04)
      faypcond(i,06)=azbz(i)*fayscond(i,02)+gayscond(i,05)
      faypcond(i,07)=axbx(i)*fayscond(i,03)+gayscond(i,03)
      faypcond(i,08)=ayby(i)*fayscond(i,03)+gayscond(i,05)
      faypcond(i,09)=azbz(i)*fayscond(i,03)+gayscond(i,06)
      faypcond(i,10)=axbx(i)*fayscond(i,04)+gayscond(i,04)
      faypcond(i,11)=ayby(i)*fayscond(i,04)+gayscond(i,07)
      faypcond(i,12)=azbz(i)*fayscond(i,04)+gayscond(i,08)
      faypcond(i,13)=axbx(i)*fayscond(i,05)+gayscond(i,05)
      faypcond(i,14)=ayby(i)*fayscond(i,05)+gayscond(i,08)
      faypcond(i,15)=azbz(i)*fayscond(i,05)+gayscond(i,09)
      faypcond(i,16)=axbx(i)*fayscond(i,06)+gayscond(i,06)
      faypcond(i,17)=ayby(i)*fayscond(i,06)+gayscond(i,09)
      faypcond(i,18)=azbz(i)*fayscond(i,06)+gayscond(i,10)
      faypcond(i,19)=axbx(i)*fayscond(i,07)+gayscond(i,07)
      faypcond(i,20)=ayby(i)*fayscond(i,07)+gayscond(i,11)
      faypcond(i,21)=azbz(i)*fayscond(i,07)+gayscond(i,12)
      faypcond(i,22)=axbx(i)*fayscond(i,08)+gayscond(i,08)
      faypcond(i,23)=ayby(i)*fayscond(i,08)+gayscond(i,12)
      faypcond(i,24)=azbz(i)*fayscond(i,08)+gayscond(i,13)
      faypcond(i,25)=axbx(i)*fayscond(i,09)+gayscond(i,09)
      faypcond(i,26)=ayby(i)*fayscond(i,09)+gayscond(i,13)
      faypcond(i,27)=azbz(i)*fayscond(i,09)+gayscond(i,14)
      faypcond(i,28)=axbx(i)*fayscond(i,10)+gayscond(i,10)
      faypcond(i,29)=ayby(i)*fayscond(i,10)+gayscond(i,14)
      faypcond(i,30)=azbz(i)*fayscond(i,10)+gayscond(i,15)
      fazpcond(i,01)=axbx(i)*fazscond(i,01)+gazscond(i,01)
      fazpcond(i,02)=ayby(i)*fazscond(i,01)+gazscond(i,02)
      fazpcond(i,03)=azbz(i)*fazscond(i,01)+gazscond(i,03)
      fazpcond(i,04)=axbx(i)*fazscond(i,02)+gazscond(i,02)
      fazpcond(i,05)=ayby(i)*fazscond(i,02)+gazscond(i,04)
      fazpcond(i,06)=azbz(i)*fazscond(i,02)+gazscond(i,05)
      fazpcond(i,07)=axbx(i)*fazscond(i,03)+gazscond(i,03)
      fazpcond(i,08)=ayby(i)*fazscond(i,03)+gazscond(i,05)
      fazpcond(i,09)=azbz(i)*fazscond(i,03)+gazscond(i,06)
      fazpcond(i,10)=axbx(i)*fazscond(i,04)+gazscond(i,04)
      fazpcond(i,11)=ayby(i)*fazscond(i,04)+gazscond(i,07)
      fazpcond(i,12)=azbz(i)*fazscond(i,04)+gazscond(i,08)
      fazpcond(i,13)=axbx(i)*fazscond(i,05)+gazscond(i,05)
      fazpcond(i,14)=ayby(i)*fazscond(i,05)+gazscond(i,08)
      fazpcond(i,15)=azbz(i)*fazscond(i,05)+gazscond(i,09)
      fazpcond(i,16)=axbx(i)*fazscond(i,06)+gazscond(i,06)
      fazpcond(i,17)=ayby(i)*fazscond(i,06)+gazscond(i,09)
      fazpcond(i,18)=azbz(i)*fazscond(i,06)+gazscond(i,10)
      fazpcond(i,19)=axbx(i)*fazscond(i,07)+gazscond(i,07)
      fazpcond(i,20)=ayby(i)*fazscond(i,07)+gazscond(i,11)
      fazpcond(i,21)=azbz(i)*fazscond(i,07)+gazscond(i,12)
      fazpcond(i,22)=axbx(i)*fazscond(i,08)+gazscond(i,08)
      fazpcond(i,23)=ayby(i)*fazscond(i,08)+gazscond(i,12)
      fazpcond(i,24)=azbz(i)*fazscond(i,08)+gazscond(i,13)
      fazpcond(i,25)=axbx(i)*fazscond(i,09)+gazscond(i,09)
      fazpcond(i,26)=ayby(i)*fazscond(i,09)+gazscond(i,13)
      fazpcond(i,27)=azbz(i)*fazscond(i,09)+gazscond(i,14)
      fazpcond(i,28)=axbx(i)*fazscond(i,10)+gazscond(i,10)
      fazpcond(i,29)=ayby(i)*fazscond(i,10)+gazscond(i,14)
 1047 fazpcond(i,30)=azbz(i)*fazscond(i,10)+gazscond(i,15)

      do 1048 i=1,m
      daxdcond(i,01)=axbx(i)*daxpcond(i,01)+faxpcond(i,01)
      daxdcond(i,02)=ayby(i)*daxpcond(i,01)+faxpcond(i,04)
      daxdcond(i,03)=azbz(i)*daxpcond(i,01)+faxpcond(i,07)
      daxdcond(i,04)=ayby(i)*daxpcond(i,02)+faxpcond(i,05)
      daxdcond(i,05)=azbz(i)*daxpcond(i,02)+faxpcond(i,08)
      daxdcond(i,06)=azbz(i)*daxpcond(i,03)+faxpcond(i,09)
      daxdcond(i,07)=axbx(i)*daxpcond(i,04)+faxpcond(i,04)
      daxdcond(i,08)=ayby(i)*daxpcond(i,04)+faxpcond(i,10)
      daxdcond(i,09)=azbz(i)*daxpcond(i,04)+faxpcond(i,13)
      daxdcond(i,10)=ayby(i)*daxpcond(i,05)+faxpcond(i,11)
      daxdcond(i,11)=azbz(i)*daxpcond(i,05)+faxpcond(i,14)
      daxdcond(i,12)=azbz(i)*daxpcond(i,06)+faxpcond(i,15)
      daxdcond(i,13)=axbx(i)*daxpcond(i,07)+faxpcond(i,07)
      daxdcond(i,14)=ayby(i)*daxpcond(i,07)+faxpcond(i,13)
      daxdcond(i,15)=azbz(i)*daxpcond(i,07)+faxpcond(i,16)
      daxdcond(i,16)=ayby(i)*daxpcond(i,08)+faxpcond(i,14)
      daxdcond(i,17)=azbz(i)*daxpcond(i,08)+faxpcond(i,17)
      daxdcond(i,18)=azbz(i)*daxpcond(i,09)+faxpcond(i,18)
      daxdcond(i,19)=axbx(i)*daxpcond(i,10)+faxpcond(i,10)
      daxdcond(i,20)=ayby(i)*daxpcond(i,10)+faxpcond(i,19)
      daxdcond(i,21)=azbz(i)*daxpcond(i,10)+faxpcond(i,22)
      daxdcond(i,22)=ayby(i)*daxpcond(i,11)+faxpcond(i,20)
      daxdcond(i,23)=azbz(i)*daxpcond(i,11)+faxpcond(i,23)
      daxdcond(i,24)=azbz(i)*daxpcond(i,12)+faxpcond(i,24)
      daxdcond(i,25)=axbx(i)*daxpcond(i,13)+faxpcond(i,13)
      daxdcond(i,26)=ayby(i)*daxpcond(i,13)+faxpcond(i,22)
      daxdcond(i,27)=azbz(i)*daxpcond(i,13)+faxpcond(i,25)
      daxdcond(i,28)=ayby(i)*daxpcond(i,14)+faxpcond(i,23)
      daxdcond(i,29)=azbz(i)*daxpcond(i,14)+faxpcond(i,26)
      daxdcond(i,30)=azbz(i)*daxpcond(i,15)+faxpcond(i,27)
      daxdcond(i,31)=axbx(i)*daxpcond(i,16)+faxpcond(i,16)
      daxdcond(i,32)=ayby(i)*daxpcond(i,16)+faxpcond(i,25)
      daxdcond(i,33)=azbz(i)*daxpcond(i,16)+faxpcond(i,28)
      daxdcond(i,34)=ayby(i)*daxpcond(i,17)+faxpcond(i,26)
      daxdcond(i,35)=azbz(i)*daxpcond(i,17)+faxpcond(i,29)
      daxdcond(i,36)=azbz(i)*daxpcond(i,18)+faxpcond(i,30)
      daydcond(i,01)=axbx(i)*daypcond(i,01)+faypcond(i,01)
      daydcond(i,02)=ayby(i)*daypcond(i,01)+faypcond(i,04)
      daydcond(i,03)=azbz(i)*daypcond(i,01)+faypcond(i,07)
      daydcond(i,04)=ayby(i)*daypcond(i,02)+faypcond(i,05)
      daydcond(i,05)=azbz(i)*daypcond(i,02)+faypcond(i,08)
      daydcond(i,06)=azbz(i)*daypcond(i,03)+faypcond(i,09)
      daydcond(i,07)=axbx(i)*daypcond(i,04)+faypcond(i,04)
      daydcond(i,08)=ayby(i)*daypcond(i,04)+faypcond(i,10)
      daydcond(i,09)=azbz(i)*daypcond(i,04)+faypcond(i,13)
      daydcond(i,10)=ayby(i)*daypcond(i,05)+faypcond(i,11)
      daydcond(i,11)=azbz(i)*daypcond(i,05)+faypcond(i,14)
      daydcond(i,12)=azbz(i)*daypcond(i,06)+faypcond(i,15)
      daydcond(i,13)=axbx(i)*daypcond(i,07)+faypcond(i,07)
      daydcond(i,14)=ayby(i)*daypcond(i,07)+faypcond(i,13)
      daydcond(i,15)=azbz(i)*daypcond(i,07)+faypcond(i,16)
      daydcond(i,16)=ayby(i)*daypcond(i,08)+faypcond(i,14)
      daydcond(i,17)=azbz(i)*daypcond(i,08)+faypcond(i,17)
      daydcond(i,18)=azbz(i)*daypcond(i,09)+faypcond(i,18)
      daydcond(i,19)=axbx(i)*daypcond(i,10)+faypcond(i,10)
      daydcond(i,20)=ayby(i)*daypcond(i,10)+faypcond(i,19)
      daydcond(i,21)=azbz(i)*daypcond(i,10)+faypcond(i,22)
      daydcond(i,22)=ayby(i)*daypcond(i,11)+faypcond(i,20)
      daydcond(i,23)=azbz(i)*daypcond(i,11)+faypcond(i,23)
      daydcond(i,24)=azbz(i)*daypcond(i,12)+faypcond(i,24)
      daydcond(i,25)=axbx(i)*daypcond(i,13)+faypcond(i,13)
      daydcond(i,26)=ayby(i)*daypcond(i,13)+faypcond(i,22)
      daydcond(i,27)=azbz(i)*daypcond(i,13)+faypcond(i,25)
      daydcond(i,28)=ayby(i)*daypcond(i,14)+faypcond(i,23)
      daydcond(i,29)=azbz(i)*daypcond(i,14)+faypcond(i,26)
      daydcond(i,30)=azbz(i)*daypcond(i,15)+faypcond(i,27)
      daydcond(i,31)=axbx(i)*daypcond(i,16)+faypcond(i,16)
      daydcond(i,32)=ayby(i)*daypcond(i,16)+faypcond(i,25)
      daydcond(i,33)=azbz(i)*daypcond(i,16)+faypcond(i,28)
      daydcond(i,34)=ayby(i)*daypcond(i,17)+faypcond(i,26)
      daydcond(i,35)=azbz(i)*daypcond(i,17)+faypcond(i,29)
      daydcond(i,36)=azbz(i)*daypcond(i,18)+faypcond(i,30)
      dazdcond(i,01)=axbx(i)*dazpcond(i,01)+fazpcond(i,01)
      dazdcond(i,02)=ayby(i)*dazpcond(i,01)+fazpcond(i,04)
      dazdcond(i,03)=azbz(i)*dazpcond(i,01)+fazpcond(i,07)
      dazdcond(i,04)=ayby(i)*dazpcond(i,02)+fazpcond(i,05)
      dazdcond(i,05)=azbz(i)*dazpcond(i,02)+fazpcond(i,08)
      dazdcond(i,06)=azbz(i)*dazpcond(i,03)+fazpcond(i,09)
      dazdcond(i,07)=axbx(i)*dazpcond(i,04)+fazpcond(i,04)
      dazdcond(i,08)=ayby(i)*dazpcond(i,04)+fazpcond(i,10)
      dazdcond(i,09)=azbz(i)*dazpcond(i,04)+fazpcond(i,13)
      dazdcond(i,10)=ayby(i)*dazpcond(i,05)+fazpcond(i,11)
      dazdcond(i,11)=azbz(i)*dazpcond(i,05)+fazpcond(i,14)
      dazdcond(i,12)=azbz(i)*dazpcond(i,06)+fazpcond(i,15)
      dazdcond(i,13)=axbx(i)*dazpcond(i,07)+fazpcond(i,07)
      dazdcond(i,14)=ayby(i)*dazpcond(i,07)+fazpcond(i,13)
      dazdcond(i,15)=azbz(i)*dazpcond(i,07)+fazpcond(i,16)
      dazdcond(i,16)=ayby(i)*dazpcond(i,08)+fazpcond(i,14)
      dazdcond(i,17)=azbz(i)*dazpcond(i,08)+fazpcond(i,17)
      dazdcond(i,18)=azbz(i)*dazpcond(i,09)+fazpcond(i,18)
      dazdcond(i,19)=axbx(i)*dazpcond(i,10)+fazpcond(i,10)
      dazdcond(i,20)=ayby(i)*dazpcond(i,10)+fazpcond(i,19)
      dazdcond(i,21)=azbz(i)*dazpcond(i,10)+fazpcond(i,22)
      dazdcond(i,22)=ayby(i)*dazpcond(i,11)+fazpcond(i,20)
      dazdcond(i,23)=azbz(i)*dazpcond(i,11)+fazpcond(i,23)
      dazdcond(i,24)=azbz(i)*dazpcond(i,12)+fazpcond(i,24)
      dazdcond(i,25)=axbx(i)*dazpcond(i,13)+fazpcond(i,13)
      dazdcond(i,26)=ayby(i)*dazpcond(i,13)+fazpcond(i,22)
      dazdcond(i,27)=azbz(i)*dazpcond(i,13)+fazpcond(i,25)
      dazdcond(i,28)=ayby(i)*dazpcond(i,14)+fazpcond(i,23)
      dazdcond(i,29)=azbz(i)*dazpcond(i,14)+fazpcond(i,26)
      dazdcond(i,30)=azbz(i)*dazpcond(i,15)+fazpcond(i,27)
      dazdcond(i,31)=axbx(i)*dazpcond(i,16)+fazpcond(i,16)
      dazdcond(i,32)=ayby(i)*dazpcond(i,16)+fazpcond(i,25)
      dazdcond(i,33)=azbz(i)*dazpcond(i,16)+fazpcond(i,28)
      dazdcond(i,34)=ayby(i)*dazpcond(i,17)+fazpcond(i,26)
      dazdcond(i,35)=azbz(i)*dazpcond(i,17)+fazpcond(i,29)
 1048 dazdcond(i,36)=azbz(i)*dazpcond(i,18)+fazpcond(i,30)

      do 1049 i=1,m
 1049 esp=esp-density(inddyy(i,01))*ddcond(i,01)
     &       -density(inddyy(i,07))*ddcond(i,07)
     &       -density(inddyy(i,08))*ddcond(i,08)
     &       -density(inddyy(i,13))*ddcond(i,13)
     &       -density(inddyy(i,14))*ddcond(i,14)
     &       -density(inddyy(i,15))*ddcond(i,15)
     &       -density(inddyy(i,19))*ddcond(i,19)
     &       -density(inddyy(i,20))*ddcond(i,20)
     &       -density(inddyy(i,21))*ddcond(i,21)
     &       -density(inddyy(i,22))*ddcond(i,22)
     &       -density(inddyy(i,25))*ddcond(i,25)
     &       -density(inddyy(i,26))*ddcond(i,26)
     &       -density(inddyy(i,27))*ddcond(i,27)
     &       -density(inddyy(i,28))*ddcond(i,28)
     &       -density(inddyy(i,29))*ddcond(i,29)
     &       -density(inddyy(i,31))*ddcond(i,31)
     &       -density(inddyy(i,32))*ddcond(i,32)
     &       -density(inddyy(i,33))*ddcond(i,33)
     &       -density(inddyy(i,34))*ddcond(i,34)
     &       -density(inddyy(i,35))*ddcond(i,35)
     &       -density(inddyy(i,36))*ddcond(i,36)

      do 1050 i=1,m
      if(iminj(i).ne.0) then

                esp=esp-density(inddyy(i,02))*ddcond(i,02)
     &                 -density(inddyy(i,03))*ddcond(i,03)
     &                 -density(inddyy(i,04))*ddcond(i,04)
     &                 -density(inddyy(i,05))*ddcond(i,05)
     &                 -density(inddyy(i,06))*ddcond(i,06)
     &                 -density(inddyy(i,09))*ddcond(i,09)
     &                 -density(inddyy(i,10))*ddcond(i,10)
     &                 -density(inddyy(i,11))*ddcond(i,11)
     &                 -density(inddyy(i,12))*ddcond(i,12)
     &                 -density(inddyy(i,16))*ddcond(i,16)
     &                 -density(inddyy(i,17))*ddcond(i,17)
     &                 -density(inddyy(i,18))*ddcond(i,18)
     &                 -density(inddyy(i,23))*ddcond(i,23)
     &                 -density(inddyy(i,24))*ddcond(i,24)
     &                 -density(inddyy(i,30))*ddcond(i,30)

                        endif
 1050 continue

      do 1051 i=1,m
      efix=efix-density(inddyy(i,01))*daxdcond(i,01)
     &         -density(inddyy(i,07))*daxdcond(i,07)
     &         -density(inddyy(i,08))*daxdcond(i,08)
     &         -density(inddyy(i,13))*daxdcond(i,13)
     &         -density(inddyy(i,14))*daxdcond(i,14)
     &         -density(inddyy(i,15))*daxdcond(i,15)
     &         -density(inddyy(i,19))*daxdcond(i,19)
     &         -density(inddyy(i,20))*daxdcond(i,20)
     &         -density(inddyy(i,21))*daxdcond(i,21)
     &         -density(inddyy(i,22))*daxdcond(i,22)
     &         -density(inddyy(i,25))*daxdcond(i,25)
     &         -density(inddyy(i,26))*daxdcond(i,26)
     &         -density(inddyy(i,27))*daxdcond(i,27)
     &         -density(inddyy(i,28))*daxdcond(i,28)
     &         -density(inddyy(i,29))*daxdcond(i,29)
     &         -density(inddyy(i,31))*daxdcond(i,31)
     &         -density(inddyy(i,32))*daxdcond(i,32)
     &         -density(inddyy(i,33))*daxdcond(i,33)
     &         -density(inddyy(i,34))*daxdcond(i,34)
     &         -density(inddyy(i,35))*daxdcond(i,35)
     &         -density(inddyy(i,36))*daxdcond(i,36)
      efiy=efiy-density(inddyy(i,01))*daydcond(i,01)
     &         -density(inddyy(i,07))*daydcond(i,07)
     &         -density(inddyy(i,08))*daydcond(i,08)
     &         -density(inddyy(i,13))*daydcond(i,13)
     &         -density(inddyy(i,14))*daydcond(i,14)
     &         -density(inddyy(i,15))*daydcond(i,15)
     &         -density(inddyy(i,19))*daydcond(i,19)
     &         -density(inddyy(i,20))*daydcond(i,20)
     &         -density(inddyy(i,21))*daydcond(i,21)
     &         -density(inddyy(i,22))*daydcond(i,22)
     &         -density(inddyy(i,25))*daydcond(i,25)
     &         -density(inddyy(i,26))*daydcond(i,26)
     &         -density(inddyy(i,27))*daydcond(i,27)
     &         -density(inddyy(i,28))*daydcond(i,28)
     &         -density(inddyy(i,29))*daydcond(i,29)
     &         -density(inddyy(i,31))*daydcond(i,31)
     &         -density(inddyy(i,32))*daydcond(i,32)
     &         -density(inddyy(i,33))*daydcond(i,33)
     &         -density(inddyy(i,34))*daydcond(i,34)
     &         -density(inddyy(i,35))*daydcond(i,35)
     &         -density(inddyy(i,36))*daydcond(i,36)
 1051 efiz=efiz-density(inddyy(i,01))*dazdcond(i,01)
     &         -density(inddyy(i,07))*dazdcond(i,07)
     &         -density(inddyy(i,08))*dazdcond(i,08)
     &         -density(inddyy(i,13))*dazdcond(i,13)
     &         -density(inddyy(i,14))*dazdcond(i,14)
     &         -density(inddyy(i,15))*dazdcond(i,15)
     &         -density(inddyy(i,19))*dazdcond(i,19)
     &         -density(inddyy(i,20))*dazdcond(i,20)
     &         -density(inddyy(i,21))*dazdcond(i,21)
     &         -density(inddyy(i,22))*dazdcond(i,22)
     &         -density(inddyy(i,25))*dazdcond(i,25)
     &         -density(inddyy(i,26))*dazdcond(i,26)
     &         -density(inddyy(i,27))*dazdcond(i,27)
     &         -density(inddyy(i,28))*dazdcond(i,28)
     &         -density(inddyy(i,29))*dazdcond(i,29)
     &         -density(inddyy(i,31))*dazdcond(i,31)
     &         -density(inddyy(i,32))*dazdcond(i,32)
     &         -density(inddyy(i,33))*dazdcond(i,33)
     &         -density(inddyy(i,34))*dazdcond(i,34)
     &         -density(inddyy(i,35))*dazdcond(i,35)
     &         -density(inddyy(i,36))*dazdcond(i,36)

      do 1052 i=1,m
      if(iminj(i).ne.0) then

              efix=efix-density(inddyy(i,02))*daxdcond(i,02)
     &                 -density(inddyy(i,03))*daxdcond(i,03)
     &                 -density(inddyy(i,04))*daxdcond(i,04)
     &                 -density(inddyy(i,05))*daxdcond(i,05)
     &                 -density(inddyy(i,06))*daxdcond(i,06)
     &                 -density(inddyy(i,09))*daxdcond(i,09)
     &                 -density(inddyy(i,10))*daxdcond(i,10)
     &                 -density(inddyy(i,11))*daxdcond(i,11)
     &                 -density(inddyy(i,12))*daxdcond(i,12)
     &                 -density(inddyy(i,16))*daxdcond(i,16)
     &                 -density(inddyy(i,17))*daxdcond(i,17)
     &                 -density(inddyy(i,18))*daxdcond(i,18)
     &                 -density(inddyy(i,23))*daxdcond(i,23)
     &                 -density(inddyy(i,24))*daxdcond(i,24)
     &                 -density(inddyy(i,30))*daxdcond(i,30)

              efiy=efiy-density(inddyy(i,02))*daydcond(i,02)
     &                 -density(inddyy(i,03))*daydcond(i,03)
     &                 -density(inddyy(i,04))*daydcond(i,04)
     &                 -density(inddyy(i,05))*daydcond(i,05)
     &                 -density(inddyy(i,06))*daydcond(i,06)
     &                 -density(inddyy(i,09))*daydcond(i,09)
     &                 -density(inddyy(i,10))*daydcond(i,10)
     &                 -density(inddyy(i,11))*daydcond(i,11)
     &                 -density(inddyy(i,12))*daydcond(i,12)
     &                 -density(inddyy(i,16))*daydcond(i,16)
     &                 -density(inddyy(i,17))*daydcond(i,17)
     &                 -density(inddyy(i,18))*daydcond(i,18)
     &                 -density(inddyy(i,23))*daydcond(i,23)
     &                 -density(inddyy(i,24))*daydcond(i,24)
     &                 -density(inddyy(i,30))*daydcond(i,30)

              efiz=efiz-density(inddyy(i,02))*dazdcond(i,02)
     &                 -density(inddyy(i,03))*dazdcond(i,03)
     &                 -density(inddyy(i,04))*dazdcond(i,04)
     &                 -density(inddyy(i,05))*dazdcond(i,05)
     &                 -density(inddyy(i,06))*dazdcond(i,06)
     &                 -density(inddyy(i,09))*dazdcond(i,09)
     &                 -density(inddyy(i,10))*dazdcond(i,10)
     &                 -density(inddyy(i,11))*dazdcond(i,11)
     &                 -density(inddyy(i,12))*dazdcond(i,12)
     &                 -density(inddyy(i,16))*dazdcond(i,16)
     &                 -density(inddyy(i,17))*dazdcond(i,17)
     &                 -density(inddyy(i,18))*dazdcond(i,18)
     &                 -density(inddyy(i,23))*dazdcond(i,23)
     &                 -density(inddyy(i,24))*dazdcond(i,24)
     &                 -density(inddyy(i,30))*dazdcond(i,30)

                        endif
 1052 continue
  
      return 
      end 
