correction of readrtns
[unres.git] / source / cluster / wham / src-M / readrtns.F
index 0140df4..6e88ef3 100644 (file)
@@ -19,7 +19,7 @@ C
 #ifdef MPL
       include 'COMMON.INFO'
 #endif
-      integer i
+      integer i,i1,i2,it1,it2
 
       read (INP,'(a80)') titel
       call card_concat(controlcard)
@@ -96,7 +96,7 @@ C
       double precision x(maxvar)
       integer itype_pdb(maxres)
       logical seq_comp
-      integer i,j
+      integer i,j,kkk,i1,i2,it1,it2
 C
 C Body
 C
@@ -115,6 +115,7 @@ C Read weights of the subsequent energy terms.
       call reada(weightcard,'WTURN4',wturn4,1.0D0)
       call reada(weightcard,'WTURN6',wturn6,1.0D0)
       call reada(weightcard,'WSTRAIN',wstrain,1.0D0)
+      call reada(weightcard,'WSCCOR',wsccor,1.0D0)
       call reada(weightcard,'WBOND',wbond,1.0D0)
       call reada(weightcard,'WTOR',wtor,1.0D0)
       call reada(weightcard,'WTORD',wtor_d,1.0D0)
@@ -125,6 +126,51 @@ C Read weights of the subsequent energy terms.
       call reada(weightcard,'CUTOFF',cutoff_corr,7.0d0)
       call reada(weightcard,'DELT_CORR',delt_corr,0.5d0)
       if (index(weightcard,'SOFT').gt.0) ipot=6
+      call reada(weightcard,"D0CM",d0cm,3.78d0)
+      call reada(weightcard,"AKCM",akcm,15.1d0)
+      call reada(weightcard,"AKTH",akth,11.0d0)
+      call reada(weightcard,"AKCT",akct,12.0d0)
+      call reada(weightcard,"V1SS",v1ss,-1.08d0)
+      call reada(weightcard,"V2SS",v2ss,7.61d0)
+      call reada(weightcard,"V3SS",v3ss,13.7d0)
+      call reada(weightcard,"EBR",ebr,-5.50D0)
+      call reada(weightcard,"ATRISS",atriss,0.301D0)
+      call reada(weightcard,"BTRISS",btriss,0.021D0)
+      call reada(weightcard,"CTRISS",ctriss,1.001D0)
+      call reada(weightcard,"DTRISS",dtriss,1.001D0)
+      write (iout,*) "ATRISS=", atriss
+      write (iout,*) "BTRISS=", btriss
+      write (iout,*) "CTRISS=", ctriss
+      write (iout,*) "DTRISS=", dtriss
+      dyn_ss=(index(weightcard,'DYN_SS').gt.0)
+      do i=1,maxres
+        dyn_ss_mask(i)=.false.
+      enddo
+      do i=1,maxres-1
+        do j=i+1,maxres
+          dyn_ssbond_ij(i,j)=1.0d300
+        enddo
+      enddo
+      call reada(weightcard,"HT",Ht,0.0D0)
+      if (dyn_ss) then
+        ss_depth=ebr/wsc-0.25*eps(1,1)
+        Ht=Ht/wsc-0.25*eps(1,1)
+        akcm=akcm*wstrain/wsc
+        akth=akth*wstrain/wsc
+        akct=akct*wstrain/wsc
+        v1ss=v1ss*wstrain/wsc
+        v2ss=v2ss*wstrain/wsc
+        v3ss=v3ss*wstrain/wsc
+      else
+        ss_depth=ebr/wstrain-0.25*eps(1,1)*wsc/wstrain
+      endif
+      write (iout,'(/a)') "Disulfide bridge parameters:"
+      write (iout,'(a,f10.2)') 'S-S bridge energy: ',ebr
+      write (iout,'(2(a,f10.2))') 'd0cm:',d0cm,' akcm:',akcm
+      write (iout,'(2(a,f10.2))') 'akth:',akth,' akct:',akct
+      write (iout,'(3(a,f10.2))') 'v1ss:',v1ss,' v2ss:',v2ss,
+     & ' v3ss:',v3ss
+
 C 12/1/95 Added weight for the multi-body term WCORR
       call reada(weightcard,'WCORRH',wcorr,1.0D0)
       if (wcorr4.gt.0.0d0) wcorr=wcorr4
@@ -146,9 +192,10 @@ C 12/1/95 Added weight for the multi-body term WCORR
       weights(16)=wvdwpp
       weights(17)=wbond
       weights(18)=scal14
+      weights(19)=wsccor
       write (iout,10) wsc,wscp,welec,wvdwpp,wbond,wang,wscloc,wtor,
      &  wtor_d,wstrain,wel_loc,wcorr,wcorr5,wcorr6,wturn3,
-     &  wturn4,wturn6
+     &  wturn4,wturn6,wsccor
    10 format (/'Energy-term weights (unscaled):'//
      & 'WSCC=   ',f10.6,' (SC-SC)'/
      & 'WSCP=   ',f10.6,' (SC-p)'/
@@ -166,7 +213,9 @@ C 12/1/95 Added weight for the multi-body term WCORR
      & 'WCORR6= ',f10.6,' (multi-body 6th order)'/
      & 'WTURN3= ',f10.6,' (turns, 3rd order)'/
      & 'WTURN4= ',f10.6,' (turns, 4th order)'/
-     & 'WTURN6= ',f10.6,' (turns, 6th order)')
+     & 'WTURN6= ',f10.6,' (turns, 6th order)'/
+     & 'WSCCOR= ',f10.6,' (SC-backbone torsinal correalations)')
+
       if (wcorr4.gt.0.0d0) then
         write (iout,'(/2a/)') 'Local-electrostatic type correlation ',
      &   'between contact pairs of peptide groups'
@@ -207,9 +256,9 @@ C Convert sequence to numeric code
 
       do i=1,nres
 #ifdef PROCOR
-        if (itype(i).eq.21 .or. itype(i+1).eq.21) then
+        if (itype(i).eq.ntyp1 .or. itype(i+1).eq.ntyp1) then
 #else
-        if (itype(i).eq.21) then
+        if (itype(i).eq.ntyp1) then
 #endif
           itel(i)=0
 #ifdef PROCOR
@@ -232,8 +281,8 @@ C Convert sequence to numeric code
       nnt=1
       nct=nres
       print *,'NNT=',NNT,' NCT=',NCT
-      if (itype(1).eq.21) nnt=2
-      if (itype(nres).eq.21) nct=nct-1
+      if (itype(1).eq.ntyp1) nnt=2
+      if (itype(nres).eq.ntyp1) nct=nct-1
       if (nstart.lt.nnt) nstart=nnt
       if (nend.gt.nct .or. nend.eq.0) nend=nct
       write (iout,*) "nstart",nstart," nend",nend
@@ -299,14 +348,49 @@ c      endif
           nstart_sup=nnt
           nstart_seq=nnt
           nsup=nct-nnt+1
+          kkk=1
           do i=1,2*nres
             do j=1,3
-              cref(j,i)=c(j,i)
+              cref(j,i,kkk)=c(j,i)
             enddo
           enddo
         endif
         call contact(.true.,ncont_ref,icont_ref)
       endif
+       if (ns.gt.0) then
+C        write (iout,'(/a,i3,a)')
+C     &  'The chain contains',ns,' disulfide-bridging cysteines.'
+        write (iout,'(20i4)') (iss(i),i=1,ns)
+       if (dyn_ss) then
+          write(iout,*)"Running with dynamic disulfide-bond formation"
+       else
+        write (iout,'(/a/)') 'Pre-formed links are:'
+        do i=1,nss
+          i1=ihpb(i)-nres
+          i2=jhpb(i)-nres
+          it1=itype(i1)
+          it2=itype(i2)
+          write (iout,'(2a,i3,3a,i3,a,3f10.3)')
+     &    restyp(it1),'(',i1,') -- ',restyp(it2),'(',i2,')',dhpb(i),
+     &    ebr,forcon(i)
+        enddo
+        write (iout,'(a)')
+       endif
+      endif
+      if (ns.gt.0.and.dyn_ss) then
+          do i=nss+1,nhpb
+            ihpb(i-nss)=ihpb(i)
+            jhpb(i-nss)=jhpb(i)
+            forcon(i-nss)=forcon(i)
+            dhpb(i-nss)=dhpb(i)
+          enddo
+          nhpb=nhpb-nss
+          nss=0
+          call hpb_partition
+          do i=1,ns
+            dyn_ss_mask(iss(i))=.true.
+          enddo
+      endif
       return
       end
 c-----------------------------------------------------------------------------
@@ -351,10 +435,12 @@ C Check whether the specified bridging residues are cystines.
       do i=1,ns
        if (itype(iss(i)).ne.1) then
          write (iout,'(2a,i3,a)') 
-     &   'Do you REALLY think that the residue ',restyp(iss(i)),i,
+     &   'Do you REALLY think that the residue ',
+     &    restyp(itype(iss(i))),i,
      &   ' can form a disulfide bridge?!!!'
          write (*,'(2a,i3,a)') 
-     &   'Do you REALLY think that the residue ',restyp(iss(i)),i,
+     &   'Do you REALLY think that the residue ',
+     &   restyp(itype(iss(i))),i,
      &   ' can form a disulfide bridge?!!!'
 #ifdef MPL
         call mp_stopall(error_msg)
@@ -395,8 +481,8 @@ C bridging residues.
           enddo
           write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
    20     continue
-          dhpb(i)=dbr
-          forcon(i)=fbr
+C          dhpb(i)=dbr
+C          forcon(i)=fbr
         enddo
         do i=1,nss
           ihpb(i)=ihpb(i)+nres