      integer function istoic(is,nla,nd,ix) ! Bernd Berg Oct 17 2007. 
C Calculates ic = 1, 2 (checkerboard number) from is (position label).
C is, nla, nd input; ix, istoic calculated.
      dimension nla(nd),ix(nd) 
      call ixcor(ix,nla,is,nd)
      ix_sum=0
      do id=1,nd
        ix_sum=ix_sum+ix(id)
      end do
      istoic=1+mod(ix_sum,2)
      return
      end
