subroutine permut(isym,nperm,tabperm) c integer maxperm,maxsym c parameter (maxperm=3628800) c parameter (maxsym=10) include "DIMENSIONS" integer n,a,tabperm logical nextp external nextp dimension a(isym),tabperm(maxchain,maxperm) n=isym nperm=1 if (n.eq.1) then tabperm(1,1)=1 return endif do i=2,n nperm=nperm*i enddo kkk=0 do i=1,n a(i)=i enddo 10 continue c print '(i3,2x,100i3)',kkk+1,(a(i),i=1,n) kkk=kkk+1 do i=1,n tabperm(i,kkk)=a(i) enddo if(nextp(n,a)) go to 10 return end function nextp(n,a) integer n,a,i,j,k,t logical nextp dimension a(n) i=n-1 10 if(a(i).lt.a(i+1)) go to 20 i=i-1 if(i.eq.0) go to 20 go to 10 20 j=i+1 k=n 30 t=a(j) a(j)=a(k) a(k)=t j=j+1 k=k-1 if(j.lt.k) go to 30 j=i if(j.ne.0) go to 40 nextp=.false. return 40 j=j+1 if(a(j).lt.a(i)) go to 40 t=a(i) a(i)=a(j) a(j)=t nextp=.true. return end