adding ebend_nucl to UCGM+some further reading
[unres4.git] / source / unres / unres.f90
index f75675a..40c0140 100644 (file)
@@ -68,7 +68,6 @@
       text_mode_calc(13) = 'Not used 13'
       text_mode_calc(14) = 'Replica exchange molecular dynamics (REMD)'
 !      external ilen
-!el      run_wham=.false.
 !      call memmon_print_usage()
 
       call init_task
       else
 #endif
       if (modecalc.eq.0) then
-!write(iout,*)"!!!!!!!!!!!!!!!!! in unres"
-
         call exec_eeval_or_minim
-!write(iout,*)"!!!!!!!!!!!!!!!!! in unres"
-
       else if (modecalc.eq.1) then
         call exec_regularize
       else if (modecalc.eq.2) then
         call exec_mult_eeval_or_minim
       else if (modecalc.eq.5) then
         call exec_checkgrad
-!write(iout,*) "check grad dwa razy"
-!el        call exec_checkgrad
       else if (ModeCalc.eq.7) then
         call exec_map
       else if (ModeCalc.eq.8) then
         write (iout,'(a)') 'This calculation type is not supported',&
          ModeCalc
       endif
-!elwrite(iout,*)"!!!!!!!!!!!!!!!!!"
 
 #ifdef MPI
       endif
       use geometry, only:chainbuild
       use MDyn
       use io_units     !include 'COMMON.IOUNITS'
+!      use io_common
       implicit none
 !      include 'DIMENSIONS'
 #ifdef MPI
       include "mpif.h"
 #endif
+      print *,'Start MD'
       call alloc_MD_arrays
-      if (me.eq.king .or. .not. out1file) &
-         write (iout,*) "Calling chainbuild"
-      call chainbuild
+!      if (me.eq.king .or. .not. out1file) &
+!         write (iout,*) "Calling chainbuild"
+!      call chainbuild
       call MD
       return
       end subroutine exec_MD
       call alloc_MD_arrays
       call alloc_MREMD_arrays
 
-      if (me.eq.king .or. .not. out1file) &
-         write (iout,*) "Calling chainbuild"
-      call chainbuild
+!     if (me.eq.king .or. .not. out1file) &
+!         write (iout,*) "Calling chainbuild"
+!      call chainbuild
       if (me.eq.king .or. .not. out1file) &
          write (iout,*) "Calling REMD"
       if (remd_mlist) then 
       use control_data !include 'COMMON.CONTROL''COMMON.TIME1''COMMON.NAMES''COMMON.HEADER'
       use io_units     !include 'COMMON.IOUNITS'
       use names
-!      use io_common
 !      use energy      !include 'COMMON.INTERACT''COMMON.CONTACTS''COMMON.VAR''COMMON.FFIELD' 'COMMON.SBRIDGE'
       use geometry_data        !include 'COMMON.GEO''COMMON.CHAIN'
 !      use REMD        !include 'COMMON.REMD'
 !      use MD          !include 'COMMON.MD'
+
+      use energy_data
+
       use io_base
       use geometry, only:chainbuild
       use energy
       integer,dimension(4,nres/3) :: iharp     !(4,nres/3)(4,maxres/3)
       logical :: fail
       real(kind=8) :: rms,frac,frac_nn,co
+
+      integer :: j,k
       call alloc_compare_arrays
-      if (indpdb.eq.0) call chainbuild
+      if (indpdb.eq.0) then 
+      call chainbuild
+      write(iout,*) 'Warning: Calling chainbuild'
+      endif
 #ifdef MPI
       time00=MPI_Wtime()
 #endif
       call chainbuild_cart
-
+!      write(iout,*)"in exec_eeval or minimim",split_ene
+!      do j=1,2*nres+2
+!        write(iout,*)"cccccc",j,(c(i,j),i=1,3)
+!        write(iout,*)"dcccccc",j,(dc(i,j),i=1,3)
+!      enddo
       if (split_ene) then
+!      write(iout,*)"in exec_eeval or minimim"
 
        print *,"Processor",myrank," after chainbuild"
        icall=1
 #ifdef MPI
           time1=MPI_WTIME()
 #endif
+!    call check_ecartint !el
           call minim_dc(etot,iretcode,nfun)
+!    call check_ecartint !el
         else 
           if (indpdb.ne.0) then 
             call bond_regular
+            write(iout,*) 'Warning: Calling chainbuild'
             call chainbuild
           endif
           call geom_to_var(nvar,varia)
 #ifdef MPI
           time1=MPI_WTIME()
 #endif
+!    call check_eint
+!        call exec_checkgrad   !el
           call minimize(etot,varia,iretcode,nfun)
+!     call check_eint
+!        call exec_checkgrad   !el
         endif
         print *,'SUMSL return code is',iretcode,' eval ',nfun
 #ifdef MPI
       else
         print *,'refstr=',refstr
         if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
+        print *,"after rms_nac_ncc"
         call briefout(0,etot)
       endif
       if (outpdb) call pdbout(etot,titel(:32),ipdb)
       if (outmol2) call mol2out(etot,titel(:32))
+      write(iout,*) "after exec_eeval_or_minim"
       return
       end subroutine exec_eeval_or_minim
 !-----------------------------------------------------------------------------
             read (intin,'(i5)',end=1100,err=1100) iconf
             call read_angles(intin,*11)
             call geom_to_var(nvar,varia)
+            write(iout,*) 'Warning: Calling chainbuild'
             call chainbuild
           endif
           write (iout,'(a,i7)') 'Conformation #',iconf
             read (intin,'(i5)',end=11,err=11) iconf
             call read_angles(intin,*11)
             call geom_to_var(nvar,varia)
+            write(iout,*) 'Warning: Calling chainbuild'
             call chainbuild
           endif
           write (iout,'(a,i7)') 'Conformation #',iconf
 !         print *,'result received from worker ',man,' sending now'
 
           call var_to_geom(nvar,varia)
+          write(iout,*) 'Warning: Calling chainbuild'
           call chainbuild
           call etotal(energy_)
           iconf=ind(2)
             read (intin,'(i5)',end=1101,err=1101) iconf
             call read_angles(intin,*11)
             call geom_to_var(nvar,varia)
+            write(iout,*) 'Warning: Calling chainbuild'
             call chainbuild
           endif
           n=n+1
                      CG_COMM,muster,ierr)
 
         call var_to_geom(nvar,varia)
+        write(iout,*) 'Warning: Calling chainbuild'
         call chainbuild
         call etotal(energy_)
         iconf=ind(2)
             read (intin,'(i5)',end=11,err=11) iconf
             call read_angles(intin,*11)
             call geom_to_var(nvar,varia)
+            write(iout,*) 'Warning: Calling chainbuild'
             call chainbuild
           endif
         write (iout,'(a,i7)') 'Conformation #',iconf
 !        if (itype(i).ne.10) 
 !     &      vbld(i+nres)=vbld(i+nres)+ran_number(-0.001d0,0.001d0)
 !      enddo
-      if (indpdb.eq.0) call chainbuild
+      if (indpdb.eq.0) then 
+        write(iout,*) 'Warning: Calling chainbuild'
+        call chainbuild
+      endif
 !      do i=0,nres
 !        do j=1,3
 !          dc(j,i)=dc(j,i)+ran_number(-0.2d0,0.2d0)
       end subroutine exec_checkgrad
 !-----------------------------------------------------------------------------
       subroutine exec_map
+!      use map_data
       use map_
       use io_config, only:map_read
       implicit none
       logical :: debug
 
       call alloc_compare_arrays
+      write(iout,*) 'Warning: Calling chainbuild'
       call chainbuild
       call etotal(energy_)
       call enerprint(energy_)
       real(kind=8) :: time00
       integer :: iorder,i,j,nres2,ierr,ierror
       nres2=2*nres
+#ifndef FIVEDIAG
       if(.not.allocated(Gcopy)) allocate(Gcopy(nres2,nres2))
 ! common.MD
       if(.not.allocated(Ginv)) allocate(Ginv(nres2,nres2)) !(maxres2,maxres2)
+#endif
 !      common /mdpmpi/
       if(.not.allocated(ng_start)) allocate(ng_start(0:nfgtasks-1))
       if(.not.allocated(ng_counts)) allocate(ng_counts(0:nfgtasks-1))
       if(.not.allocated(nginv_counts)) allocate(nginv_counts(0:nfgtasks-1)) !(0:MaxProcs-1)
       if(.not.allocated(nginv_start)) allocate(nginv_start(0:nfgtasks)) !(0:MaxProcs)
-
+#ifndef FIVEDIAG
       if(.not.allocated(fricmat)) allocate(fricmat(nres2,nres2)) !maxres2=2*maxres
-
+#endif
 ! Workers wait for variables and NF, and NFL from the boss
       iorder=0
       do while (iorder.ge.0)
         else if (iorder.eq.8) then
           call intcartderiv
         else if (iorder.eq.9) then
-write(iout,*) "przed fricmat_mult"
           call fricmat_mult(z,d_a_tmp)
-write(iout,*) "po fricmat_mult"
         else if (iorder.eq.10) then
-write(iout,*) "przed setup_fricmat"
           call setup_fricmat
-write(iout,*) "o setup_fricmat"
         endif
       enddo
       write (*,*) 'Processor',fg_rank,' CG group',kolor,&