+ cref(j,i,cou)=c(j,i)
+ cref(j,i+nres,cou)=c(j,i+nres)
+ if (i.le.nres) then
+ chain_rep(j,lll,kkk)=c(j,i)
+ chain_rep(j,lll+nres,kkk)=c(j,i+nres)
+ endif
+ enddo
+ enddo
+ do j=1,3
+ chain_rep(j,chain_length,symetr)=chain_rep(j,chain_length,1)
+ chain_rep(j,chain_length+nres,symetr)
+ &=chain_rep(j,chain_length+nres,1)
+ enddo
+
+ if (symetr.gt.1) then
+ call permut(symetr)
+ nperm=1
+ do i=1,symetr
+ nperm=nperm*i
+ enddo
+c do i=1,nperm
+c write(iout,*) "tabperm", (tabperm(i,kkk),kkk=1,4)
+c enddo
+ do i=1,nperm
+ cou=0
+ do kkk=1,symetr
+ icha=tabperm(i,kkk)
+c write (iout,*) i,icha
+ do lll=1,chain_length
+ cou=cou+1
+ if (cou.le.nres) then
+ do j=1,3
+ kupa=mod(lll,chain_length)
+ iprzes=(kkk-1)*chain_length+lll
+ if (kupa.eq.0) kupa=chain_length
+c write (iout,*) "kupa", kupa
+ cref(j,iprzes,i)=chain_rep(j,kupa,icha)
+ cref(j,iprzes+nres,i)=chain_rep(j,kupa+nres,icha)
+ enddo
+ endif
+ enddo