Merge branch 'devel' into feature-ga
[unres.git] / source / unres / src_MIN / unres_min.F
index e7b09ab..1e97d6e 100644 (file)
@@ -67,15 +67,6 @@ C
        write (iout,'(80(1h*)/)') 
       endif
       call flush(iout)
-C
-c      if (modecalc.eq.-2) then
-c        call test
-c        stop
-c      else if (modecalc.eq.-1) then
-c        write(iout,*) "call check_sc_map next"
-c        call check_bond
-c        stop
-c      endif
 #ifdef MPI
       if (fg_rank.gt.0) then
 C Fine-grain slaves just do energy and gradient components.
@@ -84,26 +75,8 @@ C Fine-grain slaves just do energy and gradient components.
 #endif
       if (modecalc.eq.0) then
         call exec_eeval_or_minim
-c      else if (modecalc.eq.1) then
-c        call exec_regularize
-c      else if (modecalc.eq.2) then
-c        call exec_thread
-c      else if (modecalc.eq.3 .or. modecalc .eq.6) then
-c        call exec_MC
-c      else if (modecalc.eq.4) then
-c        call exec_mult_eeval_or_minim
       else if (modecalc.eq.5) then
          call exec_checkgrad
-c      else if (ModeCalc.eq.7) then
-c        call exec_map
-c      else if (ModeCalc.eq.8) then
-c        call exec_CSA
-c      else if (modecalc.eq.11) then
-c        call exec_softreg
-c      else if (modecalc.eq.12) then
-c        call exec_MD
-c      else if (modecalc.eq.14) then
-c        call exec_MREMD
       else
         write (iout,'(a)') 'This calculation type is not supported',
      &   ModeCalc
@@ -142,33 +115,23 @@ c---------------------------------------------------------------------------
       include 'COMMON.VAR'
       include 'COMMON.IOUNITS'
       include 'COMMON.FFIELD'
-c      include 'COMMON.REMD'
-c      include 'COMMON.MD'
       include 'COMMON.SBRIDGE'
       common /srutu/ icall
-      double precision energy(0:n_ene)
+      double precision energy(0:n_ene),varia(maxvar)
       double precision energy_long(0:n_ene),energy_short(0:n_ene)
       if (indpdb.eq.0) call chainbuild
-c      time00=MPI_Wtime()
+#ifdef MPI
+      time00=MPI_Wtime()
+#else
+      time00=tcpu()
+#endif
       call chainbuild_cart
-c      if (split_ene) then
-c       print *,"Processor",myrank," after chainbuild"
-c       icall=1
-c       call etotal_long(energy_long(0))
-c       write (iout,*) "Printing long range energy"
-c       call enerprint(energy_long(0))
-c       call etotal_short(energy_short(0))
-c       write (iout,*) "Printing short range energy"
-c       call enerprint(energy_short(0))
-c       do i=0,n_ene
-c         energy(i)=energy_long(i)+energy_short(i)
-c         write (iout,*) i,energy_long(i),energy_short(i),energy(i)
-c       enddo
-c       write (iout,*) "Printing long+short range energy"
-c       call enerprint(energy(0))
-c      endif
       call etotal(energy(0))
-c      time_ene=MPI_Wtime()-time00
+#ifdef MPI
+      time_ene=MPI_Wtime()-time00
+#else
+      time_ene=tcpu()
+#endif
       write (iout,*) "Time for energy evaluation",time_ene
       print *,"after etotal"
       etota = energy(0)
@@ -180,7 +143,11 @@ c      call secondary2(.true.)
 
         if (dccart) then
           print *, 'Calling MINIM_DC'
-c          time1=MPI_WTIME()
+#ifdef MPI
+          time1=MPI_WTIME()
+#else
+          time1=tcpu()
+#endif
           call minim_dc(etot,iretcode,nfun)
         else
           if (indpdb.ne.0) then 
@@ -189,11 +156,19 @@ c          time1=MPI_WTIME()
           endif
           call geom_to_var(nvar,varia)
           print *,'Calling MINIMIZE.'
-c          time1=MPI_WTIME()
+#ifdef MPI
+          time1=MPI_WTIME()
+#else
+          time1=tcpu()
+#endif
           call minimize(etot,varia,iretcode,nfun)
         endif
         print *,'SUMSL return code is',iretcode,' eval ',nfun
-c        evals=nfun/(MPI_WTIME()-time1)
+#ifdef MPI
+        evals=nfun/(MPI_WTIME()-time1)
+#else
+        evals=nfun/(tcpu()-time1)
+#endif
         print *,'# eval/s',evals
         print *,'refstr=',refstr
 c        call hairpin(.true.,nharp,iharp)
@@ -266,8 +241,6 @@ c      enddo
       totT=1.d0
       eq_time=0.0d0
 c      call read_fragments
-      read(inp,*) t_bath
-      call rescale_weights(t_bath)
       call chainbuild_cart
       call cartprint
       call intout