include 'COMMON.IOUNITS'
include 'COMMON.HEADER'
include 'COMMON.SBRIDGE'
-c include 'COMMON.DISTFIT'
+ include 'COMMON.DISTFIT'
c include 'COMMON.MD'
character*50 tytul
dimension ica(maxres)
write (iunit,'(3a,1pe15.5)') 'REMARK ',tytul,' ENERGY ',etot
+#ifdef SECONDARY
cmodel write (iunit,'(a5,i6)') 'MODEL',1
-c if (nhfrag.gt.0) then
-c do j=1,nhfrag
-c iti=itype(hfrag(1,j))
-c itj=itype(hfrag(2,j))
-c if (j.lt.10) then
-c write (iunit,'(a5,i5,1x,a1,i1,2x,a3,i7,2x,a3,i7,i3,t76,i5)')
-c & 'HELIX',j,'H',j,
-c & restyp(iti),hfrag(1,j)-1,
-c & restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
-c else
-c write (iunit,'(a5,i5,1x,a1,i2,1x,a3,i7,2x,a3,i7,i3)')
-c & 'HELIX',j,'H',j,
-c & restyp(iti),hfrag(1,j)-1,
-c & restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
-c endif
-c enddo
-c endif
+ if (nhfrag.gt.0) then
+ do j=1,nhfrag
+ iti=itype(hfrag(1,j))
+ itj=itype(hfrag(2,j))
+ if (j.lt.10) then
+ write (iunit,'(a5,i5,1x,a1,i1,2x,a3,i7,2x,a3,i7,i3,t76,i5)')
+ & 'HELIX',j,'H',j,
+ & restyp(iti),hfrag(1,j)-1,
+ & restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
+ else
+ write (iunit,'(a5,i5,1x,a1,i2,1x,a3,i7,2x,a3,i7,i3)')
+ & 'HELIX',j,'H',j,
+ & restyp(iti),hfrag(1,j)-1,
+ & restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
+ endif
+ enddo
+ endif
+
+ if (nbfrag.gt.0) then
+
+ do j=1,nbfrag
+
+ iti=itype(bfrag(1,j))
+ itj=itype(bfrag(2,j)-1)
+
+ write (iunit,'(a5,i5,1x,a1,i1,i3,1x,a3,i6,2x,a3,i6,i3)')
+ & 'SHEET',1,'B',j,2,
+ & restyp(iti),bfrag(1,j)-1,
+ & restyp(itj),bfrag(2,j)-2,0
+
+ if (bfrag(3,j).gt.bfrag(4,j)) then
+
+ itk=itype(bfrag(3,j))
+ itl=itype(bfrag(4,j)+1)
-c if (nbfrag.gt.0) then
-c
-c do j=1,nbfrag
-c
-c iti=itype(bfrag(1,j))
-c itj=itype(bfrag(2,j)-1)
-c
-c write (iunit,'(a5,i5,1x,a1,i1,i3,1x,a3,i6,2x,a3,i6,i3)')
-c & 'SHEET',1,'B',j,2,
-c & restyp(iti),bfrag(1,j)-1,
-c & restyp(itj),bfrag(2,j)-2,0
-c
-c if (bfrag(3,j).gt.bfrag(4,j)) then
-c
-c itk=itype(bfrag(3,j))
-c itl=itype(bfrag(4,j)+1)
-c
-c write (iunit,'(a5,i5,1x,a1,i1,i3,1x,a3,i6,2x,a3,i6,i3,
-c & 2x,a1,2x,a3,i6,3x,a1,2x,a3,i6)')
-c & 'SHEET',2,'B',j,2,
-c & restyp(itl),bfrag(4,j),
-c & restyp(itk),bfrag(3,j)-1,-1,
-c & "N",restyp(itk),bfrag(3,j)-1,
-c & "O",restyp(iti),bfrag(1,j)-1
-c
-c else
-c
-c itk=itype(bfrag(3,j))
-c itl=itype(bfrag(4,j)-1)
-c
-c
-c write (iunit,'(a5,i5,1x,a1,i1,i3,1x,a3,i6,2x,a3,i6,i3,
-c & 2x,a1,2x,a3,i6,3x,a1,2x,a3,i6)')
-c & 'SHEET',2,'B',j,2,
-c & restyp(itk),bfrag(3,j)-1,
-c & restyp(itl),bfrag(4,j)-2,1,
-c & "N",restyp(itk),bfrag(3,j)-1,
-c & "O",restyp(iti),bfrag(1,j)-1
-c
-c
-c
-c endif
-c
-c enddo
-c endif
+ write (iunit,'(a5,i5,1x,a1,i1,i3,1x,a3,i6,2x,a3,i6,i3,
+ & 2x,a1,2x,a3,i6,3x,a1,2x,a3,i6)')
+ & 'SHEET',2,'B',j,2,
+ & restyp(itl),bfrag(4,j),
+ & restyp(itk),bfrag(3,j)-1,-1,
+ & "N",restyp(itk),bfrag(3,j)-1,
+ & "O",restyp(iti),bfrag(1,j)-1
+ else
+
+ itk=itype(bfrag(3,j))
+ itl=itype(bfrag(4,j)-1)
+
+
+ write (iunit,'(a5,i5,1x,a1,i1,i3,1x,a3,i6,2x,a3,i6,i3,
+ & 2x,a1,2x,a3,i6,3x,a1,2x,a3,i6)')
+ & 'SHEET',2,'B',j,2,
+ & restyp(itk),bfrag(3,j)-1,
+ & restyp(itl),bfrag(4,j)-2,1,
+ & "N",restyp(itk),bfrag(3,j)-1,
+ & "O",restyp(iti),bfrag(1,j)-1
+
+
+
+ endif
+
+ enddo
+ endif
+#endif
if (nss.gt.0) then
do i=1,nss
write(iunit,'(a6,i4,1x,a3,i7,4x,a3,i7)')