Adam's unres update
[unres.git] / source / unres / src-HCD-5D / energy_split-sep.F
index 34a1bd1..51d5b2d 100644 (file)
@@ -13,7 +13,7 @@ cMS$ATTRIBUTES C ::  proc_proc
 #ifdef MPI
       include "mpif.h"
       double precision weights_(n_ene)
-      double precision time00,time_Bcast,time_BcastW
+      double precision time00
       integer ierror,ierr
 #endif
       include 'COMMON.SETUP'
@@ -29,6 +29,7 @@ cMS$ATTRIBUTES C ::  proc_proc
       include 'COMMON.QRESTR'
       include 'COMMON.MD'
       include 'COMMON.CONTROL'
+      include 'COMMON.TIME1'
       double precision evdw,evdw1,evdw2,evdw2_14,ees,eel_loc,
      & eello_turn3,eello_turn4,edfadis,estr,ehpb,ebe,ethetacnstr,
      & escloc,etors,edihcnstr,etors_d,esccor,ecorr,ecorr5,ecorr6,eturn6,
@@ -36,6 +37,9 @@ cMS$ATTRIBUTES C ::  proc_proc
      & esaxs_constr,ehomology_constr,edfator,edfanei,edfabet
       integer i,n_corr,n_corr1
 c      write(iout,'(a,i2)')'Calling etotal_long ipot=',ipot
+#ifdef TIMING_ENE
+      double precision time01
+#endif
       if (modecalc.eq.12.or.modecalc.eq.14) then
 #ifdef MPI
 c        if (fg_rank.eq.0) call int_from_cart1(.false.)
@@ -138,16 +142,25 @@ c      print *,'Processor',myrank,' nnt=',nnt,' nct=',nct
         call MPI_Bcast(itime_mat,1,MPI_INT,king,FG_COMM,IERROR)
       endif
       if (mod(itime_mat,imatupdate).eq.0) then
-        call make_SCp_inter_list
-        call make_SCSC_inter_list
+#ifdef TIMING_ENE
+        time01=MPI_Wtime()
+#endif
+        call make_SCp_inter_list_RESPA
+        call make_SCSC_inter_list_RESPA
         call make_pp_inter_list
-        call make_pp_vdw_inter_list
+        call make_pp_vdw_inter_list_RESPA
+#ifdef TIMING_ENE
+        time_list=time_list+MPI_Wtime()-time01
+#endif
       endif
 #endif     
 cd    print *,'nnt=',nnt,' nct=',nct
 C
 C Compute the side-chain and electrostatic interaction energy
 C
+#ifdef TIMING_ENE
+      time01=MPI_Wtime()
+#endif
       goto (101,102,103,104,105,106) ipot
 C Lennard-Jones potential.
   101 call elj_long(evdw)
@@ -171,8 +184,20 @@ C
 C Calculate electrostatic (H-bonding) energy of the main chain.
 C
   107 continue
+#ifdef TIMING_ENE
+      time_evdw_long=time_evdw_long+MPI_Wtime()-time01
+#endif
+#ifdef TIMING
+      time01=MPI_Wtime() 
+#endif
       call vec_and_deriv
+#ifdef TIMING
+      time_vec=time_vec+MPI_Wtime()-time01
+#endif
 c      write (iout,*) "etotal_long: shield_mode",shield_mode
+#ifdef TIMING_ENE
+      time01=MPI_Wtime()
+#endif
       if (shield_mode.eq.1) then
        call set_shield_fac
       else if  (shield_mode.eq.2) then
@@ -204,10 +229,16 @@ c        write (iout,*) "Soft-spheer ELEC potential"
         call eelec_soft_sphere(ees,evdw1,eel_loc,eello_turn3,
      &   eello_turn4)
       endif
+#ifdef TIMING_ENE
+      time_eelec_long=time_eelec_long+MPI_Wtime()-time01
+#endif
 C
 C Calculate excluded-volume interaction energy between peptide groups
 C and side chains.
 C
+#ifdef TIMING_ENE
+      time01=MPI_Wtime()
+#endif
       if (ipot.lt.6) then
        if(wscp.gt.0d0) then
         call escp_long(evdw2,evdw2_14)
@@ -218,6 +249,9 @@ C
       else
         call escp_soft_sphere(evdw2,evdw2_14)
       endif
+#ifdef TIMING_ENE
+      time_escp_long=time_escp_long+MPI_Wtime()-time01
+#endif
 #ifdef FOURBODY
 C 
 C 12/1/95 Multi-body terms
@@ -334,12 +368,16 @@ cMS$ATTRIBUTES C ::  proc_proc
       include 'COMMON.CONTROL'
       include 'COMMON.SAXS'
       include 'COMMON.TORCNSTR'
+      include 'COMMON.TIME1'
       double precision evdw,evdw1,evdw2,evdw2_14,ees,eel_loc,
      & eello_turn3,eello_turn4,edfadis,estr,ehpb,ebe,ethetacnstr,
      & escloc,etors,edihcnstr,etors_d,esccor,ecorr,ecorr5,ecorr6,eturn6,
      & eliptran,Eafmforce,Etube,
      & esaxs_constr,ehomology_constr,edfator,edfanei,edfabet
       integer i,n_corr,n_corr1
+#ifdef TIMING_ENE
+      double precision time01
+#endif
 c      write(iout,'(a,i2)')'Calling etotal_short ipot=',ipot
 c      call flush(iout)
       if (modecalc.eq.12.or.modecalc.eq.14) then
@@ -432,13 +470,13 @@ C FG slaves receive the WEIGHTS array
           wsaxs=weights(26)
         endif
 c        write (iout,*),"Processor",myrank," BROADCAST weights"
-        call MPI_Bcast(c(1,1),maxres6,MPI_DOUBLE_PRECISION,
+        call MPI_Bcast(c(1,1),6*nres,MPI_DOUBLE_PRECISION,
      &    king,FG_COMM,IERR)
 c        write (iout,*) "Processor",myrank," BROADCAST c"
-        call MPI_Bcast(dc(1,1),maxres6,MPI_DOUBLE_PRECISION,
+        call MPI_Bcast(dc(1,1),6*nres,MPI_DOUBLE_PRECISION,
      &    king,FG_COMM,IERR)
 c        write (iout,*) "Processor",myrank," BROADCAST dc"
-        call MPI_Bcast(dc_norm(1,1),maxres6,MPI_DOUBLE_PRECISION,
+        call MPI_Bcast(dc_norm(1,1),6*nres,MPI_DOUBLE_PRECISION,
      &    king,FG_COMM,IERR)
 c        write (iout,*) "Processor",myrank," BROADCAST dc_norm"
         call MPI_Bcast(theta(1),nres,MPI_DOUBLE_PRECISION,
@@ -470,6 +508,9 @@ c      call int_from_cart1(.false.)
 C
 C Compute the side-chain and electrostatic interaction energy
 C
+#ifdef TIMING_ENE
+      time01=MPI_Wtime()
+#endif
       goto (101,102,103,104,105,106) ipot
 C Lennard-Jones potential.
   101 call elj_short(evdw)
@@ -494,16 +535,31 @@ C
 C Calculate electrostatic (H-bonding) energy of the main chain.
 C
   107 continue
+#ifdef TIMING_ENE
+      time_evdw_short=time_evdw_short+MPI_Wtime()-time01
+#endif
 c
 c Calculate the short-range part of Evdwpp
 c
+#ifdef TIMING_ENE
+      time01=MPI_Wtime()
+#endif
       call evdwpp_short(evdw1)
+#ifdef TIMING_ENE
+      time_eelec_short=time_eelec_short+MPI_Wtime()-time01
+#endif
 c
 c Calculate the short-range part of ESCp
 c
+#ifdef TIMING_ENE
+      time01=MPI_Wtime()
+#endif
       if (ipot.lt.6) then
         call escp_short(evdw2,evdw2_14)
       endif
+#ifdef TIMING_ENE
+      time_escp_short=time_escp_short+MPI_Wtime()-time01
+#endif
 c
 c Calculate the bond-stretching energy
 c
@@ -531,7 +587,13 @@ C energy function
 C
 C Calculate the SC local energy.
 C
+#ifdef TIMING
+      time01=MPI_Wtime() 
+#endif
       call vec_and_deriv
+#ifdef TIMING
+      time_vec=time_vec+MPI_Wtime()-time01
+#endif
       call esc(escloc)
 C
 C Calculate the virtual-bond torsional energy.