introduction of genconstr to wham
[unres.git] / source / wham / src-M / readrtns.F
index 06c7af5..6c69644 100644 (file)
        call reada(controlcard,'BOXX',boxxsize,100.0d0)
        call reada(controlcard,'BOXY',boxysize,100.0d0)
        call reada(controlcard,'BOXZ',boxzsize,100.0d0)
+      call readi(controlcard,'TUBEMOD',tubelog,0)
+      write (iout,*) TUBElog,"TUBEMODE"
+      call readi(controlcard,'GENCONSTR',genconstr,0)
+
 c Cutoff range for interactions
       call reada(controlcard,"R_CUT",r_cut,15.0d0)
       call reada(controlcard,"LAMBDA",rlamb,0.3d0)
@@ -106,6 +110,17 @@ C      endif
       write (iout,*) "einicheck",einicheck
       write (iout,*) "rescale_mode",rescale_mode
       call flush(iout)
+      if (TUBElog.gt.0) then
+       call reada(controlcard,"XTUBE",tubecenter(1),0.0d0)
+       call reada(controlcard,"YTUBE",tubecenter(2),0.0d0)
+       call reada(controlcard,"ZTUBE",tubecenter(3),0.0d0)
+       call reada(controlcard,"RTUBE",tubeR0,0.0d0)
+       call reada(controlcard,"TUBETOP",bordtubetop,boxzsize)
+       call reada(controlcard,"TUBEBOT",bordtubebot,0.0d0)
+       call reada(controlcard,"TUBEBUF",tubebufthick,1.0d0)
+       buftubebot=bordtubebot+tubebufthick
+       buftubetop=bordtubetop-tubebufthick
+      endif
       bxfile=index(controlcard,"BXFILE").gt.0
       cxfile=index(controlcard,"CXFILE").gt.0
       if (nslice .eq. 1 .and. .not.bxfile .and. .not.cxfile)
@@ -832,3 +847,87 @@ c-------------------------------------------------------------------------------
       iroof = ii
       return
       end
+C--------------------------------------------------------------------------
+      subroutine gen_dist_constr
+C Generate CA distance constraints.
+      implicit real*8 (a-h,o-z)
+      include "DIMENSIONS"
+      include "DIMENSIONS.ZSCOPT"
+      include "DIMENSIONS.FREE"
+      include "COMMON.TORSION"
+      include "COMMON.INTERACT"
+      include "COMMON.IOUNITS"
+      include "COMMON.TIME1"
+      include "COMMON.PROT"
+      include "COMMON.PROTFILES"
+      include "COMMON.CHAIN"
+      include "COMMON.NAMES"
+      include "COMMON.FFIELD"
+      include "COMMON.ENEPS"
+      include "COMMON.WEIGHTS"
+      include "COMMON.FREE"
+      include "COMMON.CONTROL"
+      include "COMMON.ENERGIES"
+      include "COMMON.SPLITELE"
+      include "COMMON.SBRIDGE"
+      include "COMMON.SHIELD"
+      dimension itype_pdb(maxres)
+      common /pizda/ itype_pdb
+      character*2 iden
+cd      print *,'gen_dist_constr: nnt=',nnt,' nct=',nct
+cd      write (2,*) 'gen_dist_constr: nnt=',nnt,' nct=',nct,
+cd     & ' nstart_sup',nstart_sup,' nstart_seq',nstart_seq,
+cd     & ' nsup',nsup
+      if (constr_dist.eq.11) then
+             do i=nstart_sup,nstart_sup+nsup-1
+              do j=i+2,nstart_sup+nsup-1
+                 distance=dist(i,j)
+                 if (distance.le.15.0) then
+                 nhpb=nhpb+1
+                 ihpb(nhpb)=i+nstart_seq-nstart_sup
+                 jhpb(nhpb)=j+nstart_seq-nstart_sup
+                 forcon(nhpb)=sqrt(0.04*distance)
+                 fordepth(nhpb)=sqrt(40.0/distance)
+                 dhpb(nhpb)=distance-0.1d0
+                 dhpb1(nhpb)=distance+0.1d0
+
+C#ifdef MPI
+C          if (.not.out1file .or. me.eq.king)
+C     &    write (iout,'(a,3i5,f8.2,f10.2)') "+dist.constr ",
+C     &     nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
+C#else
+          write (iout,'(a,3i5,f8.2,f10.2)') "+dist.constr ",
+     &     nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
+C#endif
+            endif
+             enddo
+           enddo
+      else
+      do i=nstart_sup,nstart_sup+nsup-1
+cd      write (2,*) 'i',i,' seq ',restyp(itype(i+nstart_seq-nstart_sup)),
+cd     &    ' seq_pdb', restyp(itype_pdb(i))
+        do j=i+2,nstart_sup+nsup-1
+          nhpb=nhpb+1
+          ihpb(nhpb)=i+nstart_seq-nstart_sup
+          jhpb(nhpb)=j+nstart_seq-nstart_sup
+          forcon(nhpb)=weidis
+          dhpb(nhpb)=dist(i,j)
+        enddo
+      enddo
+      endif
+cd      write (iout,'(a)') 'Distance constraints:' 
+cd      do i=nss+1,nhpb
+cd        ii=ihpb(i)
+cd        jj=jhpb(i)
+cd        iden='CA'
+cd        if (ii.gt.nres) then
+cd          iden='SC'
+cd          ii=ii-nres
+cd          jj=jj-nres
+cd        endif
+cd        write (iout,'(a,1x,a,i4,3x,a,1x,a,i4,2f10.3)') 
+cd     &  restyp(itype(ii)),iden,ii,restyp(itype(jj)),iden,jj,
+cd     &  dhpb(i),forcon(i)
+cd      enddo
+      return
+      end