Adam's cluster wham update
[unres.git] / source / cluster / wham / src-HCD / geomout.F
index 4ef656f..d513764 100644 (file)
       include 'COMMON.SBRIDGE'
       include 'COMMON.TEMPFAC'
       character*50 tytul
-      character*1 chainid(10) /'A','B','C','D','E','F','G','H','I','J'/
       dimension ica(maxres)
+      character*1 chainid(32) /'A','B','C','D','E','F','G','H','I','J',
+     & 'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
+     & '1','2','3','4','5','6'/
       write (ipdb,'(3a,1pe15.5,a,0pf7.2)') 'REMARK ',tytul(:20),
      &  ' ENERGY ',etot,' RMS ',rmsd
+      do i=1,nss
+        ici=ireschain(ihpb(i)-nres)
+        icj=ireschain(jhpb(i)-nres)
+        iri=ihpb(i)-chain_border(1,ici)+1-nres
+        irj=jhpb(i)-chain_border(1,icj)+1-nres
+c        write (iout,*) ihpb(i),ici,iri,jhpb(i),icj,irj
+        write(ipdb,'(a6,i4,1x,a3,1x,a1,i5,4x,a3,1x,a1,i5,38x,f5.2)')
+     &    'SSBOND',i,'CYS',chainid(ici),iri,'CYS',chainid(icj),irj,
+     &    dist(ihpb(i),jhpb(i))
+      enddo
       iatom=0
       ichain=1
       ires=0
+      iti_prev=0
       do i=nnt,nct
         iti=itype(i)
         if (iti.eq.ntyp1) then
-          ichain=ichain+1
           ires=0
-          write (ipdb,'(a)') 'TER'
+          if (iti_prev.ne.ntyp1) then
+            write (ipdb,'(a)') 'TER'
+            ichain=ichain+1
+          endif
         else
         ires=ires+1
         iatom=iatom+1
@@ -35,6 +50,7 @@
      &      ires,(c(j,nres+i),j=1,3),1.0d0,tempfac(2,i)
         endif
         endif
+        iti_prev=iti
       enddo
       write (ipdb,'(a)') 'TER'
       do i=nnt,nct-1