**************************************************************************
C                        SSFOBSV_GRSOL.F
C Calculate the static structure factor of an active layer of helium
C adsorbed onto graphite plated with at frozen layer of helium.
C The incident wave vector is in the (10) direction.
**************************************************************************
      subroutine ssfobsv(x,y,z,ssfx,ssfy)
      include 'pimc_sqr3sc.dcl'
      dimension x(2*m,nat),y(2*m,nat),z(2*m,nat)
      dimension ssfx(nssfx),ssfy(nssfy)
      
      pi=4.*atan(1.)
      qx=2.*pi/xdim
      qy=2.*pi/ydim
      
      do issf=1,nssfx
         do islice=1,m
            do i=1,nat
               do j=i+1,nat
                  call dstpbc(x(islice,i),x(islice,j),xdim,dist,sgn)
                  xdiff=sgn*dist
                  ssfx(issf)=ssfx(issf)+2.*cos(qx*issf*xdiff)
               end do
            end do
         end do
      end do

      do issf=1,nssfy
         do islice=1,m
            do i=1,nat
               do j=i+1,nat
                  call dstpbc(y(islice,i),y(islice,j),ydim,dist,sgn)
                  ydiff=dist*sgn
                  ssfy(issf)=ssfy(issf)+2.*cos(qy*issf*ydiff)
               end do
            end do
         end do
      end do
      return
      end
