Adam's unres update
[unres.git] / source / unres / src-HCD-5D / unres.F
index 978fa59..2e0ebaf 100644 (file)
@@ -213,11 +213,11 @@ c      include 'COMMON.CONTACTS'
       include 'COMMON.REMD'
       include 'COMMON.MD'
       include 'COMMON.SBRIDGE'
-      integer i,icall,iretcode,nfun
+      integer i,it,icall,iretcode,nfun
       common /srutu/ icall
       integer nharp,iharp(4,maxres/3)
       integer nft_sc
-      logical fail
+      logical fail,secondary_str /.true./
       double precision energy(0:n_ene),etot,etota
       double precision energy_long(0:n_ene),energy_short(0:n_ene)
       double precision rms,frac,frac_nn,co
@@ -243,6 +243,24 @@ c      include 'COMMON.CONTACTS'
       write (iout,*) "Energy evaluation/minimization"
       call chainbuild_cart
 c      print *,'dc',dc(1,0),dc(2,0),dc(3,0)
+      if (nran_start.gt.0) then
+        write (iout,*) 
+     & "Chains will be regenerated starting from residue",nran_start
+        do it=1,100
+        call gen_rand_conf_mchain(nran_start,*10)
+        write (iout,*) "Conformation successfully generated",it
+        goto 11
+   10   write (iout,*) "Problems with regenerating chains",it
+        enddo
+   11   continue
+        write (iout,*) "Cartesian coords after chain rebuild"
+        call cartprint
+        call chainbuild_cart
+        write (iout,*) "Cartesian coords after chainbuild_ecart"
+        call cartprint
+        call int_from_cart1(.false.)
+        call intout
+      endif
       if (split_ene) then
        print *,"Processor",myrank," after chainbuild"
        icall=1
@@ -274,9 +292,11 @@ c      print *,"after etotal"
       etota = energy(0)
       etot =etota
       call enerprint(energy(0))
+      if (secondary_str) then
       call hairpin(.true.,nharp,iharp)
 c        print *,'after hairpin'
       call secondary2(.true.)
+      endif
 c        print *,'after secondary'
       if (minim) then
 crc overlap test
@@ -292,6 +312,9 @@ crc overlap test
           write (iout,*) 'Calling OVERLAP_SC'
           call overlap_sc(fail)
           write (iout,*) "After overlap_sc"
+c        cartname=prefix(:ilen(prefix))//'.x'
+c        potE=etot
+c        call cartoutx(0.0d0)
         endif 
 
         if (searchsc) then 
@@ -330,10 +353,12 @@ c          print *,'Calling MINIMIZE.'
 #endif
         print *,'# eval/s',evals
         print *,'refstr=',refstr
+        if (secondary_str) then
         call hairpin(.false.,nharp,iharp)
-        print *,'after hairpin'
+c        print *,'after hairpin'
         call secondary2(.true.)
-        print *,'after secondary'
+c        print *,'after secondary'
+        endif
         call etotal(energy(0))
         etot = energy(0)
         call enerprint(energy(0))